aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-12-15 18:09:46 +0100
committerErik Faye-Lund <[email protected]>2020-01-03 22:48:19 +0000
commit56fc791b3190be2a9a2295b0e6245687645c9b84 (patch)
treea381f8d583eea2552024b34262f416704b7fb6ef /src
parentd9ff5f0414946a493692b1f82338d006aa1f7df2 (diff)
etnaviv: use nir_lower_clip_halfz instead of open-coding
We already have a helper for this, so let's use that instead of rolling our own version. Reviewed-by: Jonathan Marek <[email protected]> Tested-by: Paul Cercueil <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
index c481b890456..7934eb0490e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
@@ -97,26 +97,6 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
} break;
case nir_intrinsic_store_deref: {
nir_deref_instr *deref = nir_src_as_deref(intr->src[0]);
- if (shader->info.stage == MESA_SHADER_VERTEX &&
- v->shader->specs->vs_need_z_div &&
- deref->var->data.location == VARYING_SLOT_POS) {
-
- assert(deref->deref_type == nir_deref_type_var);
-
- b.cursor = nir_before_instr(instr);
-
- nir_ssa_def *out[4];
- out[0] = nir_channel(&b, intr->src[1].ssa, 0);
- out[1] = nir_channel(&b, intr->src[1].ssa, 1);
- out[2] = nir_fmul_imm(&b, nir_fadd(&b, nir_channel(&b, intr->src[1].ssa, 2),
- nir_channel(&b, intr->src[1].ssa, 3)),
- 0.5f);
- out[3] = nir_channel(&b, intr->src[1].ssa, 3);
-
- nir_instr_rewrite_src(instr, &intr->src[1],
- nir_src_for_ssa(nir_vec(&b, out, 4)));
- }
-
if (shader->info.stage != MESA_SHADER_FRAGMENT || !v->key.frag_rb_swap)
break;
@@ -773,6 +753,9 @@ etna_compile_shader_nir(struct etna_shader_variant *v)
OPT_V(s, etna_lower_io, v);
+ if (v->shader->specs->vs_need_z_div)
+ NIR_PASS_V(s, nir_lower_clip_halfz);
+
/* lower pre-halti2 to float (halti0 has integers, but only scalar..) */
if (c->specs->halti < 2) {
/* use opt_algebraic between int_to_float and boot_to_float because