From 529dec8c653d5e4956b6525e131a23b2e79a9643 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 11 Sep 2017 15:32:09 +0100 Subject: [PATCH] Add a fallback if TF varyings cause program not to link --- renderdoc/driver/gl/gl_manager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index 27923fc8d..d5155ec59 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -1128,6 +1128,16 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res) GLint status = 0; gl.glGetProgramiv(initProg, eGL_LINK_STATUS, &status); + // if it failed to link, first remove the varyings hack above as maybe the driver is barfing + // on trying to make some output a varying + if(status == 0) + { + gl.glTransformFeedbackVaryings(initProg, 0, NULL, eGL_INTERLEAVED_ATTRIBS); + gl.glLinkProgram(initProg); + + gl.glGetProgramiv(initProg, eGL_LINK_STATUS, &status); + } + // if it failed to link, try again as a separable program. // we can't do this by default because of the silly rules meaning // shaders need fixup to be separable-compatible.