/* see emit_wpos_adjustment() in st_mesa_to_tgsi.c */
static void
emit_wpos_adjustment(lower_wpos_ytransform_state *state,
- nir_intrinsic_instr *intr, nir_variable *fragcoord,
- bool invert, float adjX, float adjY[2])
+ nir_intrinsic_instr *intr, bool invert,
+ float adjX, float adjY[2])
{
nir_builder *b = &state->b;
nir_ssa_def *wpostrans, *wpos_temp, *wpos_temp_y, *wpos_input;
assert(intr->dest.is_ssa);
+ wpos_input = &intr->dest.ssa;
- b->cursor = nir_before_instr(&intr->instr);
+ b->cursor = nir_after_instr(&intr->instr);
wpostrans = get_transform(state);
- wpos_input = nir_load_var(b, fragcoord);
/* First, apply the coordinate shift: */
if (adjX || adjY[0] || adjY[1]) {
nir_channel(b, wpos_temp, 2),
nir_channel(b, wpos_temp, 3));
- nir_ssa_def_rewrite_uses(&intr->dest.ssa, nir_src_for_ssa(wpos_temp));
+ nir_ssa_def_rewrite_uses_after(&intr->dest.ssa,
+ nir_src_for_ssa(wpos_temp),
+ wpos_temp->parent_instr);
}
static void
-lower_fragcoord(lower_wpos_ytransform_state *state,
- nir_intrinsic_instr *intr, nir_variable *fragcoord)
+lower_fragcoord(lower_wpos_ytransform_state *state, nir_intrinsic_instr *intr)
{
const nir_lower_wpos_ytransform_options *options = state->options;
float adjX = 0.0f;
}
}
- emit_wpos_adjustment(state, intr, fragcoord, invert, adjX, adjY);
+ emit_wpos_adjustment(state, intr, invert, adjX, adjY);
}
static void
(var->data.mode == nir_var_system_value &&
var->data.location == SYSTEM_VALUE_FRAG_COORD)) {
/* gl_FragCoord should not have array/struct derefs: */
- lower_fragcoord(state, intr, var);
+ lower_fragcoord(state, intr);
} else if (var->data.mode == nir_var_system_value &&
var->data.location == SYSTEM_VALUE_SAMPLE_POS) {
lower_load_sample_pos(state, intr);
lower_load_pointcoord(state, intr);
}
} else if (intr->intrinsic == nir_intrinsic_load_frag_coord) {
- lower_fragcoord(state, intr, NULL);
+ lower_fragcoord(state, intr);
} else if (intr->intrinsic == nir_intrinsic_load_sample_pos) {
lower_load_sample_pos(state, intr);
} else if (intr->intrinsic == nir_intrinsic_interp_deref_at_offset) {