Skip to content

Commit a539d00

Browse files
takahiroxmrdoob
authored andcommitted
Prevent the confusing warnings of extensions from paramThreeToGL of WebGLRenderer (mrdoob#9773)
1 parent c75213d commit a539d00

File tree

1 file changed

+39
-25
lines changed

1 file changed

+39
-25
lines changed

src/renderers/WebGLRenderer.js

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,11 +2735,11 @@ function WebGLRenderer( parameters ) {
27352735
if ( p === UnsignedIntType ) return _gl.UNSIGNED_INT;
27362736
if ( p === FloatType ) return _gl.FLOAT;
27372737

2738-
extension = extensions.get( 'OES_texture_half_float' );
2738+
if ( p === HalfFloatType ) {
27392739

2740-
if ( extension !== null ) {
2740+
extension = extensions.get( 'OES_texture_half_float' );
27412741

2742-
if ( p === HalfFloatType ) return extension.HALF_FLOAT_OES;
2742+
if ( extension !== null ) return extension.HALF_FLOAT_OES;
27432743

27442744
}
27452745

@@ -2768,50 +2768,64 @@ function WebGLRenderer( parameters ) {
27682768
if ( p === OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR;
27692769
if ( p === SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE;
27702770

2771-
extension = extensions.get( 'WEBGL_compressed_texture_s3tc' );
2771+
if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format ||
2772+
p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
27722773

2773-
if ( extension !== null ) {
2774+
extension = extensions.get( 'WEBGL_compressed_texture_s3tc' );
27742775

2775-
if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;
2776-
if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;
2777-
if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;
2778-
if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;
2776+
if ( extension !== null ) {
2777+
2778+
if ( p === RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;
2779+
if ( p === RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;
2780+
if ( p === RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;
2781+
if ( p === RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;
2782+
2783+
}
27792784

27802785
}
27812786

2782-
extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );
2787+
if ( p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format ||
2788+
p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format ) {
27832789

2784-
if ( extension !== null ) {
2790+
extension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );
27852791

2786-
if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
2787-
if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
2788-
if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
2789-
if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
2792+
if ( extension !== null ) {
2793+
2794+
if ( p === RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
2795+
if ( p === RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
2796+
if ( p === RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
2797+
if ( p === RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
2798+
2799+
}
27902800

27912801
}
27922802

2793-
extension = extensions.get( 'WEBGL_compressed_texture_etc1' );
2803+
if ( p === RGB_ETC1_Format ) {
27942804

2795-
if ( extension !== null ) {
2805+
extension = extensions.get( 'WEBGL_compressed_texture_etc1' );
27962806

2797-
if ( p === RGB_ETC1_Format ) return extension.COMPRESSED_RGB_ETC1_WEBGL;
2807+
if ( extension !== null ) return extension.COMPRESSED_RGB_ETC1_WEBGL;
27982808

27992809
}
28002810

2801-
extension = extensions.get( 'EXT_blend_minmax' );
2811+
if ( p === MinEquation || p === MaxEquation ) {
2812+
2813+
extension = extensions.get( 'EXT_blend_minmax' );
28022814

2803-
if ( extension !== null ) {
2815+
if ( extension !== null ) {
28042816

2805-
if ( p === MinEquation ) return extension.MIN_EXT;
2806-
if ( p === MaxEquation ) return extension.MAX_EXT;
2817+
if ( p === MinEquation ) return extension.MIN_EXT;
2818+
if ( p === MaxEquation ) return extension.MAX_EXT;
2819+
2820+
}
28072821

28082822
}
28092823

2810-
extension = extensions.get( 'WEBGL_depth_texture' );
2824+
if ( p === UnsignedInt248Type ) {
28112825

2812-
if ( extension !== null ){
2826+
extension = extensions.get( 'WEBGL_depth_texture' );
28132827

2814-
if ( p === UnsignedInt248Type ) return extension.UNSIGNED_INT_24_8_WEBGL;
2828+
if ( extension !== null ) return extension.UNSIGNED_INT_24_8_WEBGL;
28152829

28162830
}
28172831

0 commit comments

Comments
 (0)