Mesa (main): glsl/nir: mark samplers inside a block as bindless
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 3 09:56:10 UTC 2021
Module: Mesa
Branch: main
Commit: c6e2c802c412c9d4b0f183cc17a5add2212b07ce
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6e2c802c412c9d4b0f183cc17a5add2212b07ce
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Tue Oct 19 18:13:49 2021 +0200
glsl/nir: mark samplers inside a block as bindless
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13416>
---
src/compiler/glsl/gl_nir_link_uniforms.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c
index 47d40d62f4e..a7a211bfe57 100644
--- a/src/compiler/glsl/gl_nir_link_uniforms.c
+++ b/src/compiler/glsl/gl_nir_link_uniforms.c
@@ -745,13 +745,20 @@ update_uniforms_shader_info(struct gl_shader_program *prog,
if (glsl_type_is_sampler(type_no_array)) {
bool init_idx;
- unsigned *next_index = state->current_var->data.bindless ?
+ /* ARB_bindless_texture spec says:
+ *
+ * "When used as shader inputs, outputs, uniform block members,
+ * or temporaries, the value of the sampler is a 64-bit unsigned
+ * integer handle and never refers to a texture image unit."
+ */
+ bool is_bindless = state->current_var->data.bindless || state->var_is_in_block;
+ unsigned *next_index = is_bindless ?
&state->next_bindless_sampler_index :
&state->next_sampler_index;
int sampler_index = get_next_index(state, uniform, next_index, &init_idx);
struct gl_linked_shader *sh = prog->_LinkedShaders[stage];
- if (state->current_var->data.bindless) {
+ if (is_bindless) {
if (init_idx) {
sh->Program->sh.BindlessSamplers =
rerzalloc(sh->Program, sh->Program->sh.BindlessSamplers,
More information about the mesa-commit
mailing list