Non-displayable image after converting .png with alpha to .ktx2 (WebGL warning: compressedTexImage: Unexpected error from driver.)

I am experiencing issues when converting .png images with alpha to .ktx2. Some work, but the major don’t.
Here is what i get when i drop them in the sandbox:

The error isn’t very informative…
I am converting them with this call:
toktx.exe --lower_left_maps_to_s0t0 --t2 --bcmp out.ktx2 in.png
Maybe somebody here has experience with converting .png images with alpha.

Pinging @Evgeni_Popov

I have just tested with a random .png file on my computer and it did work.

Can you provide a .png / .ktx2 files that don’t work for you?

Here you go: (53.1 KB)

The width and height dimensions should be dividable by 4 to work. I think it’s a limitation of the GPU but maybe @bghgary will know more about it.

I don’t know much about driver limitations, but there is some discussion about it here for KTX in glTF. For full compatibility, the source should probably be a POT texture. @Evgeni_Popov perhaps we should check for this, decode to raw when the texture is not a multiple of 4, and resize? We already do something similar for NPOT on WebGL1. We should log a warning if we decide to do this.

We can do that indeed. However, why resizing? If we transcode to raw, then even if the width/height are not multiple of 4 it will work(?)

I guess I’m thinking about NPOT which depends if it’s WebGL1 or 2. WebGL1 must be POT, but I guess that’s already handled by the existing code.