anv: Store the user's VkAttachmentReference
We will be using the image layout. Store the full struct directly from the user. Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -950,7 +950,7 @@ clear_color_attachment(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
{
|
{
|
||||||
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
||||||
const uint32_t color_att = attachment->colorAttachment;
|
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)
|
if (att_idx == VK_ATTACHMENT_UNUSED)
|
||||||
return;
|
return;
|
||||||
@@ -987,7 +987,7 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
{
|
{
|
||||||
static const union isl_color_value color_value = { .u32 = { 0, } };
|
static const union isl_color_value color_value = { .u32 = { 0, } };
|
||||||
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
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)
|
if (att_idx == VK_ATTACHMENT_UNUSED)
|
||||||
return;
|
return;
|
||||||
@@ -1119,7 +1119,7 @@ anv_cmd_buffer_flush_attachments(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
struct anv_render_pass *pass = cmd_buffer->state.pass;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
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);
|
assert(att < pass->attachment_count);
|
||||||
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
|
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
|
||||||
cmd_buffer->state.pending_pipe_bits |=
|
cmd_buffer->state.pending_pipe_bits |=
|
||||||
@@ -1128,8 +1128,8 @@ anv_cmd_buffer_flush_attachments(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
|
if (subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
|
||||||
uint32_t att = subpass->depth_stencil_attachment;
|
uint32_t att = subpass->depth_stencil_attachment.attachment;
|
||||||
assert(att < pass->attachment_count);
|
assert(att < pass->attachment_count);
|
||||||
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
|
if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) {
|
||||||
cmd_buffer->state.pending_pipe_bits |=
|
cmd_buffer->state.pending_pipe_bits |=
|
||||||
@@ -1143,10 +1143,10 @@ static bool
|
|||||||
subpass_needs_clear(const struct anv_cmd_buffer *cmd_buffer)
|
subpass_needs_clear(const struct anv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
const struct anv_cmd_state *cmd_state = &cmd_buffer->state;
|
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) {
|
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) {
|
if (cmd_state->attachments[a].pending_clear_aspects) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1185,7 +1185,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
||||||
for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) {
|
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];
|
struct anv_attachment_state *att_state = &cmd_state->attachments[a];
|
||||||
|
|
||||||
if (!att_state->pending_clear_aspects)
|
if (!att_state->pending_clear_aspects)
|
||||||
@@ -1231,7 +1231,7 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
att_state->pending_clear_aspects = 0;
|
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 &&
|
if (ds != VK_ATTACHMENT_UNUSED &&
|
||||||
cmd_state->attachments[ds].pending_clear_aspects) {
|
cmd_state->attachments[ds].pending_clear_aspects) {
|
||||||
@@ -1536,15 +1536,15 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
ccs_resolve_attachment(cmd_buffer, &batch,
|
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);
|
anv_cmd_buffer_flush_attachments(cmd_buffer, SUBPASS_STAGE_DRAW);
|
||||||
|
|
||||||
if (subpass->has_resolve) {
|
if (subpass->has_resolve) {
|
||||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||||
uint32_t src_att = subpass->color_attachments[i];
|
uint32_t src_att = subpass->color_attachments[i].attachment;
|
||||||
uint32_t dst_att = subpass->resolve_attachments[i];
|
uint32_t dst_att = subpass->resolve_attachments[i].attachment;
|
||||||
|
|
||||||
if (dst_att == VK_ATTACHMENT_UNUSED)
|
if (dst_att == VK_ATTACHMENT_UNUSED)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -808,11 +808,11 @@ anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
|
|||||||
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
||||||
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
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;
|
return NULL;
|
||||||
|
|
||||||
const struct anv_image_view *iview =
|
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 |
|
assert(iview->aspect_mask & (VK_IMAGE_ASPECT_DEPTH_BIT |
|
||||||
VK_IMAGE_ASPECT_STENCIL_BIT));
|
VK_IMAGE_ASPECT_STENCIL_BIT));
|
||||||
|
@@ -80,7 +80,8 @@ VkResult anv_CreateRenderPass(
|
|||||||
usages += pass->subpass_count;
|
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++) {
|
for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
|
||||||
const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
|
const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ VkResult anv_CreateRenderPass(
|
|||||||
|
|
||||||
pass->subpass_attachments =
|
pass->subpass_attachments =
|
||||||
vk_alloc2(&device->alloc, pAllocator,
|
vk_alloc2(&device->alloc, pAllocator,
|
||||||
subpass_attachment_count * sizeof(uint32_t), 8,
|
subpass_attachment_count * sizeof(VkAttachmentReference), 8,
|
||||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||||
if (pass->subpass_attachments == NULL) {
|
if (pass->subpass_attachments == NULL) {
|
||||||
vk_free2(&device->alloc, pAllocator, pass->subpass_usages);
|
vk_free2(&device->alloc, pAllocator, pass->subpass_usages);
|
||||||
@@ -115,7 +116,7 @@ VkResult anv_CreateRenderPass(
|
|||||||
|
|
||||||
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
|
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
|
||||||
uint32_t a = desc->pInputAttachments[j].attachment;
|
uint32_t a = desc->pInputAttachments[j].attachment;
|
||||||
subpass->input_attachments[j] = a;
|
subpass->input_attachments[j] = desc->pInputAttachments[j];
|
||||||
if (a != VK_ATTACHMENT_UNUSED) {
|
if (a != VK_ATTACHMENT_UNUSED) {
|
||||||
pass->attachments[a].usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
|
pass->attachments[a].usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
|
||||||
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_INPUT;
|
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_INPUT;
|
||||||
@@ -134,7 +135,7 @@ VkResult anv_CreateRenderPass(
|
|||||||
|
|
||||||
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
||||||
uint32_t a = desc->pColorAttachments[j].attachment;
|
uint32_t a = desc->pColorAttachments[j].attachment;
|
||||||
subpass->color_attachments[j] = a;
|
subpass->color_attachments[j] = desc->pColorAttachments[j];
|
||||||
if (a != VK_ATTACHMENT_UNUSED) {
|
if (a != VK_ATTACHMENT_UNUSED) {
|
||||||
pass->attachments[a].usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
pass->attachments[a].usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_DRAW;
|
pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_DRAW;
|
||||||
@@ -150,7 +151,7 @@ VkResult anv_CreateRenderPass(
|
|||||||
|
|
||||||
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
|
||||||
uint32_t a = desc->pResolveAttachments[j].attachment;
|
uint32_t a = desc->pResolveAttachments[j].attachment;
|
||||||
subpass->resolve_attachments[j] = a;
|
subpass->resolve_attachments[j] = desc->pResolveAttachments[j];
|
||||||
if (a != VK_ATTACHMENT_UNUSED) {
|
if (a != VK_ATTACHMENT_UNUSED) {
|
||||||
subpass->has_resolve = true;
|
subpass->has_resolve = true;
|
||||||
uint32_t color_att = desc->pColorAttachments[j].attachment;
|
uint32_t color_att = desc->pColorAttachments[j].attachment;
|
||||||
@@ -169,9 +170,7 @@ VkResult anv_CreateRenderPass(
|
|||||||
|
|
||||||
if (desc->pDepthStencilAttachment) {
|
if (desc->pDepthStencilAttachment) {
|
||||||
uint32_t a = desc->pDepthStencilAttachment->attachment;
|
uint32_t a = desc->pDepthStencilAttachment->attachment;
|
||||||
subpass->depth_stencil_attachment = a;
|
subpass->depth_stencil_attachment = *desc->pDepthStencilAttachment;
|
||||||
subpass->depth_stencil_layout =
|
|
||||||
desc->pDepthStencilAttachment->layout;
|
|
||||||
if (a != VK_ATTACHMENT_UNUSED) {
|
if (a != VK_ATTACHMENT_UNUSED) {
|
||||||
pass->attachments[a].usage |=
|
pass->attachments[a].usage |=
|
||||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||||
@@ -179,8 +178,8 @@ VkResult anv_CreateRenderPass(
|
|||||||
pass->attachments[a].last_subpass_idx = i;
|
pass->attachments[a].last_subpass_idx = i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
subpass->depth_stencil_attachment = VK_ATTACHMENT_UNUSED;
|
subpass->depth_stencil_attachment.attachment = VK_ATTACHMENT_UNUSED;
|
||||||
subpass->depth_stencil_layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
subpass->depth_stencil_attachment.layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +215,7 @@ void anv_GetRenderAreaGranularity(
|
|||||||
* for all sample counts.
|
* for all sample counts.
|
||||||
*/
|
*/
|
||||||
for (unsigned i = 0; i < pass->subpass_count; ++i) {
|
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) {
|
VK_ATTACHMENT_UNUSED) {
|
||||||
*pGranularity = (VkExtent2D) { .width = 8, .height = 4 };
|
*pGranularity = (VkExtent2D) { .width = 8, .height = 4 };
|
||||||
return;
|
return;
|
||||||
|
@@ -1056,7 +1056,7 @@ copy_non_dynamic_state(struct anv_pipeline *pipeline,
|
|||||||
*/
|
*/
|
||||||
bool uses_color_att = false;
|
bool uses_color_att = false;
|
||||||
for (unsigned i = 0; i < subpass->color_count; ++i) {
|
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;
|
uses_color_att = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1084,7 +1084,7 @@ copy_non_dynamic_state(struct anv_pipeline *pipeline,
|
|||||||
* against does not use a depth/stencil attachment.
|
* against does not use a depth/stencil attachment.
|
||||||
*/
|
*/
|
||||||
if (!pCreateInfo->pRasterizationState->rasterizerDiscardEnable &&
|
if (!pCreateInfo->pRasterizationState->rasterizerDiscardEnable &&
|
||||||
subpass->depth_stencil_attachment != VK_ATTACHMENT_UNUSED) {
|
subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) {
|
||||||
assert(pCreateInfo->pDepthStencilState);
|
assert(pCreateInfo->pDepthStencilState);
|
||||||
|
|
||||||
if (states & (1 << VK_DYNAMIC_STATE_DEPTH_BOUNDS)) {
|
if (states & (1 << VK_DYNAMIC_STATE_DEPTH_BOUNDS)) {
|
||||||
@@ -1144,7 +1144,7 @@ anv_pipeline_validate_create_info(const VkGraphicsPipelineCreateInfo *info)
|
|||||||
assert(info->pViewportState);
|
assert(info->pViewportState);
|
||||||
assert(info->pMultisampleState);
|
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);
|
assert(info->pDepthStencilState);
|
||||||
|
|
||||||
if (subpass && subpass->color_count > 0)
|
if (subpass && subpass->color_count > 0)
|
||||||
|
@@ -1922,16 +1922,12 @@ struct anv_framebuffer {
|
|||||||
|
|
||||||
struct anv_subpass {
|
struct anv_subpass {
|
||||||
uint32_t input_count;
|
uint32_t input_count;
|
||||||
uint32_t * input_attachments;
|
VkAttachmentReference * input_attachments;
|
||||||
uint32_t color_count;
|
uint32_t color_count;
|
||||||
uint32_t * color_attachments;
|
VkAttachmentReference * color_attachments;
|
||||||
uint32_t * resolve_attachments;
|
VkAttachmentReference * resolve_attachments;
|
||||||
|
|
||||||
/* TODO: Consider storing the depth/stencil VkAttachmentReference
|
VkAttachmentReference depth_stencil_attachment;
|
||||||
* instead of its two structure members (below) individually.
|
|
||||||
*/
|
|
||||||
uint32_t depth_stencil_attachment;
|
|
||||||
VkImageLayout depth_stencil_layout;
|
|
||||||
|
|
||||||
/** Subpass has a depth/stencil self-dependency */
|
/** Subpass has a depth/stencil self-dependency */
|
||||||
bool has_ds_self_dep;
|
bool has_ds_self_dep;
|
||||||
@@ -1970,7 +1966,7 @@ struct anv_render_pass_attachment {
|
|||||||
struct anv_render_pass {
|
struct anv_render_pass {
|
||||||
uint32_t attachment_count;
|
uint32_t attachment_count;
|
||||||
uint32_t subpass_count;
|
uint32_t subpass_count;
|
||||||
uint32_t * subpass_attachments;
|
VkAttachmentReference * subpass_attachments;
|
||||||
enum anv_subpass_usage * subpass_usages;
|
enum anv_subpass_usage * subpass_usages;
|
||||||
struct anv_render_pass_attachment * attachments;
|
struct anv_render_pass_attachment * attachments;
|
||||||
struct anv_subpass subpasses[0];
|
struct anv_subpass subpasses[0];
|
||||||
|
@@ -127,11 +127,11 @@ get_depth_format(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
const struct anv_render_pass *pass = cmd_buffer->state.pass;
|
const struct anv_render_pass *pass = cmd_buffer->state.pass;
|
||||||
const struct anv_subpass *subpass = cmd_buffer->state.subpass;
|
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;
|
return D16_UNORM;
|
||||||
|
|
||||||
struct anv_render_pass_attachment *att =
|
struct anv_render_pass_attachment *att =
|
||||||
&pass->attachments[subpass->depth_stencil_attachment];
|
&pass->attachments[subpass->depth_stencil_attachment.attachment];
|
||||||
|
|
||||||
switch (att->format) {
|
switch (att->format) {
|
||||||
case VK_FORMAT_D16_UNORM:
|
case VK_FORMAT_D16_UNORM:
|
||||||
|
@@ -1143,7 +1143,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
assert(stage == MESA_SHADER_FRAGMENT);
|
assert(stage == MESA_SHADER_FRAGMENT);
|
||||||
assert(binding->binding == 0);
|
assert(binding->binding == 0);
|
||||||
if (binding->index < subpass->color_count) {
|
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;
|
surface_state = cmd_buffer->state.attachments[att].color_rt_state;
|
||||||
} else {
|
} else {
|
||||||
surface_state = cmd_buffer->state.null_surface_state;
|
surface_state = cmd_buffer->state.null_surface_state;
|
||||||
@@ -1191,7 +1191,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
*/
|
*/
|
||||||
assert(binding->input_attachment_index < subpass->input_count);
|
assert(binding->input_attachment_index < subpass->input_count);
|
||||||
const unsigned subpass_att = binding->input_attachment_index;
|
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;
|
surface_state = cmd_buffer->state.attachments[att].input_att_state;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2202,7 +2202,7 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = iview ? iview->image : NULL;
|
const struct anv_image *image = iview ? iview->image : NULL;
|
||||||
const bool has_depth = image && (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT);
|
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 &&
|
const bool has_hiz = image != NULL &&
|
||||||
cmd_buffer->state.attachments[ds].aux_usage == ISL_AUX_USAGE_HIZ;
|
cmd_buffer->state.attachments[ds].aux_usage == ISL_AUX_USAGE_HIZ;
|
||||||
const bool has_stencil =
|
const bool has_stencil =
|
||||||
@@ -2364,16 +2364,16 @@ genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
|
|
||||||
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
|
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,
|
transition_depth_buffer(cmd_buffer, iview->image,
|
||||||
cmd_buffer->state.attachments[ds].current_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].current_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 =
|
cmd_buffer->state.attachments[ds].aux_usage =
|
||||||
anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image,
|
anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image,
|
||||||
iview->aspect_mask,
|
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);
|
cmd_buffer_emit_depth_stencil(cmd_buffer);
|
||||||
@@ -2412,7 +2412,7 @@ void genX(CmdNextSubpass)(
|
|||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
|
|
||||||
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
|
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 ==
|
if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses ==
|
||||||
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
|
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
|
||||||
@@ -2435,7 +2435,7 @@ void genX(CmdEndRenderPass)(
|
|||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
|
|
||||||
if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) {
|
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 ==
|
if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses ==
|
||||||
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
|
cmd_buffer->state.pass->attachments[ds].last_subpass_idx) {
|
||||||
|
@@ -489,9 +489,9 @@ emit_rs_state(struct anv_pipeline *pipeline,
|
|||||||
/* Gen7 requires that we provide the depth format in 3DSTATE_SF so that it
|
/* Gen7 requires that we provide the depth format in 3DSTATE_SF so that it
|
||||||
* can get the depth offsets correct.
|
* 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 =
|
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));
|
assert(vk_format_is_depth_or_stencil(vk_format));
|
||||||
if (vk_format_aspects(vk_format) & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
if (vk_format_aspects(vk_format) & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||||
enum isl_format isl_format =
|
enum isl_format isl_format =
|
||||||
@@ -807,9 +807,9 @@ emit_ds_state(struct anv_pipeline *pipeline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VkImageAspectFlags ds_aspects = 0;
|
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 =
|
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);
|
ds_aspects = vk_format_aspects(depth_stencil_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user