diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-11-27 21:15:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-27 21:15:49 +0000 |
commit | 85d87116e184e7923b8d6804cab2681b61c62d83 (patch) | |
tree | 55ec5bfa061a5c27272b831e697b78ed1b756a70 /modules/dds/texture_loader_dds.cpp | |
parent | b06d20bf39d15ec736d08d4e4fcb32e0c3c1ce1e (diff) | |
parent | 721f53fde47c2727d99e3ecccdb789a67df36de0 (diff) | |
download | redot-engine-master.tar.gz |
Merge commit godotengine/godot@f128f38
Diffstat (limited to 'modules/dds/texture_loader_dds.cpp')
-rw-r--r-- | modules/dds/texture_loader_dds.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 229d0b2b39..6eb37290ec 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -291,6 +291,15 @@ static Ref<Image> _dds_load_layer(Ref<FileAccess> p_file, DDSFormat p_dds_format if (info.compressed) { // BC compressed. + w += w % info.divisor; + h += h % info.divisor; + if (w != p_width) { + WARN_PRINT(vformat("%s: DDS width '%d' is not divisible by %d. This is not allowed as per the DDS specification, attempting to load anyway.", p_file->get_path(), p_width, info.divisor)); + } + if (h != p_height) { + WARN_PRINT(vformat("%s: DDS height '%d' is not divisible by %d. This is not allowed as per the DDS specification, attempting to load anyway.", p_file->get_path(), p_height, info.divisor)); + } + uint32_t size = MAX(info.divisor, w) / info.divisor * MAX(info.divisor, h) / info.divisor * info.block_size; if (p_flags & DDSD_LINEARSIZE) { |