lavapipe: Fix features for nonsubsampled ycbcr formats

The Vulkan spec says about VkFormatFeatureFlagBits:

  If a format does not incorporate chroma downsampling (it is
  not a “422” or “420” format) but the implementation supports
  sampler Y′CBCR conversion for this format, the implementation
  must set VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT.

Fixes: af062126ae
Signed-off-by: Benjamin Otte <otte@redhat.com>
(cherry picked from commit 0b6dd167ac)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Benjamin Otte 2026-02-11 06:14:36 +01:00 committed by Eric Engestrom
parent a163dec3ff
commit d7607b6a4e
2 changed files with 4 additions and 4 deletions

View file

@ -404,7 +404,7 @@
"description": "lavapipe: Fix features for nonsubsampled ycbcr formats",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "af062126ae1f26b01cad1165a4e31dc40e141b6b",
"notes": null

View file

@ -146,14 +146,14 @@ lvp_physical_device_get_format_properties(struct lvp_physical_device *physical_d
if (ycbcr_info) {
if (ycbcr_info->n_planes > 1)
features |= VK_FORMAT_FEATURE_DISJOINT_BIT;
else
features |= VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT;
features |= VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT |
VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT;
for (uint8_t plane = 0; plane < ycbcr_info->n_planes; plane++) {
const struct vk_format_ycbcr_plane *plane_info = &ycbcr_info->planes[plane];
if (plane_info->denominator_scales[0] > 1 ||
plane_info->denominator_scales[1] > 1)
features |= VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT;
features &= ~VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT;
}
/* The subsampled formats have no support for linear filters. */