diff --git a/src/core/renderers/webgl/WebGlCtxTexture.ts b/src/core/renderers/webgl/WebGlCtxTexture.ts index 65d8b02..3f530d1 100644 --- a/src/core/renderers/webgl/WebGlCtxTexture.ts +++ b/src/core/renderers/webgl/WebGlCtxTexture.ts @@ -6,7 +6,10 @@ import { uploadCompressedTexture } from '../../lib/textureCompression.js'; import { CoreContextTexture } from '../CoreContextTexture.js'; import { isHTMLImageElement } from './internal/RendererUtils.js'; import type { Bound } from '../../lib/utils.js'; -import { isProductionEnvironment } from '../../../utils.js'; +import { + ENABLE_COMPRESSED_TEXTURES, + isProductionEnvironment, +} from '../../../utils.js'; const TRANSPARENT_TEXTURE_DATA = new Uint8Array([0, 0, 0, 0]); @@ -223,7 +226,11 @@ export class WebGlCtxTexture extends CoreContextTexture { TRANSPARENT_TEXTURE_DATA, ); this.setTextureMemUse(TRANSPARENT_TEXTURE_DATA.byteLength); - } else if ('mipmaps' in tdata && tdata.mipmaps) { + } else if ( + ENABLE_COMPRESSED_TEXTURES && + 'mipmaps' in tdata && + tdata.mipmaps + ) { const { mipmaps, type, blockInfo } = tdata; uploadCompressedTexture[type]!(glw, this._nativeCtxTexture, tdata); diff --git a/src/core/textures/ImageTexture.ts b/src/core/textures/ImageTexture.ts index 9caba10..98781b1 100644 --- a/src/core/textures/ImageTexture.ts +++ b/src/core/textures/ImageTexture.ts @@ -276,7 +276,10 @@ export class ImageTexture extends Texture { override async getTextureSource(): Promise { // Compressed textures are not supported by the Canvas2D renderer. // Fail fast here before incurring a network fetch or binary decode. - if (this.txManager.renderer?.mode === 'canvas') { + if ( + ENABLE_COMPRESSED_TEXTURES && + this.txManager.renderer?.mode === 'canvas' + ) { const { src, type } = this.props; if ( type === 'compressed' ||