Mesa (main): v3dv: Don't use color aspects for depth/stencil images
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 17 18:42:29 UTC 2022
Module: Mesa
Branch: main
Commit: f99ac7f2de1983482452021824c897f56703eb8e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f99ac7f2de1983482452021824c897f56703eb8e
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Fri Mar 25 19:35:17 2022 -0500
v3dv: Don't use color aspects for depth/stencil images
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16376>
---
src/broadcom/vulkan/v3dv_meta_copy.c | 8 ++------
src/broadcom/vulkan/v3dvx_cmd_buffer.c | 2 +-
src/vulkan/runtime/vk_image.c | 1 -
3 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c
index 37377aa741a..24434d6ee25 100644
--- a/src/broadcom/vulkan/v3dv_meta_copy.c
+++ b/src/broadcom/vulkan/v3dv_meta_copy.c
@@ -1968,7 +1968,7 @@ texel_buffer_shader_copy(struct v3dv_cmd_buffer *cmd_buffer,
/* We only handle color copies. Callers can copy D/S aspects by using
* a compatible color format and maybe a cmask/cswizzle for D24 formats.
*/
- if (aspect != VK_IMAGE_ASPECT_COLOR_BIT)
+ if (!vk_format_is_color(dst_format) || !vk_format_is_color(src_format))
return handled;
/* FIXME: we only handle uncompressed images for now. */
@@ -2568,7 +2568,6 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32);
src_format = VK_FORMAT_R8G8B8A8_UINT;
dst_format = src_format;
- aspect = VK_IMAGE_ASPECT_COLOR_BIT;
/* For D24 formats, the Vulkan spec states that the depth component
* in the buffer is stored in the 24-LSB, but V3D wants it in the
@@ -2598,7 +2597,6 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
src_format = VK_FORMAT_R8_UINT;
dst_format = VK_FORMAT_R8G8B8A8_UINT;
cmask = VK_COLOR_COMPONENT_R_BIT;
- aspect = VK_IMAGE_ASPECT_COLOR_BIT;
break;
default:
unreachable("unsupported aspect");
@@ -2606,7 +2604,7 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
};
break;
case 2:
- aspect = VK_IMAGE_ASPECT_COLOR_BIT;
+ assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);
src_format = VK_FORMAT_R16_UINT;
dst_format = src_format;
break;
@@ -3862,8 +3860,6 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
unreachable("Unsupported depth/stencil format");
};
src_format = dst_format;
- region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
- region.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
}
const VkColorComponentFlags full_cmask = VK_COLOR_COMPONENT_R_BIT |
diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
index 2cfe2dc8bd5..b2dd2dc76f6 100644
--- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c
@@ -2337,7 +2337,7 @@ v3dX(cmd_buffer_render_pass_setup_render_target)(struct v3dv_cmd_buffer *cmd_buf
assert(attachment_idx < state->framebuffer->attachment_count &&
attachment_idx < state->attachment_alloc_count);
struct v3dv_image_view *iview = state->attachments[attachment_idx].image_view;
- assert(iview->vk.aspects & VK_IMAGE_ASPECT_COLOR_BIT);
+ assert(vk_format_is_color(iview->vk.format));
*rt_bpp = iview->internal_bpp;
*rt_type = iview->internal_type;
diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c
index 65a4eaa636d..f01998aaa49 100644
--- a/src/vulkan/runtime/vk_image.c
+++ b/src/vulkan/runtime/vk_image.c
@@ -305,7 +305,6 @@ vk_image_view_init(struct vk_device *device,
vk_format_is_depth_or_stencil(image->format) &&
vk_format_is_color(pCreateInfo->format);
if (is_color_view_of_depth_stencil) {
- assert(range->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);
assert(util_format_get_blocksize(vk_format_to_pipe_format(image->format)) ==
util_format_get_blocksize(vk_format_to_pipe_format(pCreateInfo->format)));
image_view->aspects = range->aspectMask;
More information about the mesa-commit
mailing list