Mesa (staging/19.0): Revert "glsl: Set location on structure-split sampler uniform variables"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 23 18:49:17 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Apr 17 14:48:10 2019 -0700

Revert "glsl: Set location on structure-split sampler uniform variables"

This reverts commit 9e0c744f07a21fc7bb018a77cf83b057436d0d1b, which
regressed dEQP-GLES2.functional.uniform_api.random.3.  It turns out
that the newly produced location is meaningless and impossible to
consume by drivers that want to look at gl_uniform_storage, so it's
probably better to leave it unset (0) than a number that looks usable.

Leave a tombstone^Wcomment to discourage the next person from making
the obvious looking fix.

See the next commit for a longer description of the problem.

This breaks tests/spec/glsl-1.10/execution/samplers/uniform-struct
on i965, which was originally fixed by the revert.  The next commit
will fix it again.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit 47303b466c1b15c9827d935c6c75e89e52b84dde)

---

 src/compiler/glsl/gl_nir_lower_samplers_as_deref.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 9bd0f9a4eb3..a33486b702f 100644
--- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
@@ -167,7 +167,14 @@ lower_deref(nir_builder *b, struct lower_samplers_as_deref_state *state,
    } else {
       var = nir_variable_create(state->shader, nir_var_uniform, type, name);
       var->data.binding = binding;
-      var->data.location = location;
+
+      /* Don't set var->data.location.  The old structure location could be
+       * used to index into gl_uniform_storage, assuming the full structure
+       * was walked in order.  With the new split variables, this invariant
+       * no longer holds and there's no meaningful way to start from a base
+       * location and access a particular array element.  Just leave it 0.
+       */
+
       _mesa_hash_table_insert_pre_hashed(state->remap_table, hash, name, var);
    }
 




More information about the mesa-commit mailing list