From 6fb90c355edde1d612df7c35e5fb547bd2b5b4bf Mon Sep 17 00:00:00 2001 From: Yun Hsiao Wu Date: Thu, 23 Sep 2021 18:34:44 +0800 Subject: [PATCH] remove resizable flag (#9373) --- cocos/core/gfx/base/define.ts | 3 +- cocos/core/gfx/webgl/webgl-commands.ts | 115 ++++++++++------------- cocos/core/gfx/webgl2/webgl2-commands.ts | 88 +++++------------ cocos/core/gfx/webgl2/webgl2-texture.ts | 4 - 4 files changed, 76 insertions(+), 134 deletions(-) diff --git a/cocos/core/gfx/base/define.ts b/cocos/core/gfx/base/define.ts index 29edba2d02..c188b60772 100644 --- a/cocos/core/gfx/base/define.ts +++ b/cocos/core/gfx/base/define.ts @@ -409,8 +409,7 @@ export enum TextureUsageBit { export enum TextureFlagBit { NONE = 0, GEN_MIPMAP = 0x1, // Generate mipmaps using bilinear filter - RESIZABLE = 0x2, // Make the texture resizable, should be avoided whenever possible - GENERAL_LAYOUT = 0x4, // For inout framebuffer attachments + GENERAL_LAYOUT = 0x2, // For inout framebuffer attachments } export enum SampleCount { diff --git a/cocos/core/gfx/webgl/webgl-commands.ts b/cocos/core/gfx/webgl/webgl-commands.ts index 94b5546252..4c1dcc13c1 100644 --- a/cocos/core/gfx/webgl/webgl-commands.ts +++ b/cocos/core/gfx/webgl/webgl-commands.ts @@ -789,10 +789,8 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb if (!device.extensions.WEBGL_depth_texture && FormatInfos[gpuTexture.format].hasDepth) { gpuTexture.glInternalFmt = GFXFormatToWebGLInternalFormat(gpuTexture.format, gl); - const glRenderbuffer = gl.createRenderbuffer(); - if (glRenderbuffer && gpuTexture.size > 0) { - gpuTexture.glRenderbuffer = glRenderbuffer; - + gpuTexture.glRenderbuffer = gl.createRenderbuffer(); + if (gpuTexture.size > 0) { if (device.stateCache.glRenderbuffer !== gpuTexture.glRenderbuffer) { gl.bindRenderbuffer(gl.RENDERBUFFER, gpuTexture.glRenderbuffer); device.stateCache.glRenderbuffer = gpuTexture.glRenderbuffer; @@ -800,9 +798,8 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb gl.renderbufferStorage(gl.RENDERBUFFER, gpuTexture.glInternalFmt, w, h); } } else { - const glTexture = gl.createTexture(); - if (glTexture && gpuTexture.size > 0) { - gpuTexture.glTexture = glTexture; + gpuTexture.glTexture = gl.createTexture(); + if (gpuTexture.size > 0) { const glTexUnit = device.stateCache.glTexUnits[device.stateCache.texUnit]; if (glTexUnit.glTexture !== gpuTexture.glTexture) { @@ -810,13 +807,7 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let i = 0; i < gpuTexture.mipLevel; ++i) { const imgSize = FormatSize(gpuTexture.format, w, h, 1); const view: Uint8Array = new Uint8Array(imgSize); @@ -825,10 +816,11 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb h = Math.max(1, h >> 1); } } else { - // init 2 x 2 texture - const imgSize = FormatSize(gpuTexture.format, 2, 2, 1); - const view: Uint8Array = new Uint8Array(imgSize); - gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gpuTexture.glInternalFmt, 2, 2, 0, view); + for (let i = 0; i < gpuTexture.mipLevel; ++i) { + gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); + w = Math.max(1, w >> 1); + h = Math.max(1, h >> 1); + } } if (gpuTexture.isPowerOf2) { @@ -845,8 +837,6 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb gl.texParameteri(gpuTexture.glTarget, gl.TEXTURE_WRAP_T, gpuTexture.glWrapT); gl.texParameteri(gpuTexture.glTarget, gl.TEXTURE_MIN_FILTER, gpuTexture.glMinFilter); gl.texParameteri(gpuTexture.glTarget, gl.TEXTURE_MAG_FILTER, gpuTexture.glMagFilter); - } else { - gl.deleteTexture(glTexture); } } @@ -860,9 +850,8 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb errorID(9100, maxSize, device.capabilities.maxTextureSize); } - const glTexture = gl.createTexture(); - if (glTexture && gpuTexture.size > 0) { - gpuTexture.glTexture = glTexture; + gpuTexture.glTexture = gl.createTexture(); + if (gpuTexture.size > 0) { const glTexUnit = device.stateCache.glTexUnits[device.stateCache.texUnit]; if (glTexUnit.glTexture !== gpuTexture.glTexture) { @@ -870,18 +859,7 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let f = 0; f < 6; ++f) { - w = gpuTexture.width; - h = gpuTexture.height; - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture.glInternalFmt, w, h, 0, - gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } - } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let f = 0; f < 6; ++f) { w = gpuTexture.width; h = gpuTexture.height; @@ -895,9 +873,14 @@ export function WebGLCmdFuncCreateTexture (device: WebGLDevice, gpuTexture: IWeb } } else { for (let f = 0; f < 6; ++f) { - const imgSize = FormatSize(gpuTexture.format, 2, 2, 1); - const view: Uint8Array = new Uint8Array(imgSize); - gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, 0, gpuTexture.glInternalFmt, 2, 2, 0, view); + w = gpuTexture.width; + h = gpuTexture.height; + for (let i = 0; i < gpuTexture.mipLevel; ++i) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture.glInternalFmt, w, h, 0, + gpuTexture.glFormat, gpuTexture.glType, null); + w = Math.max(1, w >> 1); + h = Math.max(1, h >> 1); + } } } @@ -940,6 +923,8 @@ export function WebGLCmdFuncDestroyTexture (device: WebGLDevice, gpuTexture: IWe } export function WebGLCmdFuncResizeTexture (device: WebGLDevice, gpuTexture: IWebGLGPUTexture) { + if (!gpuTexture.size) return; + const { gl } = device; let w = gpuTexture.width; @@ -968,13 +953,7 @@ export function WebGLCmdFuncResizeTexture (device: WebGLDevice, gpuTexture: IWeb glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let i = 0; i < gpuTexture.mipLevel; ++i) { const imgSize = FormatSize(gpuTexture.format, w, h, 1); const view: Uint8Array = new Uint8Array(imgSize); @@ -982,6 +961,12 @@ export function WebGLCmdFuncResizeTexture (device: WebGLDevice, gpuTexture: IWeb w = Math.max(1, w >> 1); h = Math.max(1, h >> 1); } + } else { + for (let i = 0; i < gpuTexture.mipLevel; ++i) { + gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); + w = Math.max(1, w >> 1); + h = Math.max(1, h >> 1); + } } } break; @@ -1001,18 +986,7 @@ export function WebGLCmdFuncResizeTexture (device: WebGLDevice, gpuTexture: IWeb glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let f = 0; f < 6; ++f) { - w = gpuTexture.width; - h = gpuTexture.height; - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture.glInternalFmt, w, h, - 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } - } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let f = 0; f < 6; ++f) { w = gpuTexture.width; h = gpuTexture.height; @@ -1024,6 +998,17 @@ export function WebGLCmdFuncResizeTexture (device: WebGLDevice, gpuTexture: IWeb h = Math.max(1, h >> 1); } } + } else { + for (let f = 0; f < 6; ++f) { + w = gpuTexture.width; + h = gpuTexture.height; + for (let i = 0; i < gpuTexture.mipLevel; ++i) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture.glInternalFmt, w, h, + 0, gpuTexture.glFormat, gpuTexture.glType, null); + w = Math.max(1, w >> 1); + h = Math.max(1, h >> 1); + } + } } break; } @@ -2668,13 +2653,13 @@ export function WebGLCmdFuncCopyBuffersToTexture ( gl.texSubImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, gpuTexture.glType, pixels); - } else if (gpuTexture.glInternalFmt === WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL || device.extensions.noCompressedTexSubImage2D) { - gl.compressedTexImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, - gpuTexture.glInternalFmt, w, h, 0, pixels); - } else { + } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL && !device.extensions.noCompressedTexSubImage2D) { gl.compressedTexSubImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, pixels); + } else { // WEBGL_compressed_texture_etc1 + gl.compressedTexImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, + gpuTexture.glInternalFmt, w, h, 0, pixels); } } @@ -2694,13 +2679,13 @@ export function WebGLCmdFuncCopyBuffersToTexture ( gl.texSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, gpuTexture.glType, pixels); - } else if (gpuTexture.glInternalFmt === WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL || device.extensions.noCompressedTexSubImage2D) { - gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, - gpuTexture.glInternalFmt, w, h, 0, pixels); - } else { + } else if (gpuTexture.glInternalFmt !== WebGLEXT.COMPRESSED_RGB_ETC1_WEBGL && !device.extensions.noCompressedTexSubImage2D) { gl.compressedTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, pixels); + } else { // WEBGL_compressed_texture_etc1 + gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, + gpuTexture.glInternalFmt, w, h, 0, pixels); } } } diff --git a/cocos/core/gfx/webgl2/webgl2-commands.ts b/cocos/core/gfx/webgl2/webgl2-commands.ts index efc29efcf0..4b886608c9 100644 --- a/cocos/core/gfx/webgl2/webgl2-commands.ts +++ b/cocos/core/gfx/webgl2/webgl2-commands.ts @@ -1022,9 +1022,8 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW } if (gpuTexture.samples === SampleCount.ONE) { - const glTexture = gl.createTexture(); - if (glTexture && gpuTexture.size > 0) { - gpuTexture.glTexture = glTexture; + gpuTexture.glTexture = gl.createTexture(); + if (gpuTexture.size > 0) { const glTexUnit = device.stateCache.glTexUnits[device.stateCache.texUnit]; if (glTexUnit.glTexture !== gpuTexture.glTexture) { @@ -1032,12 +1031,7 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW glTexUnit.glTexture = gpuTexture.glTexture; } - if (gpuTexture.glInternalFmt === WebGL2EXT.COMPRESSED_RGB_ETC1_WEBGL) { - // init 2 x 2 texture - const imgSize = FormatSize(gpuTexture.format, 2, 2, 1); - const view: Uint8Array = new Uint8Array(imgSize); - gl.compressedTexImage2D(gl.TEXTURE_2D, 0, gpuTexture.glInternalFmt, 2, 2, 0, view); - } else if (FormatInfos[gpuTexture.format].isCompressed) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let i = 0; i < gpuTexture.mipLevel; ++i) { const imgSize = FormatSize(gpuTexture.format, w, h, 1); const view: Uint8Array = new Uint8Array(imgSize); @@ -1045,22 +1039,13 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW w = Math.max(1, w >> 1); h = Math.max(1, h >> 1); } - } else if (!(gpuTexture.flags & TextureFlagBit.RESIZABLE)) { - gl.texStorage2D(gl.TEXTURE_2D, gpuTexture.mipLevel, gpuTexture.glInternalFmt, w, h); } else { - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } + gl.texStorage2D(gl.TEXTURE_2D, gpuTexture.mipLevel, gpuTexture.glInternalFmt, w, h); } - } else { - gl.deleteTexture(glTexture); } } else { - const glRenderbuffer = gl.createRenderbuffer(); - if (glRenderbuffer && gpuTexture.size > 0) { - gpuTexture.glRenderbuffer = glRenderbuffer; + gpuTexture.glRenderbuffer = gl.createRenderbuffer(); + if (gpuTexture.size > 0) { if (device.stateCache.glRenderbuffer !== gpuTexture.glRenderbuffer) { gl.bindRenderbuffer(gl.RENDERBUFFER, gpuTexture.glRenderbuffer); device.stateCache.glRenderbuffer = gpuTexture.glRenderbuffer; @@ -1080,9 +1065,8 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW errorID(9100, maxSize, device.capabilities.maxTextureSize); } - const glTexture = gl.createTexture(); - if (glTexture && gpuTexture.size > 0) { - gpuTexture.glTexture = glTexture; + gpuTexture.glTexture = gl.createTexture(); + if (gpuTexture.size > 0) { const glTexUnit = device.stateCache.glTexUnits[device.stateCache.texUnit]; if (glTexUnit.glTexture !== gpuTexture.glTexture) { @@ -1090,13 +1074,7 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW glTexUnit.glTexture = gpuTexture.glTexture; } - if (gpuTexture.glInternalFmt === WebGL2EXT.COMPRESSED_RGB_ETC1_WEBGL) { - for (let f = 0; f < 6; ++f) { - const imgSize = FormatSize(gpuTexture.format, 2, 2, 1); - const view: Uint8Array = new Uint8Array(imgSize); - gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, 0, gpuTexture.glInternalFmt, 2, 2, 0, view); - } - } else if (FormatInfos[gpuTexture.format].isCompressed) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let i = 0; i < gpuTexture.mipLevel; ++i) { const imgSize = FormatSize(gpuTexture.format, w, h, 1); const view: Uint8Array = new Uint8Array(imgSize); @@ -1106,17 +1084,8 @@ export function WebGL2CmdFuncCreateTexture (device: WebGL2Device, gpuTexture: IW w = Math.max(1, w >> 1); h = Math.max(1, h >> 1); } - } else if (!(gpuTexture.flags & TextureFlagBit.RESIZABLE)) { - gl.texStorage2D(gl.TEXTURE_CUBE_MAP, gpuTexture.mipLevel, gpuTexture.glInternalFmt, w, h); } else { - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - for (let f = 0; f < 6; ++f) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, - gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); - } - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } + gl.texStorage2D(gl.TEXTURE_CUBE_MAP, gpuTexture.mipLevel, gpuTexture.glInternalFmt, w, h); } } break; @@ -1142,6 +1111,8 @@ export function WebGL2CmdFuncDestroyTexture (device: WebGL2Device, gpuTexture: I } export function WebGL2CmdFuncResizeTexture (device: WebGL2Device, gpuTexture: IWebGL2GPUTexture) { + if (!gpuTexture.size) return; + const { gl } = device; let w = gpuTexture.width; @@ -1164,13 +1135,7 @@ export function WebGL2CmdFuncResizeTexture (device: WebGL2Device, gpuTexture: IW glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_2D, i, gpuTexture.glInternalFmt, w, h, 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } else if (gpuTexture.glInternalFmt !== WebGL2EXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let i = 0; i < gpuTexture.mipLevel; ++i) { const imgSize = FormatSize(gpuTexture.format, w, h, 1); const view: Uint8Array = new Uint8Array(imgSize); @@ -1178,8 +1143,12 @@ export function WebGL2CmdFuncResizeTexture (device: WebGL2Device, gpuTexture: IW w = Math.max(1, w >> 1); h = Math.max(1, h >> 1); } + } else { + // immutable by default + WebGL2CmdFuncDestroyTexture(device, gpuTexture); + WebGL2CmdFuncCreateTexture(device, gpuTexture); } - } else if (gpuTexture.glRenderbuffer && gpuTexture.size > 0) { + } else if (gpuTexture.glRenderbuffer) { if (device.stateCache.glRenderbuffer !== gpuTexture.glRenderbuffer) { gl.bindRenderbuffer(gl.RENDERBUFFER, gpuTexture.glRenderbuffer); device.stateCache.glRenderbuffer = gpuTexture.glRenderbuffer; @@ -1206,18 +1175,7 @@ export function WebGL2CmdFuncResizeTexture (device: WebGL2Device, gpuTexture: IW glTexUnit.glTexture = gpuTexture.glTexture; } - if (!FormatInfos[gpuTexture.format].isCompressed) { - for (let f = 0; f < 6; ++f) { - w = gpuTexture.width; - h = gpuTexture.height; - for (let i = 0; i < gpuTexture.mipLevel; ++i) { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, i, gpuTexture.glInternalFmt, w, h, - 0, gpuTexture.glFormat, gpuTexture.glType, null); - w = Math.max(1, w >> 1); - h = Math.max(1, h >> 1); - } - } - } else if (gpuTexture.glInternalFmt !== WebGL2EXT.COMPRESSED_RGB_ETC1_WEBGL) { + if (FormatInfos[gpuTexture.format].isCompressed) { for (let f = 0; f < 6; ++f) { w = gpuTexture.width; h = gpuTexture.height; @@ -1229,6 +1187,10 @@ export function WebGL2CmdFuncResizeTexture (device: WebGL2Device, gpuTexture: IW h = Math.max(1, h >> 1); } } + } else { + // immutable by default + WebGL2CmdFuncDestroyTexture(device, gpuTexture); + WebGL2CmdFuncCreateTexture(device, gpuTexture); } break; } @@ -2631,7 +2593,7 @@ export function WebGL2CmdFuncCopyBuffersToTexture ( gl.compressedTexSubImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, pixels); - } else { + } else { // WEBGL_compressed_texture_etc1 gl.compressedTexImage2D(gl.TEXTURE_2D, region.texSubres.mipLevel, gpuTexture.glInternalFmt, w, h, 0, pixels); } @@ -2656,7 +2618,7 @@ export function WebGL2CmdFuncCopyBuffersToTexture ( gl.compressedTexSubImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, region.texOffset.x, region.texOffset.y, w, h, gpuTexture.glFormat, pixels); - } else { + } else { // WEBGL_compressed_texture_etc1 gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + f, region.texSubres.mipLevel, gpuTexture.glInternalFmt, w, h, 0, pixels); } diff --git a/cocos/core/gfx/webgl2/webgl2-texture.ts b/cocos/core/gfx/webgl2/webgl2-texture.ts index ec50d5540b..3d7b2d361b 100644 --- a/cocos/core/gfx/webgl2/webgl2-texture.ts +++ b/cocos/core/gfx/webgl2/webgl2-texture.ts @@ -100,10 +100,6 @@ export class WebGL2Texture extends Texture { } public resize (width: number, height: number) { - if (!(this._flags & TextureFlagBit.RESIZABLE)) { - console.error('Cannot resize immutable textures'); - } - const oldSize = this._size; this._width = width; this._height = height;