Ktx2 textures load error

Hello,
I am using ktx2(ETC1S, basisu) textures in a GLB file for my app.
It is working fine when I load a scene with a small amount of textures. But when I try to load a scene with many textures, the loader fails to load textures frequently. The error occurs once in a few times for exactly the same GLB file. I don’t know what makes difference between each trial. When I replace ktx2 textures with png, no error happens.

I got this error message with my desktop app. You can see similar errors on Sandbox/Playground:
BJS - [18:40:33]: Failed to load KTX2 texture data: Error: KTX2 container - could not transcode the data. TypeError: Cannot perform Construct on a detached ArrayBuffer babylon.max.js:144778
BJS - [18:40:33]: Unable to load from C:\xxx\error_texload.glb: /textures/91: TextureLoader failed to load data - Fallback texture was used babylon.max.js:144788
Error: /textures/91: TextureLoader failed to load data - Fallback texture was used
at eval (c:\xxx\node_modules\babylonjs-loaders\babylonjs.loaders.min.js:1:36427)
at onInternalError (c:\xxx\node_modules\babylonjs\babylon.max.js:42868:1)
at eval (c:\xxx\node_modules\babylonjs\babylon.max.js:42882:1)
at eval (c:\xxx\node_modules\babylonjs\babylon.max.js:90353:1)

It happens both in my desktop app on Electron and Sandbox/Playground running on Chrome. The OS is Windows, the GPU is GeForce GTX 980Ti 6GB. It also happens on GTX1070 8GB. I use the version 4.2.0 for my desktop app, but it occurs on 5.0.0 alpha.

https://playground.babylonjs.com/#CF7E5Q

Any ideas how to fix the problem?

Welcome aboard!

Currently having a look at this.

I have digged a bit and ended up creating an issue on Khronos side as I could not find a problem on our implementation, waiting for their input:

1 Like

Thank you for your help, @Evgeni_Popov!
I hope it will fix the problem.

See:

1 Like

Thank you @Evgeni_Popov , I was also having this issue for ktx2 and was following this on github, I will try it as soon its merged, :bowing_man:

1 Like