From da1f1178860dd75b99a95e36aa2c01a646019cda Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 13 Apr 2020 15:13:03 +0100 Subject: [PATCH] Replace default framebuffer only attachments in glInvalidateFramebuffer --- .../driver/gl/wrappers/gl_framebuffer_funcs.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp index 4bc19b3f6..a75daab7c 100644 --- a/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_framebuffer_funcs.cpp @@ -1749,6 +1749,22 @@ bool WrappedOpenGL::Serialise_glInvalidateNamedFramebufferData(SerialiserType &s if(framebuffer.name == 0) framebuffer.name = m_CurrentDefaultFBO; + GLenum *att = (GLenum *)attachments; + for(GLsizei i = 0; i < numAttachments; i++) + { + // since we are faking the default framebuffer with our own + // to see the results, replace back/front/left/right with color attachment 0 + if(att[i] == eGL_BACK_LEFT || att[i] == eGL_BACK_RIGHT || att[i] == eGL_BACK || + att[i] == eGL_FRONT_LEFT || att[i] == eGL_FRONT_RIGHT || att[i] == eGL_FRONT) + att[i] = eGL_COLOR_ATTACHMENT0; + if(att[i] == eGL_COLOR) + att[i] = eGL_COLOR_ATTACHMENT0; + if(att[i] == eGL_DEPTH) + att[i] = eGL_DEPTH_ATTACHMENT; + if(att[i] == eGL_STENCIL) + att[i] = eGL_STENCIL_ATTACHMENT; + } + GL.glInvalidateNamedFramebufferData(framebuffer.name, numAttachments, attachments); }