View Full Version : Explicit bindings ignored

11-30-2016, 12:44 AM
Edit: I am stupid!

I need "location" not "binding" for uniforms.
But why does glsl not complain

the following bindings are ignored.
The locations for my samplers start at 3, which implies that the interface block is bound at 0.
More than that, the samplers location bindings are ignored as well and bould lexicographically

Am I missing something or is this some gtx1070 driver problem?

Best Regards

#version 450
#extension GL_ARB_explicit_uniform_location : require

layout( binding = 0) uniform sampler2D normal ;
layout( binding = 1) uniform sampler2D diffuse ;
layout( binding = 2) uniform sampler2D specular ;
layout( binding = 3) uniform usampler2D shininess ;
layout( binding = 4) uniform sampler2D depth ;

struct DeferredConstData
mat4 P;
mat4 Pinv;
vec3 lightSourceV;

layout(std140, binding = 5) uniform ConstantBuffer{

DeferredConstData deferredConstData;

11-30-2016, 02:12 AM
I need "location" not "binding" for uniforms.
But why does glsl not complain

"location" is correct for uniforms in the default uniform block, "binding" is correct for uniform blocks and for atomic counters.

It seems likely that the compiler accepts any layout qualifier within layout(...) and just ignores those which aren't applicable to a particular declaration.