From 2ce24402d6b8e5a00ddf5b1752101eb9a042b9a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 11 Jun 2023 01:16:33 -0400 Subject: [PATCH] amd: skip redundant PKT3_NUM_INSTANCES even with register shadowing same as PAL Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/amd/vulkan/radv_cmd_buffer.c | 2 +- src/gallium/drivers/radeonsi/si_state_draw.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index 1d1ad47..1f400e7 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -8874,7 +8874,7 @@ radv_before_draw(struct radv_cmd_buffer *cmd_buffer, const struct radv_draw_info struct radv_cmd_state *state = &cmd_buffer->state; struct radeon_cmdbuf *cs = cmd_buffer->cs; assert(state->vtx_base_sgpr); - if (state->last_num_instances != info->instance_count || cmd_buffer->device->uses_shadow_regs) { + if (state->last_num_instances != info->instance_count) { radeon_emit(cs, PKT3(PKT3_NUM_INSTANCES, 0, false)); radeon_emit(cs, info->instance_count); state->last_num_instances = info->instance_count; diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 0d487d4..7ce80a4 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -1630,9 +1630,7 @@ static void si_emit_draw_packets(struct si_context *sctx, const struct pipe_draw radeon_emit(di_src_sel); } } else { - /* Register shadowing requires that we always emit PKT3_NUM_INSTANCES. */ - if (sctx->shadowing.registers || - sctx->last_instance_count == SI_INSTANCE_COUNT_UNKNOWN || + if (sctx->last_instance_count == SI_INSTANCE_COUNT_UNKNOWN || sctx->last_instance_count != instance_count) { radeon_emit(PKT3(PKT3_NUM_INSTANCES, 0, 0)); radeon_emit(instance_count); -- 2.7.4