From 0796e5fbdf3ccb2113cbd6aa827e89e65d79c87a Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 25 Feb 2015 17:28:06 +0000 Subject: [PATCH] Handle cases where fragdata or attrib location idx is -1 * This can happen when we're copying from a source program to a dest program where the source is non-separable and had an attribute optimised out entirely, but the destination is separable and so still wants that attribute. In this case it'll come out in the wash and we can just skip it. --- renderdoc/driver/gl/gl_common.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index 64d823b36..7ca733716 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -1576,7 +1576,8 @@ void CopyProgramAttribBindings(const GLHookSet &gl, GLuint progsrc, GLuint progd continue; GLint idx = gl.glGetAttribLocation(progsrc, refl->InputSig[i].varName.elems); - gl.glBindAttribLocation(progdst, (GLuint)idx, refl->InputSig[i].varName.elems); + if(idx >= 0) + gl.glBindAttribLocation(progdst, (GLuint)idx, refl->InputSig[i].varName.elems); } } @@ -1590,7 +1591,8 @@ void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint pro continue; GLint idx = gl.glGetFragDataLocation(progsrc, refl->OutputSig[i].varName.elems); - gl.glBindFragDataLocation(progdst, (GLuint)idx, refl->OutputSig[i].varName.elems); + if(idx >= 0) + gl.glBindFragDataLocation(progdst, (GLuint)idx, refl->OutputSig[i].varName.elems); } }