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
[rtextures] DDS / DXT1, DXT3 and DXT5: unit 0 GLD_TEXTURE_INDEX_2D is unloadable #3962
Comments
@aboeglin I'm testing the shared image and I get the following info about it, please could you confirm it is correct:
The image size looks a bit strange to me, please, could you try converting it to power-of-two? Image and texture get loaded but I get a black image; I think the internally computed size could not be correct... |
Definitely the issue is related to image not being POT, I tried to resize canvas to POT and now it loads correctly. |
@raysan5 yes correct, the provided image was compressed with DXT5. And your POT version does work although I'm pretty sure I tried that when exporting from texture packer already. Is it expected that non POT DXT compressed images can't be bound? Well given how the compression works it does make some sense but also I'd rather expect it to need to be like a multiple of 4 or something. |
Actually I'm not sure, I tried opening the DDS image with Paint.NET and it was able to open it but I don't know if there is some internal magic to convert it to POT or just decompress the image data on loading (raylib tries to load the compressed data as GPU compresed texture)... I reviewed the DDS loading code in raylib , and I couldn't see any issue with it, the information it gets from the DDS image header is actually the data used when trying to load it as a texture. I'd also expect it to be, at least, multiple of 4 in size and 1473 it's not... |
Actually it seems to work with non POT dimensions that are multiples of 4. Would it be complicated to report an error while loading the texture for DXT formats if it doesn't comply? I'm happy to look into it if given pointers. |
It could log some warning message if size is not multiple of 4 (point where you get that info from the file). I'm investigating the issue and I think the data_size is not correctly calculated when image data is compressed. It needs to be reviewed more carefully. Here some reference code. |
Should I try to open a PR to log a warning when the size isn’t a multiple of 4 for now until we try to see if we can make all sizes work? |
Issue description
I have a sprite sheet that works fine when loaded as png but fails when loaded as DXT. I've tried different softwares to generate it. Texture packer, gimp and online converters all leads to the same issue, the texture seems to load fine:
I've also tried DXT1, 3 and 5 compression, all leading to the same issue:
Environment
Example file causing the issue
Here is one such image: barbarian_jump.dds.zip.
The text was updated successfully, but these errors were encountered: