turnip: add LRZ tracking to command buffer state
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
This commit is contained in:
parent
fdad1ca256
commit
517b26bdd1
|
@ -2076,7 +2076,7 @@ tu_CmdBindPipeline(VkCommandBuffer commandBuffer,
|
||||||
assert(pipelineBindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS);
|
assert(pipelineBindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS);
|
||||||
|
|
||||||
cmd->state.pipeline = pipeline;
|
cmd->state.pipeline = pipeline;
|
||||||
cmd->state.dirty |= TU_CMD_DIRTY_DESC_SETS_LOAD | TU_CMD_DIRTY_SHADER_CONSTS;
|
cmd->state.dirty |= TU_CMD_DIRTY_DESC_SETS_LOAD | TU_CMD_DIRTY_SHADER_CONSTS | TU_CMD_DIRTY_LRZ;
|
||||||
|
|
||||||
struct tu_cs *cs = &cmd->draw_cs;
|
struct tu_cs *cs = &cmd->draw_cs;
|
||||||
uint32_t mask = ~pipeline->dynamic_state_mask & BITFIELD_MASK(TU_DYNAMIC_STATE_COUNT);
|
uint32_t mask = ~pipeline->dynamic_state_mask & BITFIELD_MASK(TU_DYNAMIC_STATE_COUNT);
|
||||||
|
@ -2905,6 +2905,22 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
||||||
cmd->state.cache.pending_flush_bits;
|
cmd->state.cache.pending_flush_bits;
|
||||||
cmd->state.renderpass_cache.flush_bits = 0;
|
cmd->state.renderpass_cache.flush_bits = 0;
|
||||||
|
|
||||||
|
/* Track LRZ valid state */
|
||||||
|
uint32_t a = cmd->state.subpass->depth_stencil_attachment.attachment;
|
||||||
|
if (a != VK_ATTACHMENT_UNUSED) {
|
||||||
|
const struct tu_render_pass_attachment *att = &cmd->state.pass->attachments[a];
|
||||||
|
struct tu_image *image = fb->attachments[a].attachment->image;
|
||||||
|
/* if image as lrz and it isn't a stencil-only clear: */
|
||||||
|
if (image->lrz_height &&
|
||||||
|
(att->clear_mask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT))) {
|
||||||
|
cmd->state.lrz.image = image;
|
||||||
|
cmd->state.lrz.valid = true;
|
||||||
|
} else {
|
||||||
|
cmd->state.lrz.valid = false;
|
||||||
|
}
|
||||||
|
cmd->state.dirty |= TU_CMD_DIRTY_LRZ;
|
||||||
|
}
|
||||||
|
|
||||||
tu_emit_renderpass_begin(cmd, pRenderPassBegin);
|
tu_emit_renderpass_begin(cmd, pRenderPassBegin);
|
||||||
|
|
||||||
tu6_emit_zs(cmd, cmd->state.subpass, &cmd->draw_cs);
|
tu6_emit_zs(cmd, cmd->state.subpass, &cmd->draw_cs);
|
||||||
|
@ -2928,6 +2944,14 @@ tu_CmdNextSubpass2(VkCommandBuffer commandBuffer,
|
||||||
|
|
||||||
const struct tu_subpass *subpass = cmd->state.subpass++;
|
const struct tu_subpass *subpass = cmd->state.subpass++;
|
||||||
|
|
||||||
|
/* Track LRZ valid state
|
||||||
|
*
|
||||||
|
* TODO: Improve this tracking for keeping the state of the past depth/stencil images,
|
||||||
|
* so if they become active again, we reuse its old state.
|
||||||
|
*/
|
||||||
|
cmd->state.lrz.valid = false;
|
||||||
|
cmd->state.dirty |= TU_CMD_DIRTY_LRZ;
|
||||||
|
|
||||||
tu_cond_exec_start(cs, CP_COND_EXEC_0_RENDER_MODE_GMEM);
|
tu_cond_exec_start(cs, CP_COND_EXEC_0_RENDER_MODE_GMEM);
|
||||||
|
|
||||||
if (subpass->resolve_attachments) {
|
if (subpass->resolve_attachments) {
|
||||||
|
@ -3853,6 +3877,10 @@ tu_CmdEndRenderPass2(VkCommandBuffer commandBuffer,
|
||||||
cmd_buffer->state.framebuffer = NULL;
|
cmd_buffer->state.framebuffer = NULL;
|
||||||
cmd_buffer->state.has_tess = false;
|
cmd_buffer->state.has_tess = false;
|
||||||
cmd_buffer->state.has_subpass_predication = false;
|
cmd_buffer->state.has_subpass_predication = false;
|
||||||
|
|
||||||
|
/* LRZ is not valid next time we use it */
|
||||||
|
cmd_buffer->state.lrz.valid = false;
|
||||||
|
cmd_buffer->state.dirty |= TU_CMD_DIRTY_LRZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tu_barrier_info
|
struct tu_barrier_info
|
||||||
|
|
|
@ -682,10 +682,9 @@ enum tu_cmd_dirty_bits
|
||||||
TU_CMD_DIRTY_DESC_SETS_LOAD = BIT(5),
|
TU_CMD_DIRTY_DESC_SETS_LOAD = BIT(5),
|
||||||
TU_CMD_DIRTY_COMPUTE_DESC_SETS_LOAD = BIT(6),
|
TU_CMD_DIRTY_COMPUTE_DESC_SETS_LOAD = BIT(6),
|
||||||
TU_CMD_DIRTY_SHADER_CONSTS = BIT(7),
|
TU_CMD_DIRTY_SHADER_CONSTS = BIT(7),
|
||||||
|
TU_CMD_DIRTY_LRZ = BIT(8),
|
||||||
/* all draw states were disabled and need to be re-enabled: */
|
/* all draw states were disabled and need to be re-enabled: */
|
||||||
TU_CMD_DIRTY_DRAW_STATE = BIT(8)
|
TU_CMD_DIRTY_DRAW_STATE = BIT(9)
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* There are only three cache domains we have to care about: the CCU, or
|
/* There are only three cache domains we have to care about: the CCU, or
|
||||||
|
@ -848,6 +847,13 @@ struct tu_lrz_pipeline
|
||||||
bool blend_disable_write : 1;
|
bool blend_disable_write : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct tu_lrz_state
|
||||||
|
{
|
||||||
|
/* Depth/Stencil image currently on use to do LRZ */
|
||||||
|
struct tu_image *image;
|
||||||
|
bool valid : 1;
|
||||||
|
};
|
||||||
|
|
||||||
struct tu_cmd_state
|
struct tu_cmd_state
|
||||||
{
|
{
|
||||||
uint32_t dirty;
|
uint32_t dirty;
|
||||||
|
@ -917,6 +923,8 @@ struct tu_cmd_state
|
||||||
bool has_tess;
|
bool has_tess;
|
||||||
bool has_subpass_predication;
|
bool has_subpass_predication;
|
||||||
bool predication_active;
|
bool predication_active;
|
||||||
|
|
||||||
|
struct tu_lrz_state lrz;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tu_cmd_pool
|
struct tu_cmd_pool
|
||||||
|
|
Loading…
Reference in New Issue