|
@@ -660,6 +660,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
|
|
|
|
+ } else if ( texture.type === UnsignedInt248Type ) {
|
|
|
+
|
|
|
+ glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
|
|
@@ -676,6 +680,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // validation checks for WebGL 1
|
|
|
+
|
|
|
if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
|
|
|
|
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
@@ -692,10 +698,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- // Depth stencil textures need the DEPTH_STENCIL internal format
|
|
|
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
|
- if ( texture.format === DepthStencilFormat ) {
|
|
|
+ if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
|
|
|
|
|
|
+ // Depth stencil textures need the DEPTH_STENCIL internal format
|
|
|
+ // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
|
|
|
glInternalFormat = _gl.DEPTH_STENCIL;
|
|
|
|
|
|
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
|
|
@@ -712,6 +718,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //
|
|
|
+
|
|
|
state.texImage2D( _gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null );
|
|
|
|
|
|
} else if ( texture.isDataTexture ) {
|