Module: Mesa
Branch: staging/19.0
Commit: bac4862900dc6fb671342a61a6d9ce9effa331e4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bac4862900dc6fb671342a61a6d9ce9effa331e4

Author: Kenneth Graunke <[email protected]>
Date:   Wed Feb  6 02:05:01 2019 -0800

glsl: Don't look at sampler uniform storage for internal vars

Passes like nir_lower_drawpixels add additional sampler variables,
and set an explicit binding which never changes.  These extra samplers
don't have proper uniform storage associated with them, and there is no
way to update bindings via the API.  So, for any 'hidden' variables,
just trust that there's an explicit binding set.

Reviewed-by: Eric Anholt <[email protected]>
(cherry picked from commit 529a0711c1d07c109f83286583ed359a890f5a75)

---

 src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c 
b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
index 5d0430c0add..87718112db7 100644
--- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
@@ -147,16 +147,18 @@ lower_deref(nir_builder *b, struct 
lower_samplers_as_deref_state *state,
 
    remove_struct_derefs_prep(path.path, &name, &location, &type);
 
-   if (state->shader_program) {
+   if (state->shader_program && var->data.how_declared != nir_var_hidden) {
       /* For GLSL programs, look up the bindings in the uniform storage. */
       assert(location < state->shader_program->data->NumUniformStorage &&
              
state->shader_program->data->UniformStorage[location].opaque[stage].active);
 
       binding = 
state->shader_program->data->UniformStorage[location].opaque[stage].index;
    } else {
-      /* For ARB programs or built-in shaders, assume that whoever created
-       * the shader set the bindings correctly already.
+      /* For ARB programs, built-in shaders, or internally generated sampler
+       * variables in GLSL programs, assume that whoever created the shader
+       * set the bindings correctly already.
        */
+      assert(var->data.explicit_binding);
       binding = var->data.binding;
    }
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to