Commit f8493aaa6d0be103c1ba1d9877d21a1f5c36479e

Cody Northrop 2025-01-29T15:31:40

FrameCapture: Fix framebuffer setup for multiple contexts In some traces we're seeing garbage in Context specific setup for framebuffers. It seems the context is being lost in the final bind. For instance, we see this bad sequence in SetupReplayContext2: glGenFramebuffers(1, (GLuint *)gReadBuffer); UpdateFramebufferID2(2, 2, 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2][2]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gTextureMap[50], 0); glGenFramebuffers(1, (GLuint *)gReadBuffer); UpdateFramebufferID2(2, 3, 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2][3]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gTextureMap[50], 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2863311360][0]); Note the very large number in the last line. That is supposed to be a context number! This is due to a missing call to set the context for that instruction. It was added in one spot, but was needed in several. With the fix in this CL, we get the correct context: glGenFramebuffers(1, (GLuint *)gReadBuffer); UpdateFramebufferID2(2, 2, 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2][2]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gTextureMap[50], 0); glGenFramebuffers(1, (GLuint *)gReadBuffer); UpdateFramebufferID2(2, 3, 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2][3]); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gTextureMap[50], 0); glBindFramebuffer(GL_FRAMEBUFFER, gFramebufferMapPerContext[2][0]); Test: Capture apps that set up multiple contexts Bug: b/371985732 Change-Id: Id12d7f0ec0ec9a2cdc2b4bfeca08faf9b8b7e775 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6217081 Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Mark Łobodziński <mark@lunarg.com>