summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-09-14 15:54:19 -0500
committerJason Ekstrand <[email protected]>2019-01-22 10:42:56 -0600
commit96fa23bca5ac88e0cd2dd0c45fdef71b2afe888d (patch)
tree71b9bbd6b79a5298bd091a6700bcef5f2841acc7 /src/compiler/nir
parentb2bbd978d0b1c85919c6f3b5f631b3c6cbaaaf8a (diff)
nir: Preserve offsets in lower_io_to_scalar_early
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_lower_io_to_scalar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c
index e9135b56ffd..60fd61e006c 100644
--- a/src/compiler/nir/nir_lower_io_to_scalar.c
+++ b/src/compiler/nir/nir_lower_io_to_scalar.c
@@ -192,6 +192,10 @@ lower_load_to_scalar_early(nir_builder *b, nir_intrinsic_instr *intr,
chan_var = nir_variable_clone(var, b->shader);
chan_var->data.location_frac = var->data.location_frac + i;
chan_var->type = glsl_channel_type(chan_var->type);
+ if (var->data.explicit_offset) {
+ unsigned comp_size = glsl_get_bit_size(chan_var->type) / 8;
+ chan_var->data.offset = var->data.offset + i * comp_size;
+ }
chan_vars[var->data.location_frac + i] = chan_var;
@@ -246,6 +250,10 @@ lower_store_output_to_scalar_early(nir_builder *b, nir_intrinsic_instr *intr,
chan_var = nir_variable_clone(var, b->shader);
chan_var->data.location_frac = var->data.location_frac + i;
chan_var->type = glsl_channel_type(chan_var->type);
+ if (var->data.explicit_offset) {
+ unsigned comp_size = glsl_get_bit_size(chan_var->type) / 8;
+ chan_var->data.offset = var->data.offset + i * comp_size;
+ }
chan_vars[var->data.location_frac + i] = chan_var;