NEW 218185
WebGL2 clearBuffer results are lost if drawing buffer is pending a clear in certain cases
https://bugs.webkit.org/show_bug.cgi?id=218185
Summary WebGL2 clearBuffer results are lost if drawing buffer is pending a clear in c...
Kimmo Kinnunen
Reported 2020-10-26 06:30:55 PDT
WebGL2 clearBuffer results are lost if drawing buffer is pending a clear in certain cases 1) Drawing buffer is prepared for display 2) clearBuffer is called 3) ..before drawing buffer is cleared 4) ..while having clip 5) will just run the clearBuffer Instead, the pending clear should be flushed and then the clearBuffer should be done.
Attachments
Radar WebKit Bug Importer
Comment 1 2020-11-02 05:31:16 PST
Kenneth Russell
Comment 2 2020-11-18 12:10:08 PST
Thanks for reporting Kimmo. Do you have a test case for this? (Which clip do you mean? Scissor rectangle set?)
Kimmo Kinnunen
Comment 3 2020-11-18 23:51:51 PST
Yeah, scissor enable. void WebGL2RenderingContext::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, Int32List&& values, GCGLuint srcOffset) { if (isContextLostOrPending() || !validateClearBuffer("clearBufferiv", buffer, values.length(), srcOffset)) return; m_context->clearBufferiv(buffer, drawbuffer, values.data(), srcOffset); updateBuffersToAutoClear(ClearBufferCaller::ClearBufferiv, buffer, drawbuffer); } void WebGL2RenderingContext::updateBuffersToAutoClear(ClearBufferCaller caller, GCGLenum buffer, GCGLint drawbuffer) { // This method makes sure that we don't auto-clear any buffers which the // user has manually cleared using the new ES 3.0 clearBuffer* APIs. // If the user has a framebuffer bound, don't update the auto-clear // state of the built-in back buffer. if (m_framebufferBinding) return; // If the scissor test is on, assume that we can't short-circuit // these clears. if (m_scissorEnabled) return;
Kenneth Russell
Comment 4 2020-11-20 16:55:20 PST
Thanks. Yes, it looks like there's a problem as you describe. Would you be willing to try writing a test case for this? It could be modeled after https://github.com/KhronosGroup/WebGL/blob/master/sdk/tests/conformance2/rendering/rasterizer-discard-and-implicit-clear.html . Suggestion: - Use setupQuad to set up a small quad (maybe scale 0.1) In requestAnimationFrame: - Enable scissor test (but have the scissor rect cover the entire canvas) - Use clearBufferiv to clear the color buffer to green - Draw the scaled quad in green - Assert the canvas is fully green (with the bug, the surrounding region of the quad will be black)
Note You need to log in before you can comment on or make changes to this bug.