| Summary: | WebGL2 clearBuffer results are lost if drawing buffer is pending a clear in certain cases | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kimmo Kinnunen <kkinnunen> |
| Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | dino, jdarpinian, kbr, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | All | ||
| OS: | All | ||
| Bug Depends on: | 241765 | ||
| Bug Blocks: | |||
|
Description
Kimmo Kinnunen
2020-10-26 06:30:55 PDT
Thanks for reporting Kimmo. Do you have a test case for this? (Which clip do you mean? Scissor rectangle set?) 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;
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) |