Skip to content

Commit b623c59

Browse files
authored
WebGL: Fix wrong target when allocating GPU memory (#17489)
See https://forum.babylonjs.com/t/cubemap-possibly-ignored-in-pr17151/61495
1 parent 2bf89ef commit b623c59

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/dev/core/src/Engines/thinEngine.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3418,7 +3418,13 @@ export class ThinEngine extends AbstractEngine {
34183418
if (texture.generateMipMaps) {
34193419
const webGLHardwareTexture = texture._hardwareTexture as WebGLHardwareTexture;
34203420
if (!webGLHardwareTexture.memoryAllocated) {
3421-
gl.texStorage2D(gl.TEXTURE_2D, Math.floor(Math.log2(Math.max(width, height))) + 1, internalFormat, texture.width, texture.height);
3421+
gl.texStorage2D(
3422+
texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D,
3423+
Math.floor(Math.log2(Math.max(width, height))) + 1,
3424+
internalFormat,
3425+
texture.width,
3426+
texture.height
3427+
);
34223428
webGLHardwareTexture.memoryAllocated = true;
34233429
}
34243430
this._gl.compressedTexSubImage2D(target, lod, 0, 0, width, height, internalFormat, data);

0 commit comments

Comments
 (0)