{
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
const uint32_t color_att = attachment->colorAttachment;
- const uint32_t att_idx = subpass->color_attachments[color_att];
+ const uint32_t att_idx = subpass->color_attachments[color_att].attachment;
if (att_idx == VK_ATTACHMENT_UNUSED)
return;
{
static const union isl_color_value color_value = { .u32 = { 0, } };
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
- const uint32_t att_idx = subpass->depth_stencil_attachment;
+ const uint32_t att_idx = subpass->depth_stencil_attachment.attachment;
if (att_idx == VK_ATTACHMENT_UNUSED)
return;
struct anv_render_pass *pass = cmd_buffer->state.pass;
for (uint32_t i = 0; i < subpass->color_count; ++i) {
- uint32_t att = subpass->color_attachments[i];
+ uint32_t att = subpass->color_attachments[i].attachment;
assert(att < pass->attachment_count);
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
cmd_buffer->state.pending_pipe_bits |=
}
}
- if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
- uint32_t att = subpass->depth_stencil_attachment;
+ if (subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
+ uint32_t att = subpass->depth_stencil_attachment.attachment;
assert(att < pass->attachment_count);
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
cmd_buffer->state.pending_pipe_bits |=
subpass_needs_clear(const struct anv_cmd_buffer *cmd_buffer)
{
const struct anv_cmd_state *cmd_state = &cmd_buffer->state;
- uint32_t ds = cmd_state->subpass->depth_stencil_attachment;
+ uint32_t ds = cmd_state->subpass->depth_stencil_attachment.attachment;
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
- uint32_t a = cmd_state->subpass->color_attachments[i];
+ uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
if (cmd_state->attachments[a].pending_clear_aspects) {
return true;
}
struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
- const uint32_t a = cmd_state->subpass->color_attachments[i];
+ const uint32_t a = cmd_state->subpass->color_attachments[i].attachment;
struct anv_attachment_state *att_state = &cmd_state->attachments[a];
if (!att_state->pending_clear_aspects)
att_state->pending_clear_aspects = 0;
}
- const uint32_t ds = cmd_state->subpass->depth_stencil_attachment;
+ const uint32_t ds = cmd_state->subpass->depth_stencil_attachment.attachment;
if (ds != VK_ATTACHMENT_UNUSED &&
cmd_state->attachments[ds].pending_clear_aspects) {
for (uint32_t i = 0; i < subpass->color_count; ++i) {
ccs_resolve_attachment(cmd_buffer, &batch,
- subpass->color_attachments[i]);
+ subpass->color_attachments[i].attachment);
}
anv_cmd_buffer_flush_attachments(cmd_buffer, SUBPASS_STAGE_DRAW);
if (subpass->has_resolve) {
for (uint32_t i = 0; i < subpass->color_count; ++i) {
- uint32_t src_att = subpass->color_attachments[i];
- uint32_t dst_att = subpass->resolve_attachments[i];
+ uint32_t src_att = subpass->color_attachments[i].attachment;
+ uint32_t dst_att = subpass->resolve_attachments[i].attachment;
if (dst_att == VK_ATTACHMENT_UNUSED)
continue;
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
- if (subpass->depth_stencil_attachment == VK_ATTACHMENT_UNUSED)
+ if (subpass->depth_stencil_attachment.attachment == VK_ATTACHMENT_UNUSED)
return NULL;
const struct anv_image_view *iview =
- fb->attachments[subpass->depth_stencil_attachment];
+ fb->attachments[subpass->depth_stencil_attachment.attachment];
assert(iview->aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT |
VK_IMAGE_ASPECT_STENCIL_BIT));
usages += pass->subpass_count;
}
- uint32_t subpass_attachment_count = 0, *p;
+ uint32_t subpass_attachment_count = 0;
+ VkAttachmentReference *p;
for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
pass->subpass_attachments =
vk_alloc2(&device->alloc, pAllocator,
- subpass_attachment_count * sizeof(uint32_t), 8,
+ subpass_attachment_count * sizeof(VkAttachmentReference), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pass->subpass_attachments == NULL) {
vk_free2(&device->alloc, pAllocator, pass->subpass_usages);
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
uint32_t a = desc->pInputAttachments[j].attachment;
- subpass->input_attachments[j] = a;
+ subpass->input_attachments[j] = desc->pInputAttachments[j];
if (a != VK_ATTACHMENT_UNUSED) {
pass->attachments[a].usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_INPUT;
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
uint32_t a = desc->pColorAttachments[j].attachment;
- subpass->color_attachments[j] = a;
+ subpass->color_attachments[j] = desc->pColorAttachments[j];
if (a != VK_ATTACHMENT_UNUSED) {
pass->attachments[a].usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_DRAW;
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
uint32_t a = desc->pResolveAttachments[j].attachment;
- subpass->resolve_attachments[j] = a;
+ subpass->resolve_attachments[j] = desc->pResolveAttachments[j];
if (a != VK_ATTACHMENT_UNUSED) {
subpass->has_resolve = true;
uint32_t color_att = desc->pColorAttachments[j].attachment;
if (desc->pDepthStencilAttachment) {
uint32_t a = desc->pDepthStencilAttachment->attachment;
- subpass->depth_stencil_attachment = a;
- subpass->depth_stencil_layout =
- desc->pDepthStencilAttachment->layout;
+ subpass->depth_stencil_attachment = *desc->pDepthStencilAttachment;
if (a != VK_ATTACHMENT_UNUSED) {
pass->attachments[a].usage |=
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
pass->attachments[a].last_subpass_idx = i;
}
} else {
- subpass->depth_stencil_attachment = VK_ATTACHMENT_UNUSED;
- subpass->depth_stencil_layout = VK_IMAGE_LAYOUT_UNDEFINED;
+ subpass->depth_stencil_attachment.attachment = VK_ATTACHMENT_UNUSED;
+ subpass->depth_stencil_attachment.layout = VK_IMAGE_LAYOUT_UNDEFINED;
}
}
* for all sample counts.
*/
for (unsigned i = 0; i < pass->subpass_count; ++i) {
- if (pass->subpasses[i].depth_stencil_attachment !=
+ if (pass->subpasses[i].depth_stencil_attachment.attachment !=
VK_ATTACHMENT_UNUSED) {
*pGranularity = (VkExtent2D) { .width = 8, .height = 4 };
return;
*/
bool uses_color_att = false;
for (unsigned i = 0; i < subpass->color_count; ++i) {
- if (subpass->color_attachments[i] != VK_ATTACHMENT_UNUSED) {
+ if (subpass->color_attachments[i].attachment != VK_ATTACHMENT_UNUSED) {
uses_color_att = true;
break;
}
* against does not use a depth/stencil attachment.
*/
if (!pCreateInfo->pRasterizationState->rasterizerDiscardEnable &&
- subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
+ subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
assert(pCreateInfo->pDepthStencilState);
if (states & (1 << VK_DYNAMIC_STATE_DEPTH_BOUNDS)) {
assert(info->pViewportState);
assert(info->pMultisampleState);
- if (subpass && subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED)
+ if (subpass && subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED)
assert(info->pDepthStencilState);
if (subpass && subpass->color_count > 0)
struct anv_subpass {
uint32_t input_count;
- uint32_t * input_attachments;
+ VkAttachmentReference * input_attachments;
uint32_t color_count;
- uint32_t * color_attachments;
- uint32_t * resolve_attachments;
+ VkAttachmentReference * color_attachments;
+ VkAttachmentReference * resolve_attachments;
- /* TODO: Consider storing the depth/stencil VkAttachmentReference
- * instead of its two structure members (below) individually.
- */
- uint32_t depth_stencil_attachment;
- VkImageLayout depth_stencil_layout;
+ VkAttachmentReference depth_stencil_attachment;
/** Subpass has a depth/stencil self-dependency */
bool has_ds_self_dep;
struct anv_render_pass {
uint32_t attachment_count;
uint32_t subpass_count;
- uint32_t * subpass_attachments;
+ VkAttachmentReference * subpass_attachments;
enum anv_subpass_usage * subpass_usages;
struct anv_render_pass_attachment * attachments;
struct anv_subpass subpasses[0];
const struct anv_render_pass *pass = cmd_buffer->state.pass;
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
- if (subpass->depth_stencil_attachment >= pass->attachment_count)
+ if (subpass->depth_stencil_attachment.attachment >= pass->attachment_count)
return D16_UNORM;
struct anv_render_pass_attachment *att =
- &pass->attachments[subpass->depth_stencil_attachment];
+ &pass->attachments[subpass->depth_stencil_attachment.attachment];
switch (att->format) {
case VK_FORMAT_D16_UNORM:
assert(stage == MESA_SHADER_FRAGMENT);
assert(binding->binding == 0);
if (binding->index < subpass->color_count) {
- const unsigned att = subpass->color_attachments[binding->index];
+ const unsigned att = subpass->color_attachments[binding->index].attachment;
surface_state = cmd_buffer->state.attachments[att].color_rt_state;
} else {
surface_state = cmd_buffer->state.null_surface_state;
*/
assert(binding->input_attachment_index < subpass->input_count);
const unsigned subpass_att = binding->input_attachment_index;
- const unsigned att = subpass->input_attachments[subpass_att];
+ const unsigned att = subpass->input_attachments[subpass_att].attachment;
surface_state = cmd_buffer->state.attachments[att].input_att_state;
}
break;
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
const struct anv_image *image = iview ? iview->image : NULL;
const bool has_depth = image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT);
- const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment;
+ const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment;
const bool has_hiz = image != NULL &&
cmd_buffer->state.attachments[ds].aux_usage == ISL_AUX_USAGE_HIZ;
const bool has_stencil =
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
- const uint32_t ds = subpass->depth_stencil_attachment;
+ const uint32_t ds = subpass->depth_stencil_attachment.attachment;
transition_depth_buffer(cmd_buffer, iview->image,
cmd_buffer->state.attachments[ds].current_layout,
- cmd_buffer->state.subpass->depth_stencil_layout);
+ cmd_buffer->state.subpass->depth_stencil_attachment.layout);
cmd_buffer->state.attachments[ds].current_layout =
- cmd_buffer->state.subpass->depth_stencil_layout;
+ cmd_buffer->state.subpass->depth_stencil_attachment.layout;
cmd_buffer->state.attachments[ds].aux_usage =
anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image,
iview->aspect_mask,
- cmd_buffer->state.subpass->depth_stencil_layout);
+ cmd_buffer->state.subpass->depth_stencil_attachment.layout);
}
cmd_buffer_emit_depth_stencil(cmd_buffer);
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
- const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment;
+ const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment;
if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses ==
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
- const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment;
+ const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment;
if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses ==
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
/* Gen7 requires that we provide the depth format in 3DSTATE_SF so that it
* can get the depth offsets correct.
*/
- if (subpass->depth_stencil_attachment < pass->attachment_count) {
+ if (subpass->depth_stencil_attachment.attachment < pass->attachment_count) {
VkFormat vk_format =
- pass->attachments[subpass->depth_stencil_attachment].format;
+ pass->attachments[subpass->depth_stencil_attachment.attachment].format;
assert(vk_format_is_depth_or_stencil(vk_format));
if (vk_format_aspects(vk_format) & VK_IMAGE_ASPECT_DEPTH_BIT) {
enum isl_format isl_format =
}
VkImageAspectFlags ds_aspects = 0;
- if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
+ if (subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
VkFormat depth_stencil_format =
- pass->attachments[subpass->depth_stencil_attachment].format;
+ pass->attachments[subpass->depth_stencil_attachment.attachment].format;
ds_aspects = vk_format_aspects(depth_stencil_format);
}