mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
turnip: correctly disable draw states outside of renderpasses
* do the disable in EndRenderPass2 to fix the missing disable for sysmem * we don't need a disable at the end of every tile, or between binning pass and gmem pass (the first draw in draw_cs emits all the draw states) Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>
This commit is contained in:
parent
af6e74bca8
commit
3f58d80823
1 changed files with 37 additions and 20 deletions
|
|
@ -676,13 +676,6 @@ tu6_emit_tile_store(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
const struct tu_render_pass *pass = cmd->state.pass;
|
||||
const struct tu_subpass *subpass = &pass->subpasses[pass->subpass_count-1];
|
||||
|
||||
tu_cs_emit_pkt7(cs, CP_SET_DRAW_STATE, 3);
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__0_COUNT(0) |
|
||||
CP_SET_DRAW_STATE__0_DISABLE_ALL_GROUPS |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__1_ADDR_LO(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__2_ADDR_HI(0));
|
||||
|
||||
tu_cs_emit_pkt7(cs, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
|
||||
tu_cs_emit(cs, 0x0);
|
||||
|
||||
|
|
@ -707,6 +700,19 @@ tu6_emit_tile_store(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tu_disable_draw_states(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
||||
{
|
||||
tu_cs_emit_pkt7(cs, CP_SET_DRAW_STATE, 3);
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__0_COUNT(0) |
|
||||
CP_SET_DRAW_STATE__0_DISABLE_ALL_GROUPS |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__1_ADDR_LO(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__2_ADDR_HI(0));
|
||||
|
||||
cmd->state.dirty |= TU_CMD_DIRTY_DRAW_STATE;
|
||||
}
|
||||
|
||||
static void
|
||||
tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
||||
{
|
||||
|
|
@ -799,13 +805,7 @@ tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
|
||||
tu_cs_emit_regs(cs, A6XX_RB_ALPHA_CONTROL());
|
||||
|
||||
/* we don't use this yet.. probably best to disable.. */
|
||||
tu_cs_emit_pkt7(cs, CP_SET_DRAW_STATE, 3);
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__0_COUNT(0) |
|
||||
CP_SET_DRAW_STATE__0_DISABLE_ALL_GROUPS |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__1_ADDR_LO(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__2_ADDR_HI(0));
|
||||
tu_disable_draw_states(cmd, cs);
|
||||
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_SP_TP_BORDER_COLOR_BASE_ADDR(.bo = &dev->global_bo,
|
||||
|
|
@ -955,10 +955,22 @@ tu6_emit_binning_pass(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
/* emit IB to binning drawcmds: */
|
||||
tu_cs_emit_call(cs, &cmd->draw_cs);
|
||||
|
||||
tu_cs_emit_pkt7(cs, CP_SET_DRAW_STATE, 3);
|
||||
/* switching from binning pass to GMEM pass will cause a switch from
|
||||
* PROGRAM_BINNING to PROGRAM, which invalidates const state (XS_CONST states)
|
||||
* so make sure these states are re-emitted
|
||||
* (eventually these states shouldn't exist at all with shader prologue)
|
||||
* only VS and GS are invalidated, as FS isn't emitted in binning pass,
|
||||
* and we don't use HW binning when tesselation is used
|
||||
*/
|
||||
tu_cs_emit_pkt7(cs, CP_SET_DRAW_STATE, 6);
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__0_COUNT(0) |
|
||||
CP_SET_DRAW_STATE__0_DISABLE_ALL_GROUPS |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(0));
|
||||
CP_SET_DRAW_STATE__0_DISABLE |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(TU_DRAW_STATE_VS_CONST));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__1_ADDR_LO(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__2_ADDR_HI(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__0_COUNT(0) |
|
||||
CP_SET_DRAW_STATE__0_DISABLE |
|
||||
CP_SET_DRAW_STATE__0_GROUP_ID(TU_DRAW_STATE_GS_CONST));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__1_ADDR_LO(0));
|
||||
tu_cs_emit(cs, CP_SET_DRAW_STATE__2_ADDR_HI(0));
|
||||
|
||||
|
|
@ -1311,7 +1323,7 @@ tu_cmd_render_sysmem(struct tu_cmd_buffer *cmd)
|
|||
static void
|
||||
tu_cmd_prepare_tile_store_ib(struct tu_cmd_buffer *cmd)
|
||||
{
|
||||
const uint32_t tile_store_space = 11 + (35 * 2) * cmd->state.pass->attachment_count;
|
||||
const uint32_t tile_store_space = 7 + (35 * 2) * cmd->state.pass->attachment_count;
|
||||
struct tu_cs sub_cs;
|
||||
|
||||
VkResult result =
|
||||
|
|
@ -2940,8 +2952,6 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
|||
tu6_emit_render_cntl(cmd, cmd->state.subpass, &cmd->draw_cs, false);
|
||||
|
||||
tu_set_input_attachments(cmd, cmd->state.subpass);
|
||||
|
||||
cmd->state.dirty |= TU_CMD_DIRTY_DRAW_STATE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -3927,6 +3937,13 @@ tu_CmdEndRenderPass2(VkCommandBuffer commandBuffer,
|
|||
else
|
||||
tu_cmd_render_tiles(cmd_buffer);
|
||||
|
||||
/* outside of renderpasses we assume all draw states are disabled
|
||||
* we can do this in the main cs because no resolve/store commands
|
||||
* should use a draw command (TODO: this will change if unaligned
|
||||
* GMEM stores are supported)
|
||||
*/
|
||||
tu_disable_draw_states(cmd_buffer, &cmd_buffer->cs);
|
||||
|
||||
/* discard draw_cs and draw_epilogue_cs entries now that the tiles are
|
||||
rendered */
|
||||
tu_cs_discard_entries(&cmd_buffer->draw_cs);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue