8k .basis texture not loading on mobile (4k works fine)


When trying to load an 8k .basis texture on mobile (Nexus 5X Android or iOS 14.4.2), the load fails. On Android I can see the following error:

[.WebGL-0x5f43b400]GL ERROR :GL_INVALID_VALUE : glCompressedTexImage2D: dimensions out of range
[.WebGL-0x5f43b400]RENDER WARNING: texture bound to texture unit 0 is not renderable. It might be non-power-of-2 or have incompatible texture filtering (maybe)?

And the same texture in 4k loads fine.

I’ve created the .basis file with the following command:

basisu -comp_level 4 -max_selectors 16128 -max_endpoints 16128 <input.png> -output_file <input.basis>

Anyone has experience with basis files and possible fix to load an 8k? I’ve only started to use that format recently on a couple projects. I can share the images if that helps.

What value is reported with this test fiddle on your device: https://jsfiddle.net/vqbsoyp2/

Thank you for your quick reply. I should have clarified that if I load an 8k JPG instead, it works fine, so it seems to me it’s not resolution related.
But in any case, here is what I see with your link:

  • Nexus 5X Android: 16384
  • iOS 14.4.2: 16384 (although it did not work with webgl2, I had to switch the context to webgl)

To be honest I’m surprised that an 8K JPEG is loading on a Nexus 5X at all, typically I would avoid anything over 4K, certainly on a mobile device. The max texture size is one component of the constraints, but at >250 MB per texture (for JPEG or PNG) you’ll hit VRAM limits quickly too.

Several devices, tested on WebGL compressed texture size limit stress test :

  • Nexus 5X: 4K
  • Macbook Pro, 2018: 8K
  • iPad Pro: 16K
  • iPhone 11 Pro: 16K
  • iPhone SE: 16K

It appears that 4K is the actual limit for compressed textures on the Nexus 5X, despite its reporting 16K to WebGL’s MAX_TEXTURE_SIZE parameter. iOS should be able to do more; are these textures exactly 8192x8192? You may need to enable the -mipmap option of basisu, or change texture filter options.

1 Like

Thanks a lot for your input, that’s very interesting. I had seen this stress test but didn’t think of checking it this time.
And since the JPG loading worked (but it really took forever, about 1min), I assumed the problem might be with basis, but your explanation makes sense.

Also, the reason I’m loading 8k is actually because I pack 48 x 2k light maps inside it. It’s divided in 4x4 tiles and each RGB channel has a different light map. So if I were to replace it with a 4k one, each lightmap would go from 2k to 1k and the difference becomes visible. But if that’s necessary, I can accept that, I’ll just load the 8k on desktop and its 4k version on mobile.

1 Like