radv: fix emitting NGG culling state for ESO

It's possible to enable NGG culling with ESO if shaders are linked, or
if the VS doesn't need a prolog or if TES is used. This wasn't
supposed to be enabled but I think it worked just by luck because the
user SGPR value was probably zero and NGGC was disabled at draw time.

Found by inspection.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31829>
This commit is contained in:
Samuel Pitoiset 2024-10-24 16:43:05 +02:00 committed by Marge Bot
parent 982af1a2bc
commit 62efebfd70

View file

@ -10878,7 +10878,7 @@ radv_emit_all_graphics_states(struct radv_cmd_buffer *cmd_buffer, const struct r
(cmd_buffer->state.dirty_dynamic & (RADV_DYNAMIC_RASTERIZATION_SAMPLES | RADV_DYNAMIC_PRIMITIVE_TOPOLOGY)))
radv_flush_occlusion_query_state(cmd_buffer);
if (((cmd_buffer->state.dirty & RADV_CMD_DIRTY_PIPELINE) ||
if (((cmd_buffer->state.dirty & (RADV_CMD_DIRTY_PIPELINE | RADV_CMD_DIRTY_GRAPHICS_SHADERS)) ||
(cmd_buffer->state.dirty_dynamic &
(RADV_DYNAMIC_CULL_MODE | RADV_DYNAMIC_FRONT_FACE | RADV_DYNAMIC_RASTERIZER_DISCARD_ENABLE |
RADV_DYNAMIC_VIEWPORT | RADV_DYNAMIC_CONSERVATIVE_RAST_MODE | RADV_DYNAMIC_RASTERIZATION_SAMPLES |
@ -11003,6 +11003,8 @@ radv_bind_graphics_shaders(struct radv_cmd_buffer *cmd_buffer)
cmd_buffer->state.last_vgt_shader = cmd_buffer->state.shaders[last_vgt_api_stage];
cmd_buffer->state.has_nggc = cmd_buffer->state.last_vgt_shader->info.has_ngg_culling;
struct radv_shader *gs_copy_shader = cmd_buffer->state.shader_objs[MESA_SHADER_GEOMETRY]
? cmd_buffer->state.shader_objs[MESA_SHADER_GEOMETRY]->gs.copy_shader
: NULL;
@ -13782,7 +13784,6 @@ radv_reset_pipeline_state(struct radv_cmd_buffer *cmd_buffer, VkPipelineBindPoin
cmd_buffer->state.gs_copy_shader = NULL;
cmd_buffer->state.last_vgt_shader = NULL;
cmd_buffer->state.has_nggc = false;
cmd_buffer->state.emitted_vs_prolog = NULL;
cmd_buffer->state.spi_shader_col_format = 0;
cmd_buffer->state.cb_shader_mask = 0;