Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/core/renderers/webgl/WebGlCtxTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion src/core/textures/ImageTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ export class ImageTexture extends Texture {
override async getTextureSource(): Promise<TextureData> {
// 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' ||
Expand Down
Loading