From b402dfeeb52efa133dcaf0e6584cb72532eaccf5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 10 Nov 2020 13:02:08 +0000 Subject: [PATCH] Don't set program I/O bindings on GL unless it has a vertex/pixel shader * For separable programs we'll query out I/O bindings for e.g. only the geometry pipeline, but we shouldn't try to set those outputs with glBindFragDataLocation. Normally we'd expect these bindings to be queried as -1 at capture time, but just be sure. --- renderdoc/driver/gl/gl_program_iterate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/gl/gl_program_iterate.cpp b/renderdoc/driver/gl/gl_program_iterate.cpp index 1f6fd85bf..6c94cc550 100644 --- a/renderdoc/driver/gl/gl_program_iterate.cpp +++ b/renderdoc/driver/gl/gl_program_iterate.cpp @@ -1365,6 +1365,9 @@ bool SerialiseProgramBindings(SerialiserType &ser, CaptureState state, for(size_t i = 0; i < 6; i++) IsProgramSPIRV |= stages.refls[i] && stages.refls[i]->encoding == ShaderEncoding::SPIRV; + const bool hasVert = stages.refls[0] != NULL; + const bool hasFrag = stages.refls[5] != NULL; + if(ser.IsWriting() && !IsProgramSPIRV) { char buf[128] = {}; @@ -1435,11 +1438,11 @@ bool SerialiseProgramBindings(SerialiserType &ser, CaptureState state, if(bind.Name.beginsWith("gl_")) continue; - if(sigType == 0) + if(sigType == 0 && hasVert) { GL.glBindAttribLocation(prog, (GLuint)bind.Binding, bind.Name.c_str()); } - else + else if(sigType == 1 && hasFrag) { // glBindFragDataLocation is not core GLES. However when it's not available that means // the user must have explicitly specified locations so we don't need to set them.