pvr: Finish pvr_perform_start_of_render_attachment_clear().
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21550>
This commit is contained in:
@@ -1631,7 +1631,8 @@ static VkResult pvr_clear_color_attachment_static(
|
||||
*/
|
||||
static VkResult pvr_add_deferred_rta_clear(struct pvr_cmd_buffer *cmd_buffer,
|
||||
const VkClearAttachment *attachment,
|
||||
const VkClearRect *rect)
|
||||
const VkClearRect *rect,
|
||||
bool is_render_init)
|
||||
{
|
||||
struct pvr_render_pass_info *pass_info = &cmd_buffer->state.render_pass_info;
|
||||
struct pvr_sub_cmd_gfx *sub_cmd = &cmd_buffer->state.current_sub_cmd->gfx;
|
||||
@@ -1678,6 +1679,13 @@ static VkResult pvr_add_deferred_rta_clear(struct pvr_cmd_buffer *cmd_buffer,
|
||||
(VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));
|
||||
|
||||
image_view = pass_info->attachments[hw_render->ds_attach_idx];
|
||||
} else if (is_render_init) {
|
||||
uint32_t index;
|
||||
|
||||
assert(attachment->colorAttachment < hw_render->color_init_count);
|
||||
index = hw_render->color_init[attachment->colorAttachment].index;
|
||||
|
||||
image_view = pass_info->attachments[index];
|
||||
} else {
|
||||
const struct pvr_renderpass_hwsetup_subpass *hw_pass =
|
||||
pvr_get_hw_subpass(pass_info->pass, pass_info->subpass_idx);
|
||||
@@ -1745,7 +1753,8 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
|
||||
uint32_t attachment_count,
|
||||
const VkClearAttachment *attachments,
|
||||
uint32_t rect_count,
|
||||
const VkClearRect *rects)
|
||||
const VkClearRect *rects,
|
||||
bool is_render_init)
|
||||
{
|
||||
const struct pvr_render_pass *pass = cmd_buffer->state.render_pass_info.pass;
|
||||
struct pvr_render_pass_info *pass_info = &cmd_buffer->state.render_pass_info;
|
||||
@@ -1794,11 +1803,26 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
|
||||
VkFormat format;
|
||||
|
||||
local_attachment_idx = attachment->colorAttachment;
|
||||
mrt_resource = &hw_pass->setup.mrt_resources[local_attachment_idx];
|
||||
|
||||
assert(local_attachment_idx < sub_pass->color_count);
|
||||
global_attachment_idx =
|
||||
sub_pass->color_attachments[local_attachment_idx];
|
||||
if (is_render_init) {
|
||||
struct pvr_renderpass_hwsetup_render *hw_render;
|
||||
|
||||
assert(pass->hw_setup->render_count > 0);
|
||||
hw_render = &pass->hw_setup->renders[0];
|
||||
|
||||
mrt_resource =
|
||||
&hw_render->init_setup.mrt_resources[local_attachment_idx];
|
||||
|
||||
assert(local_attachment_idx < hw_render->color_init_count);
|
||||
global_attachment_idx =
|
||||
hw_render->color_init[local_attachment_idx].index;
|
||||
} else {
|
||||
mrt_resource = &hw_pass->setup.mrt_resources[local_attachment_idx];
|
||||
|
||||
assert(local_attachment_idx < sub_pass->color_count);
|
||||
global_attachment_idx =
|
||||
sub_pass->color_attachments[local_attachment_idx];
|
||||
}
|
||||
|
||||
if (global_attachment_idx == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
@@ -1932,8 +1956,10 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
|
||||
|
||||
if (!PVR_HAS_FEATURE(dev_info, gs_rta_support) &&
|
||||
(clear_rect->baseArrayLayer != 0 || clear_rect->layerCount > 1)) {
|
||||
result =
|
||||
pvr_add_deferred_rta_clear(cmd_buffer, attachment, clear_rect);
|
||||
result = pvr_add_deferred_rta_clear(cmd_buffer,
|
||||
attachment,
|
||||
clear_rect,
|
||||
is_render_init);
|
||||
if (result != VK_SUCCESS)
|
||||
return;
|
||||
|
||||
@@ -2022,6 +2048,13 @@ static void pvr_clear_attachments(struct pvr_cmd_buffer *cmd_buffer,
|
||||
}
|
||||
}
|
||||
|
||||
void pvr_clear_attachments_render_init(struct pvr_cmd_buffer *cmd_buffer,
|
||||
const VkClearAttachment *attachment,
|
||||
const VkClearRect *rect)
|
||||
{
|
||||
pvr_clear_attachments(cmd_buffer, 1, attachment, 1, rect, true);
|
||||
}
|
||||
|
||||
void pvr_CmdClearAttachments(VkCommandBuffer commandBuffer,
|
||||
uint32_t attachmentCount,
|
||||
const VkClearAttachment *pAttachments,
|
||||
@@ -2095,7 +2128,8 @@ void pvr_CmdClearAttachments(VkCommandBuffer commandBuffer,
|
||||
attachmentCount,
|
||||
pAttachments,
|
||||
rectCount,
|
||||
pRects);
|
||||
pRects,
|
||||
false);
|
||||
}
|
||||
|
||||
void pvr_CmdResolveImage2KHR(VkCommandBuffer commandBuffer,
|
||||
|
||||
@@ -184,4 +184,10 @@ VkResult pvr_clear_vertices_upload(struct pvr_device *device,
|
||||
float depth,
|
||||
struct pvr_bo **const pvr_bo_out);
|
||||
|
||||
/* TODO: Create pvr_blit.h, rename this, and move it there? */
|
||||
/* This is provided by pvr_blit.c instead of the usual pvr_clear.c . */
|
||||
void pvr_clear_attachments_render_init(struct pvr_cmd_buffer *cmd_buffer,
|
||||
const VkClearAttachment *attachment,
|
||||
const VkClearRect *rect);
|
||||
|
||||
#endif /* PVR_CLEAR_H */
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "hwdef/rogue_hw_defs.h"
|
||||
#include "hwdef/rogue_hw_utils.h"
|
||||
#include "pvr_bo.h"
|
||||
#include "pvr_clear.h"
|
||||
#include "pvr_common.h"
|
||||
#include "pvr_csb.h"
|
||||
#include "pvr_csb_enum_helpers.h"
|
||||
@@ -2464,11 +2465,15 @@ static void pvr_perform_start_of_render_attachment_clear(
|
||||
bool is_depth_stencil,
|
||||
uint32_t *index_list_clear_mask)
|
||||
{
|
||||
ASSERTED static const VkImageAspectFlags dsc_aspect_flags =
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT |
|
||||
VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
struct pvr_render_pass_info *info = &cmd_buffer->state.render_pass_info;
|
||||
const struct pvr_render_pass *pass = info->pass;
|
||||
const struct pvr_renderpass_hwsetup *hw_setup = pass->hw_setup;
|
||||
const struct pvr_renderpass_hwsetup_render *hw_render =
|
||||
&hw_setup->renders[hw_setup->subpass_map[info->subpass_idx].render];
|
||||
VkImageAspectFlags image_aspect;
|
||||
struct pvr_image_view *iview;
|
||||
uint32_t view_idx;
|
||||
uint32_t height;
|
||||
@@ -2519,7 +2524,37 @@ static void pvr_perform_start_of_render_attachment_clear(
|
||||
return;
|
||||
}
|
||||
|
||||
pvr_finishme("Unimplemented path!");
|
||||
image_aspect = vk_format_aspects(pass->attachments[view_idx].vk_format);
|
||||
assert((image_aspect & ~dsc_aspect_flags) == 0);
|
||||
|
||||
if (image_aspect & VK_IMAGE_ASPECT_DEPTH_BIT &&
|
||||
hw_render->depth_init != VK_ATTACHMENT_LOAD_OP_CLEAR) {
|
||||
image_aspect &= ~VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
}
|
||||
|
||||
if (image_aspect & VK_IMAGE_ASPECT_STENCIL_BIT &&
|
||||
hw_render->stencil_init != VK_ATTACHMENT_LOAD_OP_CLEAR) {
|
||||
image_aspect &= ~VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
}
|
||||
|
||||
if (image_aspect != VK_IMAGE_ASPECT_NONE) {
|
||||
VkClearAttachment clear_attachment = {
|
||||
.aspectMask = image_aspect,
|
||||
.colorAttachment = index,
|
||||
.clearValue = info->clear_values[view_idx],
|
||||
};
|
||||
VkClearRect rect = {
|
||||
.rect = info->render_area,
|
||||
.baseArrayLayer = 0,
|
||||
.layerCount = info->framebuffer->layers,
|
||||
};
|
||||
|
||||
assert(view_idx < info->clear_value_count);
|
||||
|
||||
pvr_clear_attachments_render_init(cmd_buffer, &clear_attachment, &rect);
|
||||
|
||||
*index_list_clear_mask |= (1 << index);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -630,11 +630,6 @@ struct pvr_render_pass_info {
|
||||
bool process_empty_tiles;
|
||||
bool enable_bg_tag;
|
||||
uint32_t isp_userpass;
|
||||
|
||||
/* Have we had to scissor a depth/stencil clear because render area was not
|
||||
* tile aligned?
|
||||
*/
|
||||
bool scissor_ds_clear;
|
||||
};
|
||||
|
||||
struct pvr_ppp_state {
|
||||
|
||||
Reference in New Issue
Block a user