Skip to content

Commit 679e090

Browse files
committed
disp/vulkan: Don't use yuv sampler if linear filter unavailable
1 parent e2b42a3 commit 679e090

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/video_display/vulkan/vulkan_display.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,20 @@ class AtScopeExit {
199199
bool is_format_supported(vk::PhysicalDevice gpu, bool is_yCbCr_supported, vk::Extent2D size, vk::Format format,
200200
vk::ImageTiling tiling, vk::ImageUsageFlags usage_flags)
201201
{
202-
if (!is_yCbCr_supported && is_yCbCr_format(format)){
203-
return false;
202+
if(is_yCbCr_format(format)){
203+
if(!is_yCbCr_supported)
204+
return false;
205+
206+
vk::FormatProperties fmt_props = {};
207+
gpu.getFormatProperties(format, &fmt_props);
208+
209+
if(!(fmt_props.optimalTilingFeatures & vk::FormatFeatureFlagBits::eSampledImageYcbcrConversionLinearFilter))
210+
{
211+
vulkan_log_msg(LogLevel::warning, "The GPU does not support linear filter with a YCbCr conversion sampler. Will attempt to fall back to shader conversion.\n");
212+
return false;
213+
}
204214
}
215+
205216
vk::ImageFormatProperties properties;
206217
auto result = gpu.getImageFormatProperties(
207218
format,

0 commit comments

Comments
 (0)