diff options
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_lower_system_values.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index a5f44e657a5..f315b7ae96f 100644 --- a/src/compiler/nir/nir_lower_system_values.c +++ b/src/compiler/nir/nir_lower_system_values.c @@ -41,12 +41,21 @@ convert_block(nir_block *block, nir_builder *b) if (load_deref->intrinsic != nir_intrinsic_load_deref) continue; - nir_variable *var = - nir_deref_instr_get_variable(nir_src_as_deref(load_deref->src[0])); - - if (var->data.mode != nir_var_system_value) + nir_deref_instr *deref = nir_src_as_deref(load_deref->src[0]); + if (deref->mode != nir_var_system_value) continue; + if (deref->deref_type != nir_deref_type_var) { + /* The only one system value that is an array and that is + * gl_SampleMask which is always an array of one element. + */ + assert(deref->deref_type == nir_deref_type_array); + deref = nir_deref_instr_parent(deref); + assert(deref->deref_type == nir_deref_type_var); + assert(deref->var->data.location == SYSTEM_VALUE_SAMPLE_MASK_IN); + } + nir_variable *var = deref->var; + b->cursor = nir_after_instr(&load_deref->instr); nir_ssa_def *sysval = NULL; |