mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 19:30:11 +01:00
nir/lower_alpha_test: fix use with lowered io
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28463>
This commit is contained in:
parent
842ac5059a
commit
9af9446127
1 changed files with 13 additions and 16 deletions
|
|
@ -41,6 +41,12 @@ struct alpha_test_state {
|
|||
const gl_state_index16 *alpha_ref_state_tokens;
|
||||
};
|
||||
|
||||
static bool
|
||||
is_color_output(int location)
|
||||
{
|
||||
return location == FRAG_RESULT_COLOR || location == FRAG_RESULT_DATA0;
|
||||
}
|
||||
|
||||
static bool
|
||||
lower(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
||||
{
|
||||
|
|
@ -50,29 +56,20 @@ lower(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
switch (intr->intrinsic) {
|
||||
case nir_intrinsic_store_deref:
|
||||
out = nir_intrinsic_get_var(intr, 0);
|
||||
if (out->data.mode != nir_var_shader_out)
|
||||
return false;
|
||||
|
||||
if (!is_color_output(out->data.location))
|
||||
return false;
|
||||
break;
|
||||
case nir_intrinsic_store_output:
|
||||
/* already had i/o lowered.. lookup the matching output var: */
|
||||
nir_foreach_shader_out_variable(var, b->shader) {
|
||||
int drvloc = var->data.driver_location;
|
||||
if (nir_intrinsic_base(intr) == drvloc) {
|
||||
out = var;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assume(out);
|
||||
if (!is_color_output(nir_intrinsic_io_semantics(intr).location))
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (out->data.mode != nir_var_shader_out)
|
||||
return false;
|
||||
|
||||
if (out->data.location != FRAG_RESULT_COLOR &&
|
||||
out->data.location != FRAG_RESULT_DATA0)
|
||||
return false;
|
||||
|
||||
b->cursor = nir_before_instr(&intr->instr);
|
||||
|
||||
nir_def *alpha;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue