tu: Remove MSAA draw state
We only need to emit MSAA state once per subpass at most, unless the pipeline switches primitive types or for framebuffer-less subpasses (which always use sysmem anyway). Therefore it seems like draw state skipping isn't going to bring much benefit here, and having it as a draw state in the first place is a remnant of how this used to be part of the pipeline state. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25076>
This commit is contained in:
@@ -718,15 +718,16 @@ tu6_emit_msaa(struct tu_cs *cs, VkSampleCountFlagBits vk_samples,
|
||||
static void
|
||||
tu6_update_msaa(struct tu_cmd_buffer *cmd)
|
||||
{
|
||||
struct tu_cs cs;
|
||||
VkSampleCountFlagBits samples =
|
||||
cmd->vk.dynamic_graphics_state.ms.rasterization_samples;;
|
||||
|
||||
cmd->state.msaa = tu_cs_draw_state(&cmd->sub_cs, &cs, 9);
|
||||
tu6_emit_msaa(&cs, cmd->vk.dynamic_graphics_state.ms.rasterization_samples,
|
||||
cmd->state.msaa_disable);
|
||||
if (!(cmd->state.dirty & TU_CMD_DIRTY_DRAW_STATE)) {
|
||||
tu_cs_emit_pkt7(&cmd->draw_cs, CP_SET_DRAW_STATE, 3);
|
||||
tu_cs_emit_draw_state(&cmd->draw_cs, TU_DRAW_STATE_MSAA, cmd->state.msaa);
|
||||
}
|
||||
/* The samples may not be set by the pipeline or dynamically if raster
|
||||
* discard is enabled. We can set any valid value, but don't set the
|
||||
* default invalid value of 0.
|
||||
*/
|
||||
if (samples == 0)
|
||||
samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
tu6_emit_msaa(&cmd->draw_cs, samples, cmd->state.msaa_disable);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1585,6 +1586,12 @@ tu_emit_renderpass_begin(struct tu_cmd_buffer *cmd)
|
||||
*/
|
||||
if (cmd->state.pass->has_fdm)
|
||||
cmd->state.dirty |= TU_CMD_DIRTY_FDM;
|
||||
|
||||
/* We need to re-emit MSAA at the beginning of every renderpass because it
|
||||
* isn't part of a draw state that gets automatically re-emitted.
|
||||
*/
|
||||
BITSET_SET(cmd->vk.dynamic_graphics_state.dirty,
|
||||
MESA_VK_DYNAMIC_MS_RASTERIZATION_SAMPLES);
|
||||
}
|
||||
|
||||
template <chip CHIP>
|
||||
@@ -4703,7 +4710,6 @@ tu6_draw_common(struct tu_cmd_buffer *cmd,
|
||||
tu_cs_emit_draw_state(cs, TU_DRAW_STATE_VS_PARAMS, cmd->state.vs_params);
|
||||
tu_cs_emit_draw_state(cs, TU_DRAW_STATE_FS_PARAMS, cmd->state.fs_params);
|
||||
tu_cs_emit_draw_state(cs, TU_DRAW_STATE_LRZ_AND_DEPTH_PLANE, cmd->state.lrz_and_depth_plane_state);
|
||||
tu_cs_emit_draw_state(cs, TU_DRAW_STATE_MSAA, cmd->state.msaa);
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(cmd->state.dynamic_state); i++) {
|
||||
tu_cs_emit_draw_state(cs, TU_DRAW_STATE_DYNAMIC + i,
|
||||
|
@@ -35,7 +35,6 @@ enum tu_draw_state_group_id
|
||||
TU_DRAW_STATE_LRZ_AND_DEPTH_PLANE,
|
||||
TU_DRAW_STATE_PRIM_MODE_GMEM,
|
||||
TU_DRAW_STATE_PRIM_MODE_SYSMEM,
|
||||
TU_DRAW_STATE_MSAA,
|
||||
|
||||
/* dynamic state related draw states */
|
||||
TU_DRAW_STATE_DYNAMIC,
|
||||
@@ -409,7 +408,6 @@ struct tu_cmd_state
|
||||
struct tu_draw_state vertex_buffers;
|
||||
struct tu_draw_state shader_const;
|
||||
struct tu_draw_state desc_sets;
|
||||
struct tu_draw_state msaa;
|
||||
|
||||
struct tu_draw_state vs_params;
|
||||
struct tu_draw_state fs_params;
|
||||
|
Reference in New Issue
Block a user