From 8f10523b7e73f582233af98e2ecb13380e3fc346 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 24 Feb 2015 22:59:54 +0000 Subject: [PATCH] If program with initial contents doesn't link, try again as separable * We can't just link ALL programs as separable to be safe, since this hits the same problem of some shaders not being valid as separable :(. * This should fix the case where a separable program with initial state was failing to link before, without breaking non-separable programs. --- renderdoc/driver/gl/gl_manager.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/driver/gl/gl_manager.cpp b/renderdoc/driver/gl/gl_manager.cpp index b22601820..d832f0e9d 100644 --- a/renderdoc/driver/gl/gl_manager.cpp +++ b/renderdoc/driver/gl/gl_manager.cpp @@ -628,6 +628,18 @@ bool GLResourceManager::Serialise_InitialState(GLResource res) GLint status = 0; 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. + if(status == 0) + { + gl.glProgramParameteri(initProg, eGL_PROGRAM_SEPARABLE, 1); + gl.glLinkProgram(initProg); + + gl.glGetProgramiv(initProg, eGL_LINK_STATUS, &status); + } + if(status == 0) { if(details.shaders.size() == 0)