[Mesa-dev] [PATCH v2 20/78] nir-lower_io: Store data.location instead, in const_index[0] of store_output

Eduardo Lima Mitev elima at igalia.com
Thu Jul 23 03:17:00 PDT 2015


Non-scalar backends like i965's NIR-vec4  need the orginal variable's varying
value instead of the driver_location (due to the way URB file emission is
implemented). This patch stores variable's location in const_index[0] instead of
the current driver_location value, which is not needed.
---
 src/glsl/nir/nir_lower_io.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_lower_io.c b/src/glsl/nir/nir_lower_io.c
index ccc832b..71a925c 100644
--- a/src/glsl/nir/nir_lower_io.c
+++ b/src/glsl/nir/nir_lower_io.c
@@ -378,9 +378,17 @@ nir_lower_io_block(nir_block *block, void *void_state)
          nir_src indirect;
          unsigned offset = get_io_offset(intrin->variables[0],
                                          &intrin->instr, &indirect, state);
-         offset += intrin->variables[0]->var->data.driver_location;
 
-         store->const_index[0] = offset;
+         /* Some non-scalar backends (like i965's NIR-vec4) need the orginal
+          * variable's varying value instead of the driver_location.
+          */
+         if (!state->is_scalar) {
+            store->const_index[0] =
+               intrin->variables[0]->var->data.location + offset;
+         } else {
+            store->const_index[0] =
+               intrin->variables[0]->var->data.driver_location + offset;
+         }
 
          nir_src_copy(&store->src[0], &intrin->src[0], state->mem_ctx);
 
-- 
2.1.4



More information about the mesa-dev mailing list