mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 09:58:05 +02:00
radv: only re-emit the per-vertex VRS rates if necessary
This reduces the overhead slightly when the VRS rates don't change. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14713>
This commit is contained in:
parent
99d7c13051
commit
b4f526cc19
2 changed files with 20 additions and 2 deletions
|
|
@ -3637,8 +3637,11 @@ radv_flush_force_vrs_state(struct radv_cmd_buffer *cmd_buffer)
|
|||
uint32_t vrs_rates = 0;
|
||||
uint32_t base_reg;
|
||||
|
||||
if (!pipeline->graphics.force_vrs_per_vertex)
|
||||
if (!pipeline->graphics.force_vrs_per_vertex) {
|
||||
/* Un-set the SGPR index so we know to re-emit it later. */
|
||||
cmd_buffer->state.last_vrs_rates_sgpr_idx = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
loc = radv_lookup_user_sgpr(pipeline, stage, AC_UD_FORCE_VRS_RATES);
|
||||
assert(loc->sgpr_idx != -1);
|
||||
|
|
@ -3659,7 +3662,13 @@ radv_flush_force_vrs_state(struct radv_cmd_buffer *cmd_buffer)
|
|||
break;
|
||||
}
|
||||
|
||||
radeon_set_sh_reg(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, vrs_rates);
|
||||
if (cmd_buffer->state.last_vrs_rates != vrs_rates ||
|
||||
cmd_buffer->state.last_vrs_rates_sgpr_idx != loc->sgpr_idx) {
|
||||
radeon_set_sh_reg(cmd_buffer->cs, base_reg + loc->sgpr_idx * 4, vrs_rates);
|
||||
}
|
||||
|
||||
cmd_buffer->state.last_vrs_rates = vrs_rates;
|
||||
cmd_buffer->state.last_vrs_rates_sgpr_idx = loc->sgpr_idx;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4571,6 +4580,8 @@ radv_BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBegi
|
|||
cmd_buffer->state.last_nggc_settings = -1;
|
||||
cmd_buffer->state.last_nggc_settings_sgpr_idx = -1;
|
||||
cmd_buffer->state.mesh_shading = false;
|
||||
cmd_buffer->state.last_vrs_rates = -1;
|
||||
cmd_buffer->state.last_vrs_rates_sgpr_idx = -1;
|
||||
cmd_buffer->usage_flags = pBeginInfo->flags;
|
||||
|
||||
if (cmd_buffer->vk.level == VK_COMMAND_BUFFER_LEVEL_SECONDARY &&
|
||||
|
|
@ -5707,6 +5718,9 @@ radv_CmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCou
|
|||
primary->state.last_nggc_settings = secondary->state.last_nggc_settings;
|
||||
primary->state.last_nggc_settings_sgpr_idx = secondary->state.last_nggc_settings_sgpr_idx;
|
||||
primary->state.last_nggc_skip = secondary->state.last_nggc_skip;
|
||||
|
||||
primary->state.last_vrs_rates = secondary->state.last_vrs_rates;
|
||||
primary->state.last_vrs_rates_sgpr_idx = secondary->state.last_vrs_rates_sgpr_idx;
|
||||
}
|
||||
|
||||
/* After executing commands from secondary buffers we have to dirty
|
||||
|
|
|
|||
|
|
@ -1469,6 +1469,10 @@ struct radv_cmd_state {
|
|||
|
||||
/* Whether the cmdbuffer owns the current render pass rather than the app. */
|
||||
bool own_render_pass;
|
||||
|
||||
/* Per-vertex VRS state. */
|
||||
uint32_t last_vrs_rates;
|
||||
int8_t last_vrs_rates_sgpr_idx;
|
||||
};
|
||||
|
||||
struct radv_cmd_pool {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue