diff options
author | Jason Ekstrand <[email protected]> | 2018-12-13 14:31:54 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-12-18 13:13:28 -0600 |
commit | 8cc0f92492152bb315838944f7803e94d2ce33d3 (patch) | |
tree | 280e7494cf054c583bd7bad93cb123ff7d6be7f5 /src | |
parent | 8410cf66d776aa832f666bc50dad460dd577bf27 (diff) |
nir/linking_helpers: Look at derefs for modes
This is instead of looking all the way back to the variable which may
not exist for all derefs. This makes this code properly ignore casts
with modes other than the mode[s] we care about (where casts aren't
allowed).
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir_linking_helpers.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 1ab9c095657..ffe2d370226 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -75,12 +75,11 @@ tcs_add_output_reads(nir_shader *shader, uint64_t *read, uint64_t *patches_read) if (intrin->intrinsic != nir_intrinsic_load_deref) continue; - nir_variable *var = - nir_deref_instr_get_variable(nir_src_as_deref(intrin->src[0])); - - if (var->data.mode != nir_var_shader_out) + nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]); + if (deref->mode != nir_var_shader_out) continue; + nir_variable *var = nir_deref_instr_get_variable(deref); if (var->data.patch) { patches_read[var->data.location_frac] |= get_variable_io_mask(var, shader->info.stage); @@ -565,12 +564,12 @@ static bool try_replace_constant_input(nir_shader *shader, nir_intrinsic_instr *store_intr) { - nir_variable *out_var = - nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0])); - - if (out_var->data.mode != nir_var_shader_out) + nir_deref_instr *out_deref = nir_src_as_deref(store_intr->src[0]); + if (out_deref->mode != nir_var_shader_out) return false; + nir_variable *out_var = nir_deref_instr_get_variable(out_deref); + /* Skip types that require more complex handling. * TODO: add support for these types. */ @@ -605,12 +604,12 @@ try_replace_constant_input(nir_shader *shader, if (intr->intrinsic != nir_intrinsic_load_deref) continue; - nir_variable *in_var = - nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0])); - - if (in_var->data.mode != nir_var_shader_in) + nir_deref_instr *in_deref = nir_src_as_deref(intr->src[0]); + if (in_deref->mode != nir_var_shader_in) continue; + nir_variable *in_var = nir_deref_instr_get_variable(in_deref); + if (in_var->data.location != out_var->data.location || in_var->data.location_frac != out_var->data.location_frac) continue; |