From e718f8e713767f1bd76038eb6ed4ee95942981e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 19 Jul 2019 21:12:43 -0400 Subject: [PATCH] radeonsi: simplify si_get_input_prim and remove incorrect TODO comment u_vertices_per_prim(QUADS) is the same as TRIANGLES. Reviewed-by: Pierre-Eric Pelloux-Prayer --- src/gallium/drivers/radeonsi/gfx10_shader_ngg.c | 5 +---- src/gallium/drivers/radeonsi/si_state.h | 3 +-- src/gallium/drivers/radeonsi/si_state_shaders.c | 8 +++----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c index c4bdff35deb..f5c41cd07a4 100644 --- a/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c +++ b/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c @@ -1315,10 +1315,7 @@ void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader) shader->previous_stage_sel ? shader->previous_stage_sel : gs_sel; const enum pipe_shader_type gs_type = gs_sel->type; const unsigned gs_num_invocations = MAX2(gs_sel->gs_num_invocations, 1); - /* TODO: Use QUADS as the worst case because of reuse, but triangles - * will always have 1 additional unoccupied vector lane. We could use - * that lane if the worst case was TRIANGLES. */ - const unsigned input_prim = si_get_input_prim(gs_sel, PIPE_PRIM_QUADS); + const unsigned input_prim = si_get_input_prim(gs_sel); const bool use_adjacency = input_prim >= PIPE_PRIM_LINES_ADJACENCY && input_prim <= PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY; const unsigned max_verts_per_prim = u_vertices_per_prim(input_prim); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index a0fe826253a..acdbefbf64f 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -599,8 +599,7 @@ void si_shader_selector_key_vs(struct si_context *sctx, struct si_shader_selector *vs, struct si_shader_key *key, struct si_vs_prolog_bits *prolog_key); -unsigned si_get_input_prim(const struct si_shader_selector *gs, - unsigned default_worst_case); +unsigned si_get_input_prim(const struct si_shader_selector *gs); /* si_state_draw.c */ void si_emit_surface_sync(struct si_context *sctx, struct radeon_cmdbuf *cs, diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 388bc68adce..325eae19bed 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -1060,8 +1060,7 @@ static void si_set_ge_pc_alloc(struct si_screen *sscreen, S_030980_NUM_PC_LINES((culling ? 256 : 128) * sscreen->info.max_se - 1)); } -unsigned si_get_input_prim(const struct si_shader_selector *gs, - unsigned default_worst_case) +unsigned si_get_input_prim(const struct si_shader_selector *gs) { if (gs->type == PIPE_SHADER_GEOMETRY) return gs->info.properties[TGSI_PROPERTY_GS_INPUT_PRIM]; @@ -1075,7 +1074,7 @@ unsigned si_get_input_prim(const struct si_shader_selector *gs, } /* TODO: Set this correctly if the primitive type is set in the shader key. */ - return default_worst_case; + return PIPE_PRIM_TRIANGLES; /* worst case for all callers */ } /** @@ -1098,8 +1097,7 @@ static void gfx10_shader_ngg(struct si_screen *sscreen, struct si_shader *shader gs_info->properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION]; bool es_enable_prim_id = shader->key.mono.u.vs_export_prim_id || es_info->uses_primid; unsigned gs_num_invocations = MAX2(gs_sel->gs_num_invocations, 1); - /* Anything above TRIANGLES has the same effect as TRIANGLES here. */ - unsigned input_prim = si_get_input_prim(gs_sel, PIPE_PRIM_TRIANGLES); + unsigned input_prim = si_get_input_prim(gs_sel); bool break_wave_at_eoi = false; struct si_pm4_state *pm4 = si_get_shader_pm4_state(shader); if (!pm4) -- 2.30.2