[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Resolve MSAA depth?

I'll try to prepare a clean test case soon. I'm on the latest Chrome Canary/Win 7/GTX970. Both source and destination are 32F. What I mean by "blank" actually looks like a solid red color, which seems to be uniform 1,0,0, no matter how close/far I'm from any geometry.It's good to know that it is supposed to work - maybe just my mistake somewhere, although I tested it heavily. The source buffer is created and attached using

renderbufferStorageMultisample(gl.RENDERBUFFER, 4, gl.DEPTH_COMPONENT32F, width, height)
framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, msaaBuffer)

and the destination created and attached to another framebufer with

texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT32F, width, height, 0, gl.DEPTH_COMPONENT, gl.FLOAT, null)
framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, tex, 0)

The blit is performed like this:
bindFramebuffer(gl.READ_FRAMEBUFFER, msaaFBO)
bindFramebuffer(gl.DRAW_FRAMEBUFFER, resolveFBO)
blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT, gl.NEAREST)

On 29 November 2016 at 17:51, Jamie Madill <jmadill@chromium.org> wrote:
This generally should work. There are tests for this in dEQP's dEQP-GLES3.functional.fbo.msaa and also in the WebGL 2-specific tests in gles3/fbomultisample and I think also fboinvalidate/sub.

Note some of these tests are marked as failing on Intel on pretty much all platforms:

Mr F, what platform are you on, and which vendor?

On Mon, Nov 28, 2016 at 10:34 PM, Kenneth Russell <kbr@google.com> wrote:
I'm pretty sure this should either work, or generate an OpenGL error. OpenGL ES 3.0.5 section 4.3.3 "Copying Pixels" says BlitFramebuffer generates INVALID_OPERATION if the mask includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, and the source and destination depth and stencil buffer formats don't match.

It looks like there are extensive tests of resolving multisampled depth buffers to single-sampled ones, but I'm not sure about resolving to a depth texture. Do you have a test case? What platform are you on (can you provide about:gpu if you're running Chrome)?


On Sat, Nov 26, 2016 at 12:26 PM, Mr F <arthur@playcanvas.com> wrote:
The docs are a bit unclear on that. Is it possible to use blitFramebuffer to get current MSAA depth buffer into a non-MSAA depth texture? The color buffer is resolved nicely, however the depth is just blank, and no error is generated - wondering if it's the expected behaviour. Depth format is DEPTH_COMPONENT32F.