From 96fa23bca5ac88e0cd2dd0c45fdef71b2afe888d Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 14 Sep 2018 15:54:19 -0500 Subject: [PATCH] nir: Preserve offsets in lower_io_to_scalar_early MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Lionel Landwerlin Reviewed-by: Alejandro Piñeiro --- src/compiler/nir/nir_lower_io_to_scalar.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/nir/nir_lower_io_to_scalar.c b/src/compiler/nir/nir_lower_io_to_scalar.c index e9135b5..60fd61e 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; -- 2.7.4