tu: Re-emit viewports/scissors when has_fdm changes

This shouldn't matter if FDM is actually enabled, because in that case
the pipeline must enable the bit and we dirty FDM state at the
beginning, but pipelines can enable FDM even if the renderpass they're
used in doesn't use FDM and in that case we still need to use the FDM
path to duplicate the viewports. Fix the case where a different pipeline
is bound that enables FDM without actually using FDM.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35581>
This commit is contained in:
Connor Abbott
2025-03-25 10:48:41 -04:00
committed by Marge Bot
parent 0017b9e8ed
commit 60843bc806
3 changed files with 9 additions and 1 deletions
+7
View File
@@ -4397,6 +4397,13 @@ tu_CmdBindPipeline(VkCommandBuffer commandBuffer,
u_foreach_bit(i, pipeline->set_state_mask)
cmd->state.dynamic_state[i] = pipeline->dynamic_state[i];
if (pipeline->shaders[MESA_SHADER_FRAGMENT]->fs.has_fdm !=
cmd->state.has_fdm) {
cmd->state.dirty |= TU_CMD_DIRTY_FDM;
cmd->state.has_fdm =
pipeline->shaders[MESA_SHADER_FRAGMENT]->fs.has_fdm;
}
if (pipeline->program.per_view_viewport != cmd->state.per_view_viewport) {
cmd->state.per_view_viewport = pipeline->program.per_view_viewport;
cmd->state.dirty |= TU_CMD_DIRTY_PER_VIEW_VIEWPORT;
+1
View File
@@ -444,6 +444,7 @@ struct tu_cmd_state
uint32_t max_vbs_bound;
bool has_fdm;
bool per_view_viewport;
/* saved states to re-emit in TU_CMD_DIRTY_DRAW_STATE case */
+1 -1
View File
@@ -3895,7 +3895,7 @@ tu_emit_draw_state(struct tu_cmd_buffer *cmd)
(TU_CMD_DIRTY_FDM | \
TU_CMD_DIRTY_PER_VIEW_VIEWPORT))) && \
!(cmd->state.pipeline_draw_states & (1u << id))) { \
if (cmd->state.shaders[MESA_SHADER_FRAGMENT]->fs.has_fdm) { \
if (cmd->state.has_fdm) { \
tu_cs_set_writeable(&cmd->sub_cs, true); \
tu6_emit_##name##_fdm(&cs, cmd, __VA_ARGS__); \
cmd->state.dynamic_state[id] = \