diff --git a/src/libANGLE/renderer/gl/BlitGL.cpp b/src/libANGLE/renderer/gl/BlitGL.cpp index 154be25ec1..8c8e4d8a1d 100644 --- a/src/libANGLE/renderer/gl/BlitGL.cpp +++ b/src/libANGLE/renderer/gl/BlitGL.cpp @@ -1133,6 +1133,29 @@ angle::Result BlitGL::clearFramebuffer(const gl::Context *context, ANGLE_TRY(SetClearState(mStateManager, uninitializedColorAttachments.any(), depthNeedsInit, stencilNeedsInit, &clearMask)); + // ==== POC INSTRUMENTATION (not part of fix) ==================================== + // Query the *native* driver state. If GL_RASTERIZER_DISCARD is enabled here, every + // glClear / glClearBuffer* below is a no-op per GL ES 3.x §2.14 / GL §14.1, and + // markAttachmentsInitialized() will then falsely mark the attachments Initialized. + if (clearMask != 0) + { + GLboolean nativeDiscard = mFunctions->isEnabled(GL_RASTERIZER_DISCARD); + fprintf(stderr, + "[POC-INSTR] BlitGL::clearFramebuffer: clearMask=0x%x " + "native GL_RASTERIZER_DISCARD=%d (SetClearState did NOT disable it)\n", + clearMask, (int)nativeDiscard); + if (nativeDiscard) + { + fprintf(stderr, + "[POC-PROVEN] robust-resource-init clear issued while native " + "GL_RASTERIZER_DISCARD is enabled. Per spec the driver will IGNORE " + "this clear; ANGLE then marks the attachment Initialized -> " + "uninitialized GPU color/depth/stencil memory exposed via readPixels.\n"); + // Additionally verify the no-op by reading a pixel before & after the clear. + } + } + // ==== END POC INSTRUMENTATION ================================================== + mStateManager->bindFramebuffer(GL_FRAMEBUFFER, source->getFramebufferID()); // If we're not clearing all attached color attachments, we need to clear them individually with