Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix decompressing textures with dimensions that are not multiples of 4 #97873

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

BlueCube3310
Copy link
Contributor

@BlueCube3310 BlueCube3310 commented Oct 6, 2024

Fixes #97862

Fixes the alignment of some compressed textures when decompressing. This issue seems to stem from the fact that the extra padding on compressed images is not taken into account when importing as VRAM compressed.

Also, the image linked in the issue's MRP seems to not decompress properly. Looking into the image's data, it looks like the endpoint indices are unusual (set to 1, for solid color blocks most compressors set them to 0). This tricks bcdec into thinking that the block has punchthrough transparency and incorrectly decompresses it. Godot doesn't support the BC1 punchthrough mode, so the compressed images appear fine.

@BlueCube3310 BlueCube3310 requested a review from a team as a code owner October 6, 2024 09:06
@BlueCube3310 BlueCube3310 force-pushed the image-decompress-4-fix branch from ac9fb8a to a60195e Compare October 6, 2024 09:13
@fire
Copy link
Member

fire commented Oct 6, 2024

@lyuma could you review this since you debugged an earlier problem like this

@nikitalita
Copy link
Contributor

Here are the original glbs that the texture was from if anyone wants to figure out how the images were imported like that: https://github.com/user-attachments/files/17269720/SmallShips.zip

@Repiteo Repiteo merged commit e857e81 into godotengine:master Oct 10, 2024
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 10, 2024

Thanks!

@okla
Copy link

okla commented Oct 28, 2024

Could it fix #85747 too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Heap buffer overflow when attempting to decompress a 1x1 DXT1 compressed image
7 participants