mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
nir: fix lower_wpos_ytransform in load_frag_coord case
Apparently we never hit this path. Or at least haven't for a rather long time. But in either case (load_deref or load_frag_coord), we can just directly use the intrinsic's ssa dest. So stop passing the nir_variable (which would be NULL in the load_frag_coord case) around and instead just use &intr->dest.ssa. (This ofc means we need to setup the cursor to insert *after* the instruction, which seems to be another bug of the original implementation.) Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
parent
691d5a825a
commit
a2c89a85f4
1 changed files with 11 additions and 10 deletions
|
|
@ -77,18 +77,18 @@ nir_cmp(nir_builder *b, nir_ssa_def *src0, nir_ssa_def *src1, nir_ssa_def *src2)
|
|||
/* 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]) {
|
||||
|
|
@ -139,12 +139,13 @@ emit_wpos_adjustment(lower_wpos_ytransform_state *state,
|
|||
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;
|
||||
|
|
@ -228,7 +229,7 @@ lower_fragcoord(lower_wpos_ytransform_state *state,
|
|||
}
|
||||
}
|
||||
|
||||
emit_wpos_adjustment(state, intr, fragcoord, invert, adjX, adjY);
|
||||
emit_wpos_adjustment(state, intr, invert, adjX, adjY);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -331,7 +332,7 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state *state, nir_block *block
|
|||
(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);
|
||||
|
|
@ -341,7 +342,7 @@ lower_wpos_ytransform_block(lower_wpos_ytransform_state *state, nir_block *block
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue