summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_io.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-10-20 09:10:02 -0500
committerJason Ekstrand <[email protected]>2018-10-22 14:24:15 -0500
commit16870de8a0aab97bd3534b660e7ea73e90ac11cd (patch)
tree6a2b213cc8f477bdb923b9aceb430715724cb7a1 /src/compiler/nir/nir_lower_io.c
parentce36f412c99340814c429f99694423af61825c64 (diff)
nir: Use nir_src_is_const and nir_src_as_* in core code
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_io.c')
-rw-r--r--src/compiler/nir/nir_lower_io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index c418433aa52..b3595bb19d5 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -112,10 +112,8 @@ get_io_offset(nir_builder *b, nir_deref_instr *deref,
assert(glsl_type_is_scalar((*p)->type));
/* We always lower indirect dereferences for "compact" array vars. */
- nir_const_value *const_index = nir_src_as_const_value((*p)->arr.index);
- assert(const_index);
-
- const unsigned total_offset = *component + const_index->u32[0];
+ const unsigned index = nir_src_as_uint((*p)->arr.index);
+ const unsigned total_offset = *component + index;
const unsigned slot_offset = total_offset / 4;
*component = total_offset % 4;
return nir_imm_int(b, type_size(glsl_vec4_type()) * slot_offset);