From 14698bb451d9150be0d3039f7d0493c5fc022acd Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 12 Apr 2021 11:07:24 +0100 Subject: [PATCH] Ignore location decorations that shouldn't be used in GL --- renderdoc/driver/shaders/spirv/spirv_reflect.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp index 950a7e1d3..34c830e2c 100644 --- a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp @@ -910,10 +910,15 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st bindmap.bind = GetBinding(decorations[global.id].binding); - // On GL if we have a location, put that in as the bind. It will be overwritten - // dynamically with the actual value. - if(sourceAPI == GraphicsAPI::OpenGL && decorations[global.id].location != ~0U) + // On GL if we have a location and no binding, put that in as the bind. It will be overwritten + // dynamically with the actual value read from glGetUniform. This should only happen for + // bare uniforms and not for texture/buffer type uniforms which should have a binding + if(sourceAPI == GraphicsAPI::OpenGL && + (decorations[global.id].flags & Decorations::HasLocation | Decorations::HasBinding) == + Decorations::HasLocation) + { bindmap.bind = -int32_t(decorations[global.id].location); + } bindmap.arraySize = isArray ? arraySize : 1; bindmap.used = usedIds.find(global.id) != usedIds.end();