mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
nir/lower_gs_intrinsics: Remove end primitive for points
EndPrimitive() for points is entirely pointless, so just remove it when lowering EndPrimitive to simplify the IR. This is (maybe) an optimization everywhere, and will be relied on for correctness on Asahi. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24798>
This commit is contained in:
parent
8c7629524e
commit
f9e5534182
1 changed files with 9 additions and 7 deletions
|
|
@ -201,15 +201,21 @@ rewrite_end_primitive(nir_intrinsic_instr *intrin, struct state *state)
|
|||
nir_builder *b = state->builder;
|
||||
unsigned stream = nir_intrinsic_stream_id(intrin);
|
||||
|
||||
b->cursor = nir_before_instr(&intrin->instr);
|
||||
b->cursor = nir_instr_remove(&intrin->instr);
|
||||
state->progress = true;
|
||||
|
||||
/* end_primitive doesn't do anything for points, remove without replacing */
|
||||
if (state->is_points) {
|
||||
b->shader->info.gs.uses_end_primitive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
assert(state->vertex_count_vars[stream] != NULL);
|
||||
nir_def *count = nir_load_var(b, state->vertex_count_vars[stream]);
|
||||
nir_def *count_per_primitive;
|
||||
|
||||
if (state->count_vtx_per_prim)
|
||||
count_per_primitive = nir_load_var(b, state->vtxcnt_per_prim_vars[stream]);
|
||||
else if (state->is_points)
|
||||
count_per_primitive = nir_imm_int(b, 0);
|
||||
else
|
||||
count_per_primitive = nir_undef(b, count->num_components, count->bit_size);
|
||||
|
||||
|
|
@ -232,10 +238,6 @@ rewrite_end_primitive(nir_intrinsic_instr *intrin, struct state *state)
|
|||
nir_imm_int(b, 0),
|
||||
0x1); /* .x */
|
||||
}
|
||||
|
||||
nir_instr_remove(&intrin->instr);
|
||||
|
||||
state->progress = true;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue