KTX Textures and WebGPU

We are using KTX textures on multiple platforms. When using WebGL we can call engine.setTextureFormatToUse to determine the format [astc, dxt, pvrtc, etc2]. Once we make the switch to using WebGPU on Chrome Canary, none of these textures are available:

After a quick look through, it looks like this is derived in webgpuEngine from _deviceEnabledExtensions which is never getting assigned? In my desktop browser, I’m expecting to use .dxt textures, which are based off of the s3tc: Babylon.js/webgpuEngine.ts at 1cfd964ab5a107df94fcb01fcaf9ce9bdf89559d · BabylonJS/Babylon.js · GitHub

Should KTX texture work with WebGPU in the same way they worked with WebGL?

1 Like

This PR will add support for ASTC and ETC2 if supported by your device and reported by the browser:

Note that dxt support is currently handled, engine.texturesSupported returns ['-dxt.ktx'] for me in the Playground when in WebGPU mode.

Note that if you don’t use the Playground you must create the engine by asking support for the extensions you want to use. For eg, the Playground is creating the engine like this:

var engine = new WebGPUEngine(canvas, {
    deviceDescriptor: {
        requiredFeatures: [
await engine.initAsync();

You will get in engine.supportedExtensions the extensions that are supported by the browser and enabled among the ones you asked.


I missed adding the options. It now works like a charm. Thanks!