radv: Use both aspects for depth/stencil blit destinations
Even with dynamic rendering, you have to bind both aspects of the image
if the image contains both depth and stencil. One day, we may see this
restriction lifted but that will require deeper driver surgery into the
way we handle depth/stencil layouts.
Fixes: 42db590006
("radv: convert the meta blit 2d path to dynamic rendering")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18084>
This commit is contained in:

committed by
Marge Bot

parent
7077b72d60
commit
76b8b854a5
@@ -267,21 +267,11 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
|
||||
unsigned fs_key = 0;
|
||||
VkFormat format = VK_FORMAT_UNDEFINED;
|
||||
|
||||
VkRenderingAttachmentInfo color_att = {0}, depth_att = {0}, stencil_att = {0};
|
||||
|
||||
switch (src_iview->vk.aspects) {
|
||||
case VK_IMAGE_ASPECT_COLOR_BIT: {
|
||||
unsigned dst_layout = radv_meta_dst_layout_from_layout(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_dst_layout_to_layout(dst_layout);
|
||||
fs_key = radv_format_meta_fs_key(device, dest_image->vk.format);
|
||||
format = radv_fs_key_format_exemplars[fs_key];
|
||||
|
||||
color_att.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
|
||||
color_att.imageView = radv_image_view_to_handle(dest_iview);
|
||||
color_att.imageLayout = layout;
|
||||
color_att.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
color_att.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
|
||||
switch (src_image->vk.image_type) {
|
||||
case VK_IMAGE_TYPE_1D:
|
||||
pipeline = &device->meta_state.blit.pipeline_1d_src[fs_key];
|
||||
@@ -298,16 +288,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
|
||||
break;
|
||||
}
|
||||
case VK_IMAGE_ASPECT_DEPTH_BIT: {
|
||||
enum radv_blit_ds_layout ds_layout = radv_meta_blit_ds_to_type(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_blit_ds_to_layout(ds_layout);
|
||||
format = VK_FORMAT_D32_SFLOAT;
|
||||
|
||||
depth_att.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
|
||||
depth_att.imageView = radv_image_view_to_handle(dest_iview);
|
||||
depth_att.imageLayout = layout;
|
||||
depth_att.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
depth_att.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
|
||||
switch (src_image->vk.image_type) {
|
||||
case VK_IMAGE_TYPE_1D:
|
||||
pipeline = &device->meta_state.blit.depth_only_1d_pipeline;
|
||||
@@ -324,16 +306,8 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
|
||||
break;
|
||||
}
|
||||
case VK_IMAGE_ASPECT_STENCIL_BIT: {
|
||||
enum radv_blit_ds_layout ds_layout = radv_meta_blit_ds_to_type(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_blit_ds_to_layout(ds_layout);
|
||||
format = VK_FORMAT_S8_UINT;
|
||||
|
||||
stencil_att.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
|
||||
stencil_att.imageView = radv_image_view_to_handle(dest_iview);
|
||||
stencil_att.imageLayout = layout;
|
||||
stencil_att.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
|
||||
stencil_att.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
|
||||
|
||||
switch (src_image->vk.image_type) {
|
||||
case VK_IMAGE_TYPE_1D:
|
||||
pipeline = &device->meta_state.blit.stencil_only_1d_pipeline;
|
||||
@@ -408,17 +382,50 @@ meta_emit_blit(struct radv_cmd_buffer *cmd_buffer, struct radv_image *src_image,
|
||||
.layerCount = 1,
|
||||
};
|
||||
|
||||
switch (src_iview->image->vk.aspects) {
|
||||
case VK_IMAGE_ASPECT_COLOR_BIT:
|
||||
VkRenderingAttachmentInfo color_att;
|
||||
if (src_iview->image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
unsigned dst_layout = radv_meta_dst_layout_from_layout(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_dst_layout_to_layout(dst_layout);
|
||||
|
||||
color_att = (VkRenderingAttachmentInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO,
|
||||
.imageView = radv_image_view_to_handle(dest_iview),
|
||||
.imageLayout = layout,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
};
|
||||
rendering_info.colorAttachmentCount = 1;
|
||||
rendering_info.pColorAttachments = &color_att;
|
||||
break;
|
||||
case VK_IMAGE_ASPECT_DEPTH_BIT:
|
||||
}
|
||||
|
||||
VkRenderingAttachmentInfo depth_att;
|
||||
if (src_iview->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
|
||||
enum radv_blit_ds_layout ds_layout = radv_meta_blit_ds_to_type(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_blit_ds_to_layout(ds_layout);
|
||||
|
||||
depth_att = (VkRenderingAttachmentInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO,
|
||||
.imageView = radv_image_view_to_handle(dest_iview),
|
||||
.imageLayout = layout,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
};
|
||||
rendering_info.pDepthAttachment = &depth_att;
|
||||
break;
|
||||
case VK_IMAGE_ASPECT_STENCIL_BIT:
|
||||
}
|
||||
|
||||
VkRenderingAttachmentInfo stencil_att;
|
||||
if (src_iview->image->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||
enum radv_blit_ds_layout ds_layout = radv_meta_blit_ds_to_type(dest_image_layout);
|
||||
VkImageLayout layout = radv_meta_blit_ds_to_layout(ds_layout);
|
||||
|
||||
stencil_att = (VkRenderingAttachmentInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO,
|
||||
.imageView = radv_image_view_to_handle(dest_iview),
|
||||
.imageLayout = layout,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
};
|
||||
rendering_info.pStencilAttachment = &stencil_att;
|
||||
break;
|
||||
}
|
||||
|
||||
radv_CmdBeginRendering(radv_cmd_buffer_to_handle(cmd_buffer), &rendering_info);
|
||||
|
@@ -298,6 +298,8 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer,
|
||||
},
|
||||
.layerCount = 1,
|
||||
.pDepthAttachment = &depth_att_info,
|
||||
.pStencilAttachment = (dst->image->vk.aspects & VK_IMAGE_ASPECT_STENCIL_BIT) ?
|
||||
&depth_att_info : NULL,
|
||||
};
|
||||
|
||||
radv_CmdBeginRendering(radv_cmd_buffer_to_handle(cmd_buffer), &rendering_info);
|
||||
@@ -329,6 +331,8 @@ radv_meta_blit2d_normal_dst(struct radv_cmd_buffer *cmd_buffer,
|
||||
.extent = { rects[r].width, rects[r].height },
|
||||
},
|
||||
.layerCount = 1,
|
||||
.pDepthAttachment = (dst->image->vk.aspects & VK_IMAGE_ASPECT_DEPTH_BIT) ?
|
||||
&stencil_att_info : NULL,
|
||||
.pStencilAttachment = &stencil_att_info,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user