diff options
author | Jason Ekstrand <[email protected]> | 2018-03-23 07:51:24 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:15:55 -0700 |
commit | 933c2851ab248358e3887f1afd7d228d34af625d (patch) | |
tree | 00f5457a31ffced486a721658cc5240720366037 | |
parent | 64057fd3337ad4ceb9f8739d0b112b3a29331e1c (diff) |
nir: Support deref instructions in lower_pos_center
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/compiler/nir/nir_lower_wpos_center.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_lower_wpos_center.c b/src/compiler/nir/nir_lower_wpos_center.c index fa225992e3e..5b68caca358 100644 --- a/src/compiler/nir/nir_lower_wpos_center.c +++ b/src/compiler/nir/nir_lower_wpos_center.c @@ -81,7 +81,18 @@ lower_wpos_center_block(nir_builder *b, nir_block *block, nir_foreach_instr(instr, block) { if (instr->type == nir_instr_type_intrinsic) { nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); - if (intr->intrinsic == nir_intrinsic_load_var) { + if (intr->intrinsic == nir_intrinsic_load_deref) { + nir_deref_instr *deref = nir_src_as_deref(intr->src[0]); + nir_variable *var = nir_deref_instr_get_variable(deref); + + if (var->data.mode == nir_var_shader_in && + var->data.location == VARYING_SLOT_POS) { + /* gl_FragCoord should not have array/struct derefs: */ + assert(deref->deref_type == nir_deref_type_var); + update_fragcoord(b, intr, for_sample_shading); + progress = true; + } + } else if (intr->intrinsic == nir_intrinsic_load_var) { nir_deref_var *dvar = intr->variables[0]; nir_variable *var = dvar->var; @@ -107,8 +118,6 @@ nir_lower_wpos_center(nir_shader *shader, const bool for_sample_shading) assert(shader->info.stage == MESA_SHADER_FRAGMENT); - nir_assert_lowered_derefs(shader, nir_lower_load_store_derefs); - nir_foreach_function(function, shader) { if (function->impl) { nir_builder_init(&b, function->impl); |