summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-05-11 17:37:27 +0200
committerSamuel Pitoiset <[email protected]>2017-06-14 10:04:36 +0200
commit31154f097519af5143dfb3ffe67b9fe731f81b6e (patch)
treecb7fbe76cf83dafc0ae41731d74600969117ca13 /src/compiler/glsl
parente3c6fba5d69a6695d7bc431440fa1f9276e82b10 (diff)
glsl: set the explicit binding value for bindless samplers/images
This handles a situation like: layout (bindless_sampler, binding = 7) uniform sampler2D; Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/link_uniform_initializers.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp
index bc3dcab7c35..e7f9c9d8ac0 100644
--- a/src/compiler/glsl/link_uniform_initializers.cpp
+++ b/src/compiler/glsl/link_uniform_initializers.cpp
@@ -140,16 +140,39 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog,
if (storage->type->is_sampler()) {
for (unsigned i = 0; i < elements; i++) {
const unsigned index = storage->opaque[sh].index + i;
- if (index >= ARRAY_SIZE(shader->Program->SamplerUnits))
- break;
- shader->Program->SamplerUnits[index] = storage->storage[i].i;
+
+ if (var->data.bindless) {
+ if (index >= shader->Program->sh.NumBindlessSamplers)
+ break;
+ shader->Program->sh.BindlessSamplers[index].unit =
+ storage->storage[i].i;
+ shader->Program->sh.BindlessSamplers[index].bound = true;
+ shader->Program->sh.HasBoundBindlessSampler = true;
+ } else {
+ if (index >= ARRAY_SIZE(shader->Program->SamplerUnits))
+ break;
+ shader->Program->SamplerUnits[index] =
+ storage->storage[i].i;
+ }
}
} else if (storage->type->is_image()) {
for (unsigned i = 0; i < elements; i++) {
const unsigned index = storage->opaque[sh].index + i;
- if (index >= ARRAY_SIZE(shader->Program->sh.ImageUnits))
- break;
- shader->Program->sh.ImageUnits[index] = storage->storage[i].i;
+
+
+ if (var->data.bindless) {
+ if (index >= shader->Program->sh.NumBindlessImages)
+ break;
+ shader->Program->sh.BindlessImages[index].unit =
+ storage->storage[i].i;
+ shader->Program->sh.BindlessImages[index].bound = true;
+ shader->Program->sh.HasBoundBindlessImage = true;
+ } else {
+ if (index >= ARRAY_SIZE(shader->Program->sh.ImageUnits))
+ break;
+ shader->Program->sh.ImageUnits[index] =
+ storage->storage[i].i;
+ }
}
}
}