Skip to content

Creating a compressed texture prints unrelated unsupported texture compression warning #17759

@Xalcon

Description

@Xalcon
Description of the problem

I'm currently writing a texture loader for a proprietary texture container format that uses DXT1/DXT3/DXT5 for some of the supported encodings.

When I create the compressed texture and assign it to a material, everything works as expected - but I get the following warning in the console: (this is on chrome, but firefox shows the same behavior)

THREE.WebGLRenderer: WEBGL_compressed_texture_pvrtc extension not supported.
  | get | @ | three.module.js:15777
  | getCompressedTextureFormats | @ | three.module.js:20338
  | uploadTexture | @ | three.module.js:21548
  | setTexture2D | @ | three.module.js:21163
  | safeSetTexture2D | @ | three.module.js:22032
  | setValueT1 | @ | three.module.js:16776
  | WebGLUniforms.upload | @ | three.module.js:17235
  | setProgram | @ | three.module.js:25294
  | WebGLRenderer.renderBufferDirect | @ | three.module.js:24028
  | renderObject | @ | three.module.js:24789
  | renderObjects | @ | three.module.js:24759
  | WebGLRenderer.render | @ | three.module.js:24536
  | loop | @ | main.ts:46
  | (anonymous) | @ | main.ts:51
  | async function (async) |   |  
  | (anonymous) | @ | main.ts:25
  | load (async) |   |  
  | (anonymous) | @ | main.ts:6

And indeed, my browser does not support the pvrtc extension:

EXT_color_buffer_float
EXT_disjoint_timer_query_webgl2
EXT_float_blend
EXT_texture_filter_anisotropic
KHR_parallel_shader_compile
OES_texture_float_linear
WEBGL_compressed_texture_s3tc
WEBGL_compressed_texture_s3tc_srgb
WEBGL_debug_renderer_info
WEBGL_debug_shaders
WEBGL_lose_context

But the format I'm using is completly unrelated to pvrtc as I'm using the RGB_S3TC_DXT1_Format.

I'm able to reproduce the same issue in all of the public compressed texture examples, i.e.
https://threejs.org/examples/webgl_loader_texture_dds.html

I've looked into the code a bit. The uploadTexture function calls getCompressedTextureFormats() to check if the given compression format is supported. The getCompressedTextureFormats function builds an array of supported compression formats by testing each known compression extension until one is found - which in turn prints a warning about not supporting the given extension.

if ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) {

if ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) ||
extensions.get( 'WEBGL_compressed_texture_s3tc' ) ||
extensions.get( 'WEBGL_compressed_texture_etc1' ) ||
extensions.get( 'WEBGL_compressed_texture_astc' ) ) {
var formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS );
for ( var i = 0; i < formats.length; i ++ ) {
compressedTextureFormats.push( formats[ i ] );
}
}

if ( extension === null ) {
console.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );
}

I'm not sure what the most elegant solution to this is, but the WebGLExtensions getter in its current form should not be used to determine IF an extension is supported since it will always print a warning if the given extension is not supported - even if you have a fallback.

Three.js version
  • Dev
  • r109
  • ...
Browser
  • All of them
  • Chrome 77.0.3865.120 64 Bit
  • Firefox 69.0.3 (64-bit)
  • Internet Explorer (unable to test)
OS
  • All of them
  • Windows 10 Version 1903 Build 18362.418
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions