} 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;
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