mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
turnip: MSAA resolve directly from GMEM
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
abaaf0b2e7
commit
1576ff5fbb
3 changed files with 32 additions and 50 deletions
|
|
@ -814,11 +814,29 @@ tu6_emit_tile_load(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
tu6_emit_tile_load_attachment(cmd, cs, a, subpass->color_count);
|
||||
}
|
||||
|
||||
static void
|
||||
tu6_emit_store_attachment(struct tu_cmd_buffer *cmd,
|
||||
struct tu_cs *cs,
|
||||
uint32_t a,
|
||||
uint32_t gmem_index)
|
||||
{
|
||||
const struct tu_framebuffer *fb = cmd->state.framebuffer;
|
||||
const struct tu_tiling_config *tiling = &cmd->state.tiling_config;
|
||||
|
||||
if (a == VK_ATTACHMENT_UNUSED)
|
||||
return;
|
||||
|
||||
tu6_emit_blit_info(cmd, cs, fb->attachments[a].attachment,
|
||||
tiling->gmem_offsets[gmem_index], 0);
|
||||
tu6_emit_blit(cmd, cs);
|
||||
}
|
||||
|
||||
static void
|
||||
tu6_emit_tile_store(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
||||
{
|
||||
const struct tu_framebuffer *fb = cmd->state.framebuffer;
|
||||
const struct tu_tiling_config *tiling = &cmd->state.tiling_config;
|
||||
const struct tu_subpass *subpass = cmd->state.subpass;
|
||||
|
||||
if (false) {
|
||||
/* hw binning? */
|
||||
|
|
@ -841,24 +859,20 @@ tu6_emit_tile_store(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
|
||||
tu6_emit_blit_scissor(cmd, cs);
|
||||
|
||||
for (uint32_t i = 0; i < cmd->state.subpass->color_count; ++i) {
|
||||
uint32_t a = cmd->state.subpass->color_attachments[i].attachment;
|
||||
if (a == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
const struct tu_image_view *iview = fb->attachments[a].attachment;
|
||||
tu6_emit_blit_info(cmd, cs, iview, tiling->gmem_offsets[i], 0);
|
||||
tu6_emit_blit(cmd, cs);
|
||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||
tu6_emit_store_attachment(cmd, cs,
|
||||
subpass->color_attachments[i].attachment,
|
||||
i);
|
||||
if (subpass->resolve_attachments) {
|
||||
tu6_emit_store_attachment(cmd, cs,
|
||||
subpass->resolve_attachments[i].attachment,
|
||||
i);
|
||||
}
|
||||
}
|
||||
|
||||
const uint32_t a = cmd->state.subpass->depth_stencil_attachment.attachment;
|
||||
if (a != VK_ATTACHMENT_UNUSED) {
|
||||
const struct tu_image_view *iview = fb->attachments[a].attachment;
|
||||
tu6_emit_blit_info(cmd, cs, iview,
|
||||
tiling->gmem_offsets[cmd->state.subpass->color_count],
|
||||
0);
|
||||
tu6_emit_blit(cmd, cs);
|
||||
}
|
||||
tu6_emit_store_attachment(cmd, cs,
|
||||
subpass->depth_stencil_attachment.attachment,
|
||||
subpass->color_count);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1120,31 +1134,6 @@ tu6_render_end(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
|||
|
||||
tu6_emit_event_write(cmd, cs, CACHE_FLUSH_TS, true);
|
||||
|
||||
if (subpass->has_resolve) {
|
||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||
struct tu_subpass_attachment src_att = subpass->color_attachments[i];
|
||||
struct tu_subpass_attachment dst_att = subpass->resolve_attachments[i];
|
||||
|
||||
if (dst_att.attachment == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
struct tu_image *src_img = fb->attachments[src_att.attachment].attachment->image;
|
||||
struct tu_image *dst_img = fb->attachments[dst_att.attachment].attachment->image;
|
||||
|
||||
assert(src_img->extent.width == dst_img->extent.width);
|
||||
assert(src_img->extent.height == dst_img->extent.height);
|
||||
|
||||
tu_bo_list_add(&cmd->bo_list, src_img->bo, MSM_SUBMIT_BO_READ);
|
||||
tu_bo_list_add(&cmd->bo_list, dst_img->bo, MSM_SUBMIT_BO_WRITE);
|
||||
|
||||
tu_blit(cmd, &(struct tu_blit) {
|
||||
.dst = tu_blit_surf_whole(dst_img, 0, 0),
|
||||
.src = tu_blit_surf_whole(src_img, 0, 0),
|
||||
.layers = 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
tu_cs_sanity_check(cs);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,9 +150,8 @@ tu_CreateRenderPass(VkDevice _device,
|
|||
}
|
||||
}
|
||||
|
||||
subpass->has_resolve = false;
|
||||
subpass->resolve_attachments = desc->pResolveAttachments ? p : NULL;
|
||||
if (desc->pResolveAttachments) {
|
||||
subpass->resolve_attachments = p;
|
||||
p += desc->colorAttachmentCount;
|
||||
|
||||
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
||||
|
|
@ -162,7 +161,6 @@ tu_CreateRenderPass(VkDevice _device,
|
|||
.layout = desc->pResolveAttachments[j].layout,
|
||||
};
|
||||
if (a != VK_ATTACHMENT_UNUSED) {
|
||||
subpass->has_resolve = true;
|
||||
pass->attachments[desc->pResolveAttachments[j].attachment]
|
||||
.view_mask |= subpass->view_mask;
|
||||
}
|
||||
|
|
@ -325,9 +323,8 @@ tu_CreateRenderPass2KHR(VkDevice _device,
|
|||
}
|
||||
}
|
||||
|
||||
subpass->has_resolve = false;
|
||||
subpass->resolve_attachments = desc->pResolveAttachments ? p : NULL;
|
||||
if (desc->pResolveAttachments) {
|
||||
subpass->resolve_attachments = p;
|
||||
p += desc->colorAttachmentCount;
|
||||
|
||||
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
||||
|
|
@ -337,7 +334,6 @@ tu_CreateRenderPass2KHR(VkDevice _device,
|
|||
.layout = desc->pResolveAttachments[j].layout,
|
||||
};
|
||||
if (a != VK_ATTACHMENT_UNUSED) {
|
||||
subpass->has_resolve = true;
|
||||
pass->attachments[desc->pResolveAttachments[j].attachment]
|
||||
.view_mask |= subpass->view_mask;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1485,9 +1485,6 @@ struct tu_subpass
|
|||
struct tu_subpass_attachment *resolve_attachments;
|
||||
struct tu_subpass_attachment depth_stencil_attachment;
|
||||
|
||||
/** Subpass has at least one resolve attachment */
|
||||
bool has_resolve;
|
||||
|
||||
struct tu_subpass_barrier start_barrier;
|
||||
|
||||
uint32_t view_mask;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue