Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Compatible per-plane formats not supported for some multi-plane formats #46

Open
maxime-modulopi opened this issue Feb 13, 2025 · 0 comments

Comments

@maxime-modulopi
Copy link

maxime-modulopi commented Feb 13, 2025

OS: Windows 11 64-bit
GPU: AMD Radeon(TM) Graphics (Ryzen 7 9800X3D)
Driver: 24.12.1

Problem:
Images with multi-plane formats (e.g. VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16) cannot be directly read from a shader.
In order to achieve this, there are only two method that I am aware of:

  • Sample it with a YCbCr sampler
  • Create one image view for each plane and read them separately

Unfortunately, I am unable to use the first method as YCbCr samplers integrate very badly in fully bindless architectures, requiring the use of immutable descriptors and combined image samplers.
This leaves me with only the second method, in which I need to create the image views with the corresponding compatible format for each plane (or any other size-compatible format), as specified in the Vulkan specs.

For VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16, these are:

  • Plane 0: VK_FORMAT_R10X6_UNORM_PACK16
  • Plane 1: VK_FORMAT_R10X6G10X6_UNORM_2PACK16

In the case of these "10X6" formats, because each component has 6 bits that are left unused (and undefined), the other size-compatible formats cannot be used to reliably sample the image:

If the underlying VkImage format has an X component in its format description, undefined values are read from those bits.
[...]
For example, when a VK_FORMAT_R10X6_UNORM_PACK16 VkImage is sampled via a VK_FORMAT_R16_UNORM VkImageView, the low 6 bits of the value before format conversion are undefined and format conversion may return a range of different values.

Currently, VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 is reported as supported but neither VK_FORMAT_R10X6_UNORM_PACK16 nor VK_FORMAT_R10X6G10X6_UNORM_2PACK16 are.

This makes it impossible to sample the image using the second method.

I couldn't find a text in the specs that also require the support for all plane-compatible formats when a multi-plane format is supported, so I'm not sure if this is a driver bug or if the specs are simply too loose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant