From cebe991e953bfe0dd38e4f6efdbb7d56bc1dcde0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 24 May 2023 19:43:39 +0200 Subject: [PATCH] render/vulkan: split off YCbCr texture features Avoids repeating the common bits between dma_tex_features and dma_tex_ycbcr_features, and we will need just the YCbCr-related flags for shm YCbCr support soon. --- render/vulkan/pixel_format.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/render/vulkan/pixel_format.c b/render/vulkan/pixel_format.c index 7d89f81ae..3915075ee 100644 --- a/render/vulkan/pixel_format.c +++ b/render/vulkan/pixel_format.c @@ -253,10 +253,8 @@ static const VkFormatFeatureFlags dma_tex_features = // NOTE: we don't strictly require this, we could create a NEAREST // sampler for formats that need it, in case this ever makes problems. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT; -static const VkFormatFeatureFlags dma_tex_ycbcr_features = - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | +static const VkFormatFeatureFlags ycbcr_tex_features = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT | - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT | VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT; static bool query_modifier_usage_support(struct wlr_vk_device *dev, VkFormat vk_format, @@ -375,7 +373,10 @@ static bool query_modifier_support(struct wlr_vk_device *dev, // check that specific modifier for texture usage errmsg = "unknown error"; - VkFormatFeatureFlags features = props->format.is_ycbcr ? dma_tex_ycbcr_features : dma_tex_features; + VkFormatFeatureFlags features = dma_tex_features; + if (props->format.is_ycbcr) { + features |= ycbcr_tex_features; + } if ((m.drmFormatModifierTilingFeatures & features) == features) { struct wlr_vk_format_modifier_props p = {0}; if (query_modifier_usage_support(dev, props->format.vk, dma_tex_usage, &m, &p, &errmsg)) {