Depth+Stencil Attachment fails in WebGL2
See original GitHub issueDescription of the problem
Using a DepthTexture
attachment with DepthStencilFormat
and UnsignedInt248Type
fails in WebGL2. The issue can be reproduced by uncommenting the lines 60
& 61
in the following example: https://jsfiddle.net/07yvba98/
Chrome reports the following error on my system:
VM101 three.module.js:21136 WebGL: INVALID_VALUE: texImage2D: invalid internalformat
[.WebGL-0000015DAF32A740] GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete.
[.WebGL-0000015DAF32A740] GL_INVALID_FRAMEBUFFER_OPERATION: Draw framebuffer is incomplete
Firefox spits out a bit more information:
Error: WebGL warning: texImage: Invalid internalformat: 0x84f9
Error: WebGL warning: clear: Framebuffer not complete. (status: 0x8cd6) <enum 0x8d20>: Attachment has no width or height. three.module.js:23752:7
Error: WebGL warning: clear: Framebuffer must be complete. three.module.js:23752:7
Error: WebGL warning: drawElementsInstanced: Framebuffer not complete. (status: 0x8cd6) <enum 0x8d20>: Attachment has no width or height. three.module.js:16273:6
Error: WebGL warning: drawElementsInstanced: Framebuffer must be complete.
MS Edge does not report any errors and works as expected. (See this comment)
This document states that the internalFormat 0x84f9
represents DEPTH_STENCIL_OES
while 0x88F0
represents the correct sized format DEPTH24_STENCIL8_OES
which should be used in a WebGL2 context.
I’m not sure if this is a bug in WebGLTextures or a browser/ANGLE issue.
Related: #16769
Three.js version
- Dev
- r114
Browser
- All of them
- Chrome 80.0.3987.132
- Firefox 74.0
- Microsoft Edge 44.18362.449.0 (18.18363)
OS
- All of them
- Windows 10
- macOS
- Linux
- Android
- iOS
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
WebGL2 FBO depth attachment values - Stack Overflow
I'm simply trying to render the depth values of my scene using WebGL2 like so: //Texture depthTexture = gl.createTexture(); gl.
Read more >Web APIs | MDN - MDN Web Docs - Mozilla
DEPTH_STENCIL_ATTACHMENT : Texture attachment for both, the depth and stencil buffer. When using a WebGL 2 context, the following values are ...
Read more >WebGL2 Cross Platform Issues
In WebGL1 another often missing extension is WEBGL_draw_buffers which is the ability to attach more than 1 color attachment to a framebuffer is...
Read more >WebGL 2.0 Specification - Khronos Registry
Different from WebGL 1.0, the depth , stencil , and antialias attributes in WebGL 2.0 must be obeyed by the WebGL implementation.
Read more >MSAA performance drop with depth-stencil blit?
I've been working on adding MSAA for WebGL2 to CesiumJS and a few of our framebuffers have depth-stencil attachments that get blitted when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll have a go on this one as soon as #18876 is resolved. There is already a PR that slightly refactors
WebGLTexture
to fix the issue. When it’s merged, I’ll try to see what bits are still necessary for depth+stencil.Any chances to make a pure WebGL example and verify this (see https://github.com/mrdoob/three.js/issues/18876#issuecomment-598666385)?