const struct pvr_render_pass_attachment *attachment;
const struct pvr_image_view *image_view;
- assert(*load_op->subpass->depth_stencil_attachment !=
+ assert(load_op->subpass->depth_stencil_attachment !=
VK_ATTACHMENT_UNUSED);
assert(!load_op->is_hw_object);
attachment =
- &pass->attachments[*load_op->subpass->depth_stencil_attachment];
+ &pass->attachments[load_op->subpass->depth_stencil_attachment];
image_view = render_pass_info->attachments[attachment->index];
const struct pvr_render_pass_attachment *attachment;
VkClearValue clear_value;
- assert(*load_op->subpass->depth_stencil_attachment !=
+ assert(load_op->subpass->depth_stencil_attachment !=
VK_ATTACHMENT_UNUSED);
attachment =
- &pass->attachments[*load_op->subpass->depth_stencil_attachment];
+ &pass->attachments[load_op->subpass->depth_stencil_attachment];
clear_value = render_pass_info->clear_values[attachment->index];
const bool rasterizer_discard = dynamic_state->rs.rasterizer_discard_enable;
const uint32_t subpass_idx = pass_info->subpass_idx;
- const uint32_t *depth_stencil_attachment_idx =
+ const uint32_t depth_stencil_attachment_idx =
pass_info->pass->subpasses[subpass_idx].depth_stencil_attachment;
const struct pvr_image_view *const attachment =
- depth_stencil_attachment_idx
- ? pass_info->attachments[*depth_stencil_attachment_idx]
+ depth_stencil_attachment_idx != VK_ATTACHMENT_UNUSED
+ ? pass_info->attachments[depth_stencil_attachment_idx]
: NULL;
const enum PVRX(TA_OBJTYPE)
pvr_get_current_subpass(state);
const uint32_t *const input_attachments = current_subpass->input_attachments;
+ if (current_subpass->depth_stencil_attachment == VK_ATTACHMENT_UNUSED)
+ return false;
+
/* We only need to check the current software subpass as we don't support
* merging to/from a subpass with self-dep stencil.
*/
for (uint32_t i = 0; i < current_subpass->input_count; i++) {
- if (input_attachments[i] == *current_subpass->depth_stencil_attachment)
+ if (input_attachments[i] == current_subpass->depth_stencil_attachment)
return true;
}
hw_subpass->stencil_clear)) {
struct pvr_render_int_attachment *int_ds_attach;
- assert(*input_subpass->depth_stencil_attachment !=
+ assert(input_subpass->depth_stencil_attachment !=
VK_ATTACHMENT_UNUSED);
- assert(*input_subpass->depth_stencil_attachment <
+ assert(input_subpass->depth_stencil_attachment <
ctx->pass->attachment_count);
int_ds_attach =
- &ctx->int_attach[*input_subpass->depth_stencil_attachment];
+ &ctx->int_attach[input_subpass->depth_stencil_attachment];
assert(hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED ||
hw_render->ds_attach_idx == int_ds_attach->attachment->index);
}
}
- if (*input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
+ if (input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
first_ds = false;
for (uint32_t j = 0U; j < input_subpass->color_count; j++) {
uint32_t z_replicate;
bool found = false;
- assert(*input_subpass->depth_stencil_attachment >= 0U &&
- *input_subpass->depth_stencil_attachment <
+ assert(input_subpass->depth_stencil_attachment >= 0U &&
+ input_subpass->depth_stencil_attachment <
(int32_t)ctx->pass->attachment_count);
- int_ds_attach = &ctx->int_attach[*input_subpass->depth_stencil_attachment];
+ int_ds_attach = &ctx->int_attach[input_subpass->depth_stencil_attachment];
assert(hw_subpass->z_replicate == -1);
struct pvr_renderpass_subpass *subpass = &ctx->subpasses[i];
struct pvr_render_subpass *input_subpass = subpass->input_subpass;
- if (*input_subpass->depth_stencil_attachment == replicate_attach_idx) {
+ if (input_subpass->depth_stencil_attachment == replicate_attach_idx) {
first_use = i;
break;
}
struct pvr_render_subpass *input_subpass = subpass->input_subpass;
/* If the subpass writes to the attachment then enable z replication. */
- if (input_subpass->depth_stencil_attachment &&
- *input_subpass->depth_stencil_attachment == replicate_attach_idx &&
+ if (input_subpass->depth_stencil_attachment == replicate_attach_idx &&
!subpass->z_replicate) {
subpass->z_replicate = true;
struct pvr_renderpass_subpass *subpass = &ctx->subpasses[i];
struct pvr_render_subpass *input_subpass = subpass->input_subpass;
- if (*input_subpass->depth_stencil_attachment == (int32_t)attach_idx) {
+ if (input_subpass->depth_stencil_attachment == (int32_t)attach_idx) {
first_use = i;
break;
}
}
if (sp_depth->incoming_ds_is_input) {
- if (sp_depth->existing_ds_attach != *subpass->depth_stencil_attachment) {
+ if (sp_depth->existing_ds_attach != subpass->depth_stencil_attachment) {
result = pvr_is_z_replicate_space_available(
dev_info,
ctx,
alloc,
- *subpass->depth_stencil_attachment,
+ subpass->depth_stencil_attachment,
&sp_dsts->incoming_zrep);
if (result != VK_SUCCESS)
goto err_free_alloc;
bool ret;
/* Depth attachment for the incoming subpass. */
- if (*input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
- int_ds_attach =
- &ctx->int_attach[*input_subpass->depth_stencil_attachment];
- } else {
+ if (input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
+ int_ds_attach = &ctx->int_attach[input_subpass->depth_stencil_attachment];
+ else
int_ds_attach = NULL;
- }
/* Attachment ID for the existing depth attachment. */
if (ctx->int_ds_attach)
/* Is the incoming depth attachment used as an input to the incoming subpass?
*/
sp_depth.incoming_ds_is_input =
- pvr_is_input(input_subpass, *input_subpass->depth_stencil_attachment);
+ pvr_is_input(input_subpass, input_subpass->depth_stencil_attachment);
/* Is the current depth attachment used as an input to the incoming subpass?
*/
}
if (sp_depth.incoming_ds_is_input) {
- if (*input_subpass->depth_stencil_attachment !=
+ if (input_subpass->depth_stencil_attachment !=
sp_depth.existing_ds_attach) {
result =
pvr_enable_z_replicate(ctx,
hw_render,
- *input_subpass->depth_stencil_attachment,
+ input_subpass->depth_stencil_attachment,
&sp_dsts.incoming_zrep);
if (result != VK_SUCCESS)
goto end_merge_subpass;
subpass_num,
subpass->input_attachments,
subpass->input_count);
- if (*subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
+ if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
struct pvr_render_int_attachment *int_depth_attach =
- &ctx->int_attach[*subpass->depth_stencil_attachment];
+ &ctx->int_attach[subpass->depth_stencil_attachment];
assert(int_depth_attach->remaining_count > 0U);
int_depth_attach->remaining_count--;
int_attach->remaining_count +=
color_output_uses + input_attachment_uses;
- if ((uint32_t)*subpass->depth_stencil_attachment == i)
+ if ((uint32_t)subpass->depth_stencil_attachment == i)
int_attach->remaining_count++;
}
return false;
}
-static inline size_t
-pvr_num_subpass_attachments(const VkSubpassDescription2 *desc)
-{
- return desc->inputAttachmentCount + desc->colorAttachmentCount +
- (desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
- (desc->pDepthStencilAttachment != NULL);
-}
-
static bool pvr_is_subpass_initops_flush_needed(
const struct pvr_render_pass *pass,
const struct pvr_renderpass_hwsetup_render *hw_render)
subpass_attachment_count = 0;
for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
+ const VkSubpassDescription2 *desc = &pCreateInfo->pSubpasses[i];
subpass_attachment_count +=
- pvr_num_subpass_attachments(&pCreateInfo->pSubpasses[i]);
+ desc->inputAttachmentCount + desc->colorAttachmentCount +
+ (desc->pResolveAttachments ? desc->colorAttachmentCount : 0);
}
vk_multialloc_add(&ma,
}
if (desc->pDepthStencilAttachment) {
- subpass->depth_stencil_attachment = subpass_attachments++;
- *subpass->depth_stencil_attachment =
+ subpass->depth_stencil_attachment =
desc->pDepthStencilAttachment->attachment;
+ } else {
+ subpass->depth_stencil_attachment = VK_ATTACHMENT_UNUSED;
}
/* Give the dependencies a slice of the subpass_attachments array. */