Setting Invert Y when creating a RawCubeTexture in WebGpu crashes

When Creating a RawCubeTexture in WebGPU, if the invertY flag is set to true, we get the exception :

updateTexture: Can’t process the texture data because a GPUTexture was provided instead of an InternalTexture!

Setting the invertY flag to false or switching to WebGL doesn’t cause the issue.
This seems to be related to the following code in updateTexture function in webgpu.TextureManager.ts file

// Lines 1350–1374
if (invertY || premultiplyAlpha) {
if (WebGPUTextureHelper.IsInternalTexture(texture)) {
this.invertYPreMultiplyAlpha(gpuOrHdwTexture, ...);
} else {
throw "updateTexture: Can't process the texture data because a GPUTexture was provided instead of an InternalTexture!";
}
}

When called from WebGPU/Extensions/engine.rawTexture.pure.ts we send the gpuTextureWrapper.underlyingResource which is a GpuTexture, causing the throw in updateTexture.

Here is a playground (Babylon.js Playground) to repro the issue, changing to invertY in RawCubeTexture and the engine should trigger this issue.

Should work in WebGL with invertY set to true or false.

Should Fail in WebGpu with invertY set to true and pass with invertY set to false.

Cc @Evgeni_Popov (please be patient he is on well deserved vacation)

Thanks for the clear report and the diagnosis — you were right about the root cause.

On WebGPU, Y-flip is not done at upload time (there is no UNPACK_FLIP_Y_WEBGL ). Instead, after writing the raw bytes, the engine runs a GPU post-process ( invertYPreMultiplyAlpha ). That path needs a Babylon InternalTexture so it can build a hardware texture wrapper.

updateRawCubeTexture was passing the raw GPUTexture ( texture._hardwareTexture.underlyingResource ) into updateCubeTextures / updateTexture . With invertY: true , that hit:

Invalid texture! Babylons internal engine is still not fully compatible with native GPU objects

WebGL was fine because it can flip at unpack time. The WebGPU 2D raw path already passed InternalTexture ; only the cube path was wrong.

Fix: pass the InternalTexture into updateCubeTextures (and widen that helper to accept GPUTexture | InternalTexture , same as updateTexture ).

PR:

Thanks for the quick feedback, appreciated !