v3dv: Don't use color aspects for depth/stencil images

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16376>
This commit is contained in:
Jason Ekstrand 2022-03-25 19:35:17 -05:00 committed by Marge Bot
parent 36e0f9507d
commit f99ac7f2de
3 changed files with 3 additions and 8 deletions

View file

@ -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 /* 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. * 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; return handled;
/* FIXME: we only handle uncompressed images for now. */ /* 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); image->vk.format == VK_FORMAT_X8_D24_UNORM_PACK32);
src_format = VK_FORMAT_R8G8B8A8_UINT; src_format = VK_FORMAT_R8G8B8A8_UINT;
dst_format = src_format; dst_format = src_format;
aspect = VK_IMAGE_ASPECT_COLOR_BIT;
/* For D24 formats, the Vulkan spec states that the depth component /* 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 * 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; src_format = VK_FORMAT_R8_UINT;
dst_format = VK_FORMAT_R8G8B8A8_UINT; dst_format = VK_FORMAT_R8G8B8A8_UINT;
cmask = VK_COLOR_COMPONENT_R_BIT; cmask = VK_COLOR_COMPONENT_R_BIT;
aspect = VK_IMAGE_ASPECT_COLOR_BIT;
break; break;
default: default:
unreachable("unsupported aspect"); unreachable("unsupported aspect");
@ -2606,7 +2604,7 @@ copy_buffer_to_image_shader(struct v3dv_cmd_buffer *cmd_buffer,
}; };
break; break;
case 2: case 2:
aspect = VK_IMAGE_ASPECT_COLOR_BIT; assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);
src_format = VK_FORMAT_R16_UINT; src_format = VK_FORMAT_R16_UINT;
dst_format = src_format; dst_format = src_format;
break; break;
@ -3862,8 +3860,6 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
unreachable("Unsupported depth/stencil format"); unreachable("Unsupported depth/stencil format");
}; };
src_format = dst_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 | const VkColorComponentFlags full_cmask = VK_COLOR_COMPONENT_R_BIT |

View file

@ -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 && assert(attachment_idx < state->framebuffer->attachment_count &&
attachment_idx < state->attachment_alloc_count); attachment_idx < state->attachment_alloc_count);
struct v3dv_image_view *iview = state->attachments[attachment_idx].image_view; 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_bpp = iview->internal_bpp;
*rt_type = iview->internal_type; *rt_type = iview->internal_type;

View file

@ -305,7 +305,6 @@ vk_image_view_init(struct vk_device *device,
vk_format_is_depth_or_stencil(image->format) && vk_format_is_depth_or_stencil(image->format) &&
vk_format_is_color(pCreateInfo->format); vk_format_is_color(pCreateInfo->format);
if (is_color_view_of_depth_stencil) { 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)) == assert(util_format_get_blocksize(vk_format_to_pipe_format(image->format)) ==
util_format_get_blocksize(vk_format_to_pipe_format(pCreateInfo->format))); util_format_get_blocksize(vk_format_to_pipe_format(pCreateInfo->format)));
image_view->aspects = range->aspectMask; image_view->aspects = range->aspectMask;