struct usc_mrt_resource resource;
/* Index of the subpass in the current render where the attachment is first
- * used. -1 if the attachment isn't used in the current render.
+ * used. VK_ATTACHMENT_UNUSED if the attachment isn't used in the current
+ * render.
*/
int32_t first_use;
struct pvr_render_subpass_depth_params {
bool existing_ds_is_input;
bool incoming_ds_is_input;
- int32_t existing_ds_attach;
+ uint32_t existing_ds_attach;
};
struct pvr_renderpass_storage_firstuse_buffer {
hw_subpass->stencil_clear)) {
struct pvr_render_int_attachment *int_ds_attach;
- assert(*input_subpass->depth_stencil_attachment >= 0U);
+ assert(*input_subpass->depth_stencil_attachment !=
+ VK_ATTACHMENT_UNUSED);
assert(*input_subpass->depth_stencil_attachment <
- (int32_t)ctx->pass->attachment_count);
+ ctx->pass->attachment_count);
int_ds_attach =
&ctx->int_attach[*input_subpass->depth_stencil_attachment];
- assert(hw_render->ds_attach_idx == -1 ||
- hw_render->ds_attach_idx ==
- (int32_t)int_ds_attach->attachment->index);
+ assert(hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED ||
+ hw_render->ds_attach_idx == int_ds_attach->attachment->index);
hw_render->ds_attach_idx = int_ds_attach->attachment->index;
if (hw_subpass->depth_initop == VK_ATTACHMENT_LOAD_OP_CLEAR)
}
}
- if (*input_subpass->depth_stencil_attachment != -1)
+ if (*input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
first_ds = false;
for (uint32_t j = 0U; j < input_subpass->color_count; j++) {
struct usc_mrt_resource *mrt = &hw_subpass->setup.mrt_resources[j];
- const int32_t attach_idx = input_subpass->color_attachments[j];
+ const uint32_t attach_idx = input_subpass->color_attachments[j];
struct pvr_render_int_attachment *int_attach;
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
}
for (uint32_t i = 0U; i < input_subpass->color_count; i++) {
- const int32_t attach_idx = input_subpass->color_attachments[i];
+ const uint32_t attach_idx = input_subpass->color_attachments[i];
struct pvr_render_int_attachment *int_attach;
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
const uint32_t attach_idx = input_subpass->input_attachments[i];
struct pvr_render_int_attachment *int_attach;
- if ((int32_t)attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
const uint32_t attach_idx = input_subpass->input_attachments[i];
struct pvr_render_int_attachment *int_attach;
- if ((int32_t)attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
hw_render->stencil_store = true;
if (hw_render->depth_store || hw_render->stencil_store) {
- assert(hw_render->ds_attach_idx == -1 ||
+ assert(hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED ||
hw_render->ds_attach_idx ==
- (int32_t)ctx->int_ds_attach->attachment->index);
+ ctx->int_ds_attach->attachment->index);
hw_render->ds_attach_idx = ctx->int_ds_attach->attachment->index;
/* Allocate memory for the attachment. */
struct pvr_render_subpass *input_subpass = subpass->input_subpass;
for (uint32_t j = 0U; j < input_subpass->color_count; j++) {
- const int32_t resolve_output =
+ const uint32_t resolve_output =
input_subpass->resolve_attachments
? input_subpass->resolve_attachments[j]
- : -1;
+ : VK_ATTACHMENT_UNUSED;
struct pvr_render_int_attachment *color_attach;
- if (input_subpass->color_attachments[j] == -1)
+ if (input_subpass->color_attachments[j] == VK_ATTACHMENT_UNUSED)
continue;
color_attach = &ctx->int_attach[input_subpass->color_attachments[j]];
if (list_is_linked(&color_attach->link)) {
- uint32_t rem_count = resolve_output == -1 ? 0U : 1U;
+ uint32_t rem_count = resolve_output == VK_ATTACHMENT_UNUSED ? 0U
+ : 1U;
/* If a color attachment is resolved it will have an extra
* remaining usage.
}
}
- if (resolve_output != -1) {
+ if (resolve_output != VK_ATTACHMENT_UNUSED) {
struct pvr_render_int_attachment *int_resolve_attach =
&ctx->int_attach[resolve_output];
struct pvr_render_subpass *input_subpass = subpass->input_subpass;
for (uint32_t j = 0U; j < input_subpass->color_count; j++) {
- const int32_t resolve_output =
+ const uint32_t resolve_output =
input_subpass->resolve_attachments
? input_subpass->resolve_attachments[j]
- : -1;
+ : VK_ATTACHMENT_UNUSED;
struct pvr_render_int_attachment *color_attach;
- if (input_subpass->color_attachments[j] == -1)
+ if (input_subpass->color_attachments[j] == VK_ATTACHMENT_UNUSED)
continue;
color_attach = &ctx->int_attach[input_subpass->color_attachments[j]];
- if (resolve_output != -1) {
+ if (resolve_output != VK_ATTACHMENT_UNUSED) {
struct pvr_render_int_attachment *resolve_src =
&ctx->int_attach[input_subpass->color_attachments[j]];
struct pvr_render_int_attachment *resolve_dst =
pvr_mark_surface_alloc(ctx, color_attach);
- assert(color_attach->mrt_idx >= 0U);
+ assert(color_attach->mrt_idx >= 0);
assert(color_attach->mrt_idx <
(int32_t)hw_render->eot_setup.num_render_targets);
return VK_SUCCESS;
}
-static bool pvr_is_input(struct pvr_render_subpass *subpass, int32_t attach_idx)
+static bool pvr_is_input(struct pvr_render_subpass *subpass,
+ uint32_t attach_idx)
{
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
return false;
for (uint32_t i = 0U; i < subpass->input_count; i++) {
- if (subpass->input_attachments[i] == (uint32_t)attach_idx)
+ if (subpass->input_attachments[i] == attach_idx)
return true;
}
break;
}
}
- assert(first_use >= 0U);
+ assert(first_use >= 0);
/* For all subpasses from the first write. */
for (uint32_t i = first_use; i < hw_render->subpass_count; i++) {
}
static bool pvr_is_pending_resolve_dest(struct pvr_renderpass_context *ctx,
- int32_t attach_idx)
+ uint32_t attach_idx)
{
struct pvr_render_int_attachment *int_attach = &ctx->int_attach[attach_idx];
}
static bool pvr_is_pending_resolve_src(struct pvr_renderpass_context *ctx,
- int32_t attach_idx)
+ uint32_t attach_idx)
{
struct pvr_render_int_attachment *int_attach = &ctx->int_attach[attach_idx];
ctx->subpasses[i].input_subpass;
for (uint32_t j = 0U; j < input_subpass->color_count; j++) {
- const int32_t global_color_attach =
+ const uint32_t global_color_attach =
input_subpass->color_attachments[j];
struct pvr_render_int_attachment *int_attach;
bool found = false;
- if (global_color_attach == -1)
+ if (global_color_attach == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[global_color_attach];
* would exceed the limit.
*/
for (uint32_t i = 0U; i < subpass->color_count; i++) {
- const int32_t global_color_attach = subpass->color_attachments[i];
+ const uint32_t global_color_attach = subpass->color_attachments[i];
struct pvr_render_int_attachment *int_attach;
bool found = false;
- if (global_color_attach == -1)
+ if (global_color_attach == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[global_color_attach];
sp_dsts->incoming_zrep.type = USC_MRT_RESOURCE_TYPE_INVALID;
for (uint32_t i = 0U; i < subpass->color_count; i++) {
- const int32_t attach_idx = subpass->color_attachments[i];
+ const uint32_t attach_idx = subpass->color_attachments[i];
struct pvr_render_int_attachment *int_attach;
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
*/
for (uint32_t i = 0U; i < subpass->input_count; i++) {
const uint32_t attach_idx = subpass->input_attachments[i];
- if ((int32_t)attach_idx != -1 &&
+ if (attach_idx != VK_ATTACHMENT_UNUSED &&
pvr_is_pending_resolve_dest(ctx, attach_idx)) {
return false;
}
}
for (uint32_t i = 0U; i < subpass->color_count; i++) {
- if (subpass->color_attachments[i] != -1 &&
+ if (subpass->color_attachments[i] != VK_ATTACHMENT_UNUSED &&
(pvr_is_pending_resolve_dest(ctx, subpass->color_attachments[i]) ||
pvr_is_pending_resolve_src(ctx, subpass->color_attachments[i]))) {
return false;
}
if (subpass->resolve_attachments &&
- subpass->resolve_attachments[i] != -1 &&
+ subpass->resolve_attachments[i] != VK_ATTACHMENT_UNUSED &&
pvr_is_pending_resolve_dest(ctx, subpass->resolve_attachments[i])) {
return false;
}
bool ret;
/* Depth attachment for the incoming subpass. */
- if (*input_subpass->depth_stencil_attachment != -1) {
+ if (*input_subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
int_ds_attach =
&ctx->int_attach[*input_subpass->depth_stencil_attachment];
} else {
if (ctx->int_ds_attach)
sp_depth.existing_ds_attach = ctx->int_ds_attach - ctx->int_attach;
else
- sp_depth.existing_ds_attach = -1;
+ sp_depth.existing_ds_attach = VK_ATTACHMENT_UNUSED;
/* Is the incoming depth attachment used as an input to the incoming subpass?
*/
goto end_merge_subpass;
sp_depth.existing_ds_is_input = false;
- sp_depth.existing_ds_attach = -1;
+ sp_depth.existing_ds_attach = VK_ATTACHMENT_UNUSED;
/* Allocate again in a new render. */
result = pvr_is_subpass_space_available(&device->pdevice->dev_info,
ctx->hw_render = &hw_setup->renders[hw_setup->render_count];
memset(ctx->hw_render, 0U, sizeof(*hw_render));
- ctx->hw_render->ds_attach_idx = -1;
+ ctx->hw_render->ds_attach_idx = VK_ATTACHMENT_UNUSED;
hw_setup->render_count++;
ctx->hw_render->depth_init = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
ctx->hw_render->stencil_init = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
pvr_mark_surface_alloc(ctx, int_ds_attach);
if (setup_render_ds) {
- assert(hw_render->ds_attach_idx == -1);
+ assert(hw_render->ds_attach_idx == VK_ATTACHMENT_UNUSED);
hw_render->ds_attach_idx = int_ds_attach->attachment->index;
}
}
for (uint32_t i = 0U; i < input_subpass->color_count; i++) {
- const int32_t attach_idx = input_subpass->color_attachments[i];
+ const uint32_t attach_idx = input_subpass->color_attachments[i];
struct pvr_render_int_attachment *int_attach;
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
/* Copy the destinations allocated for the color attachments. */
for (uint32_t i = 0U; i < input_subpass->color_count; i++) {
- const int32_t attach_idx = input_subpass->color_attachments[i];
+ const uint32_t attach_idx = input_subpass->color_attachments[i];
struct pvr_render_int_attachment *int_attach;
struct pvr_renderpass_resource *attach_dst;
- if (attach_idx == -1)
+ if (attach_idx == VK_ATTACHMENT_UNUSED)
continue;
int_attach = &ctx->int_attach[attach_idx];
struct pvr_render_subpass *subpass)
{
for (uint32_t i = 0U; i < subpass->color_count; i++) {
- const int32_t attach_idx = subpass->color_attachments[i];
+ const uint32_t attach_idx = subpass->color_attachments[i];
- if (attach_idx != -1)
+ if (attach_idx != VK_ATTACHMENT_UNUSED)
pvr_dereference_surface(ctx, attach_idx, subpass_num);
}
}
uint32_t count)
{
for (uint32_t i = 0U; i < count; i++) {
- if ((int32_t)attachments[i] != -1)
+ if (attachments[i] != VK_ATTACHMENT_UNUSED)
pvr_dereference_surface(ctx, attachments[i], subpass_num);
}
}
subpass_num,
subpass->input_attachments,
subpass->input_count);
- if (*subpass->depth_stencil_attachment != -1) {
+ if (*subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
struct pvr_render_int_attachment *int_depth_attach =
&ctx->int_attach[*subpass->depth_stencil_attachment];
if (!subpass->resolve_attachments)
break;
- if (subpass->resolve_attachments[i] == -1)
+ if (subpass->resolve_attachments[i] == VK_ATTACHMENT_UNUSED)
continue;
assert(subpass->color_attachments[i] <
uint32_t count = 0U;
for (uint32_t i = 0U; i < subpass->color_count; i++) {
- if (subpass->color_attachments[i] == (int32_t)attach_idx) {
+ if (subpass->color_attachments[i] == attach_idx) {
count++;
if (subpass->resolve_attachments &&
- subpass->resolve_attachments[i] != -1)
+ subpass->resolve_attachments[i] != VK_ATTACHMENT_UNUSED)
count++;
}
}