RESOLVED CONFIGURATION CHANGED 223734
Depth test affects WebGL rendering when context has depth == false, stencil == true
https://bugs.webkit.org/show_bug.cgi?id=223734
Summary Depth test affects WebGL rendering when context has depth == false, stencil =...
Kimmo Kinnunen
Reported 2021-03-25 01:19:32 PDT
Depth test affects WebGL rendering when context has depth == false, stencil == true Happens when stencil is enabled and stencil is stencil+depth.
Attachments
Patch (25.77 KB, patch)
2021-03-25 03:45 PDT, Kimmo Kinnunen
no flags
Patch for landing (25.67 KB, patch)
2021-08-23 04:14 PDT, Kimmo Kinnunen
no flags
Kimmo Kinnunen
Comment 1 2021-03-25 03:45:46 PDT
Kyle Piddington
Comment 2 2021-03-25 10:59:57 PDT
Comment on attachment 424231 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424231&action=review Overall, this should certainly work to keep depth and stencil correctly set. > Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:7694 > + enableOrDisable(GraphicsContextGL::DEPTH_TEST, enable); The logic here is sound. I also believe that you could get a similar result in Metal_Angle by attaching a d24s8 attachment to just STENCIL_ATTACHMENT instead of always DEPTH_STENCIL_ATTACHMENT when available. See void GraphicsContextGLOpenGL::attachDepthAndStencilBufferIfNeeded(GLuint internalDepthStencilFormat, int width, int height) in GraphicsContextANGLE
Kenneth Russell
Comment 3 2021-03-29 15:43:58 PDT
Great work on this Kimmo - would be great if you could propose the conformance test changes as a pull request against https://github.com/KhronosGroup/WebGL .
Kimmo Kinnunen
Comment 4 2021-03-30 03:45:17 PDT
(In reply to Kyle Piddington from comment #2) > The logic here is sound. I also believe that you could get a similar result > in Metal_Angle by attaching a d24s8 attachment to just STENCIL_ATTACHMENT > instead of always DEPTH_STENCIL_ATTACHMENT when available. See void > GraphicsContextGLOpenGL::attachDepthAndStencilBufferIfNeeded(GLuint > internalDepthStencilFormat, int width, int height) in GraphicsContextANGLE Kyle, thanks for the review. I'm hesitant to do that cleanup yet since there's this comment // WebGL 1.0's rules state that combined depth/stencil renderbuffers // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point. I don't know enough of the spec / implementation to say if storing the stencil depth buffer in stencil for the case stencil=true, depth=false would satisfy the getter behavior we currently have or should have.
Kenneth Russell
Comment 5 2021-03-30 10:58:04 PDT
(In reply to Kimmo Kinnunen from comment #4) > (In reply to Kyle Piddington from comment #2) > > The logic here is sound. I also believe that you could get a similar result > > in Metal_Angle by attaching a d24s8 attachment to just STENCIL_ATTACHMENT > > instead of always DEPTH_STENCIL_ATTACHMENT when available. See void > > GraphicsContextGLOpenGL::attachDepthAndStencilBufferIfNeeded(GLuint > > internalDepthStencilFormat, int width, int height) in GraphicsContextANGLE > > Kyle, thanks for the review. > I'm hesitant to do that cleanup yet since there's this comment > // WebGL 1.0's rules state that combined depth/stencil renderbuffers > // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT > point. > > I don't know enough of the spec / implementation to say if storing the > stencil depth buffer in stencil for the case stencil=true, depth=false would > satisfy the getter behavior we currently have or should have. Hopefully the WebGL 1.0 and 2.0 conformance tests should cover this behavior well. The bookkeeping for WebGL 1.0's synthetic DEPTH_STENCIL_ATTACHMENT can / should be managed entirely at the WebGLRenderingContextBase / WebGL2RenderingContext level, so maybe GraphicsContextANGLE can offer the semantic that Kyle suggests (depth/stencil are combined, and the same object is attached separately to the DEPTH and STENCIL attachment points). See the associated code in Chromium: https://source.chromium.org/search?q=DEPTH_STENCIL_ATTACHMENT%20f:third_party%2Fblink%2Frenderer%2Fmodules%2Fwebgl
Radar WebKit Bug Importer
Comment 6 2021-04-01 01:20:14 PDT
Kimmo Kinnunen
Comment 7 2021-08-23 04:14:03 PDT
Created attachment 436182 [details] Patch for landing
Kimmo Kinnunen
Comment 8 2021-08-23 11:01:12 PDT
Kimmo Kinnunen
Comment 9 2022-08-11 02:40:08 PDT
This is fixed in bug 242657 and the patch is not needed.
Note You need to log in before you can comment on or make changes to this bug.