vk/image: fix view creation for planar video aspects

drivers do implement this

cc: mesa-stable

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31318>
This commit is contained in:
Mike Blumenkrantz 2024-07-10 11:18:38 -04:00 committed by Marge Bot
parent e0efab520e
commit c4d6d9254a

View file

@ -441,6 +441,12 @@ vk_image_view_init(struct vk_device *device,
vk_image_expand_aspect_mask(image, range->aspectMask);
assert(!(image_view->aspects & ~image->aspects));
const VkImageUsageFlags video = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR |
VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR |
VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR |
VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR |
VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR |
VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR;
/* From the Vulkan 1.2.184 spec:
*
@ -456,11 +462,10 @@ vk_image_view_init(struct vk_device *device,
* be identical to the image format, and the sampler to be used with the
* image view must enable sampler YCBCR conversion."
*
* Since no one implements video yet, we can ignore the bits about video
* create flags and assume YCbCr formats match.
*/
if ((image->aspects & VK_IMAGE_ASPECT_PLANE_1_BIT) &&
(range->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT))
(range->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) &&
!(image->usage & video))
assert(image_view->format == image->format);
/* From the Vulkan 1.2.184 spec: