pvr: Replace pvr_renderpass_surface_initop with VkAttachmentLoadOp.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18707>
This commit is contained in:
Rajnesh Kanwal
2022-08-02 13:52:03 +01:00
parent 9f9a1ab118
commit b57cd62698
4 changed files with 24 additions and 30 deletions
+8 -10
View File
@@ -591,8 +591,8 @@ pvr_load_op_constants_create_and_upload(struct pvr_cmd_buffer *cmd_buffer,
assert(load_op->is_hw_object);
assert(hw_render->color_init_count == 1);
/* FIXME: add support for RENDERPASS_SURFACE_INITOP_LOAD. */
assert(color_init->op == RENDERPASS_SURFACE_INITOP_CLEAR);
/* FIXME: add support for VK_ATTACHMENT_LOAD_OP_LOAD. */
assert(color_init->op == VK_ATTACHMENT_LOAD_OP_CLEAR);
/* FIXME: do this at the point we store the clear values? */
hw_clear_value = pvr_get_hw_clear_color(attachment->vk_format, clear_value);
@@ -2300,9 +2300,8 @@ static void pvr_perform_start_of_render_attachment_clear(
is_depth = vk_format_has_depth(pass->attachments[view_idx].vk_format);
is_stencil = vk_format_has_stencil(pass->attachments[view_idx].vk_format);
depth_clear = hw_render->depth_init == RENDERPASS_SURFACE_INITOP_CLEAR;
stencil_clear = hw_render->stencil_init ==
RENDERPASS_SURFACE_INITOP_CLEAR;
depth_clear = hw_render->depth_init == VK_ATTACHMENT_LOAD_OP_CLEAR;
stencil_clear = hw_render->stencil_init == VK_ATTACHMENT_LOAD_OP_CLEAR;
/* Attempt to clear the ds attachment. Do not erroneously discard an
* attachment that has no depth clear but has a stencil attachment.
@@ -2310,8 +2309,7 @@ static void pvr_perform_start_of_render_attachment_clear(
/* if not (a ∧ c) (b ∧ d) */
if (!((is_depth && depth_clear) || (is_stencil && stencil_clear)))
return;
} else if (hw_render->color_init[index].op !=
RENDERPASS_SURFACE_INITOP_CLEAR) {
} else if (hw_render->color_init[index].op != VK_ATTACHMENT_LOAD_OP_CLEAR) {
return;
} else {
view_idx = hw_render->color_init[index].index;
@@ -2419,13 +2417,13 @@ static bool pvr_loadops_contain_clear(struct pvr_renderpass_hwsetup *hw_setup)
for (uint32_t k = 0; k < hw_render->init_setup.num_render_targets;
k++) {
if (hw_render->color_init[j + k].op ==
RENDERPASS_SURFACE_INITOP_CLEAR) {
VK_ATTACHMENT_LOAD_OP_CLEAR) {
return true;
}
}
}
if (hw_render->depth_init == RENDERPASS_SURFACE_INITOP_CLEAR ||
hw_render->stencil_init == RENDERPASS_SURFACE_INITOP_CLEAR) {
if (hw_render->depth_init == VK_ATTACHMENT_LOAD_OP_CLEAR ||
hw_render->stencil_init == VK_ATTACHMENT_LOAD_OP_CLEAR) {
return true;
}
}
+7 -6
View File
@@ -22,6 +22,7 @@
*/
#include <stdbool.h>
#include <vulkan/vulkan.h>
#include "pvr_hw_pass.h"
#include "pvr_private.h"
@@ -39,13 +40,13 @@ pvr_create_renderpass_hwsetup(struct pvr_device *device,
bool disable_merge)
{
struct pvr_renderpass_hwsetup_eot_surface *eot_surface;
enum pvr_renderpass_surface_initop *color_initops;
struct pvr_renderpass_hwsetup_subpass *subpasses;
struct pvr_renderpass_hwsetup_render *renders;
struct pvr_renderpass_colorinit *color_inits;
struct pvr_renderpass_hwsetup *hw_setup;
struct pvr_renderpass_hw_map *subpass_map;
struct usc_mrt_resource *mrt_resources;
VkAttachmentLoadOp *color_initops;
VK_MULTIALLOC(ma);
vk_multialloc_add(&ma, &hw_setup, __typeof__(*hw_setup), 1);
@@ -69,11 +70,11 @@ pvr_create_renderpass_hwsetup(struct pvr_device *device,
/* FIXME: Remove hardcoding of hw_setup structure. */
subpasses[0].z_replicate = -1;
subpasses[0].depth_initop = RENDERPASS_SURFACE_INITOP_CLEAR;
subpasses[0].depth_initop = VK_ATTACHMENT_LOAD_OP_CLEAR;
subpasses[0].stencil_clear = false;
subpasses[0].index = 0;
if (pass->subpasses[0].color_count)
color_initops[0] = RENDERPASS_SURFACE_INITOP_NOP;
color_initops[0] = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
subpasses[0].color_initops = color_initops;
subpasses[0].load_op = NULL;
@@ -82,8 +83,8 @@ pvr_create_renderpass_hwsetup(struct pvr_device *device,
renders[0].sample_count = 1;
renders[0].ds_attach_idx = 1;
renders[0].depth_init = RENDERPASS_SURFACE_INITOP_CLEAR;
renders[0].stencil_init = RENDERPASS_SURFACE_INITOP_NOP;
renders[0].depth_init = VK_ATTACHMENT_LOAD_OP_CLEAR;
renders[0].stencil_init = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
mrt_resources[0].type = USC_MRT_RESOURCE_TYPE_OUTPUT_REG;
mrt_resources[0].reg.output_reg = 0;
@@ -91,7 +92,7 @@ pvr_create_renderpass_hwsetup(struct pvr_device *device,
renders[0].init_setup.num_render_targets = 1;
renders[0].init_setup.mrt_resources = &mrt_resources[0];
color_inits[0].op = RENDERPASS_SURFACE_INITOP_CLEAR;
color_inits[0].op = VK_ATTACHMENT_LOAD_OP_CLEAR;
color_inits[0].index = 0;
renders[0].color_init_count = 1;
renders[0].color_init = color_inits;
+6 -11
View File
@@ -26,16 +26,11 @@
#include <stdbool.h>
#include <stdint.h>
#include <vulkan/vulkan.h>
struct pvr_device;
struct pvr_render_pass;
enum pvr_renderpass_surface_initop {
RENDERPASS_SURFACE_INITOP_CLEAR,
RENDERPASS_SURFACE_INITOP_LOAD,
RENDERPASS_SURFACE_INITOP_NOP,
};
struct pvr_renderpass_hwsetup_subpass {
/* If >=0 then copy the depth into this pixel output for all fragment
* programs in the subpass.
@@ -45,7 +40,7 @@ struct pvr_renderpass_hwsetup_subpass {
/* The operation to perform on the depth at the start of the subpass. Loads
* are deferred to subpasses when depth has been replicated
*/
enum pvr_renderpass_surface_initop depth_initop;
VkAttachmentLoadOp depth_initop;
/* If true then clear the stencil at the start of the subpass. */
bool stencil_clear;
@@ -56,7 +51,7 @@ struct pvr_renderpass_hwsetup_subpass {
/* For each color attachment to the subpass: the operation to perform at
* the start of the subpass.
*/
enum pvr_renderpass_surface_initop *color_initops;
VkAttachmentLoadOp *color_initops;
struct pvr_load_op *load_op;
};
@@ -66,7 +61,7 @@ struct pvr_renderpass_colorinit {
uint32_t index;
/* Type of operation: either clear or load. */
enum pvr_renderpass_surface_initop op;
VkAttachmentLoadOp op;
};
/* FIXME: Adding these USC enums and structures here for now to avoid adding
@@ -170,10 +165,10 @@ struct pvr_renderpass_hwsetup_render {
* Either load from 'ds_surface_id', clear using 'ds_surface_id' or leave
* uninitialized.
*/
enum pvr_renderpass_surface_initop depth_init;
VkAttachmentLoadOp depth_init;
/* Operation on the on-chip stencil at the start of the render. */
enum pvr_renderpass_surface_initop stencil_init;
VkAttachmentLoadOp stencil_init;
/* For each operation: the destination in the on-chip color storage. */
struct usc_mrt_setup init_setup;
+3 -3
View File
@@ -88,7 +88,7 @@ static bool pvr_is_subpass_initops_flush_needed(
uint32_t color_attachment_mask;
for (uint32_t i = 0; i < hw_render->color_init_count; i++) {
if (hw_render->color_init[i].op != RENDERPASS_SURFACE_INITOP_NOP)
if (hw_render->color_init[i].op != VK_ATTACHMENT_LOAD_OP_DONT_CARE)
render_loadop_mask |= (1 << hw_render->color_init[i].index);
}
@@ -226,9 +226,9 @@ pvr_load_op_create(struct pvr_device *device,
for (uint32_t i = 0; i < hw_render->color_init_count; i++) {
struct pvr_renderpass_colorinit *color_init = &hw_render->color_init[i];
if (color_init->op == RENDERPASS_SURFACE_INITOP_CLEAR)
if (color_init->op == VK_ATTACHMENT_LOAD_OP_CLEAR)
load_op->clear_mask |= 1U << i;
else if (color_init->op == RENDERPASS_SURFACE_INITOP_LOAD)
else if (color_init->op == VK_ATTACHMENT_LOAD_OP_LOAD)
pvr_finishme("Missing 'load' load op");
}