From fdcbf67623c1ac5bad2de1d6a3e815f5a9652c0e Mon Sep 17 00:00:00 2001 From: Triang3l Date: Sat, 25 Jun 2022 15:46:02 +0300 Subject: [PATCH] [Vulkan] Enable VK_KHR_sampler_ycbcr_conversion --- src/xenia/ui/vulkan/vulkan_provider.cc | 10 ++++++++++ src/xenia/ui/vulkan/vulkan_provider.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/xenia/ui/vulkan/vulkan_provider.cc b/src/xenia/ui/vulkan/vulkan_provider.cc index 1e84bb14a..95c544925 100644 --- a/src/xenia/ui/vulkan/vulkan_provider.cc +++ b/src/xenia/ui/vulkan/vulkan_provider.cc @@ -701,6 +701,7 @@ bool VulkanProvider::Initialize() { std::memset(&device_extensions_, 0, sizeof(device_extensions_)); if (device_properties_.apiVersion >= VK_MAKE_API_VERSION(0, 1, 1, 0)) { device_extensions_.khr_dedicated_allocation = true; + device_extensions_.khr_sampler_ycbcr_conversion = true; if (device_properties_.apiVersion >= VK_MAKE_API_VERSION(0, 1, 2, 0)) { device_extensions_.khr_image_format_list = true; device_extensions_.khr_shader_float_controls = true; @@ -723,6 +724,13 @@ bool VulkanProvider::Initialize() { offsetof(DeviceExtensions, khr_image_format_list)}, {"VK_KHR_portability_subset", offsetof(DeviceExtensions, khr_portability_subset)}, + // While vkGetPhysicalDeviceFormatProperties should be used to check the + // format support (device support for Y'CbCr formats is not required by + // this extension or by Vulkan 1.1), still adding + // VK_KHR_sampler_ycbcr_conversion to this list to enable this extension + // on the device on Vulkan 1.0. + {"VK_KHR_sampler_ycbcr_conversion", + offsetof(DeviceExtensions, khr_sampler_ycbcr_conversion)}, {"VK_KHR_shader_float_controls", offsetof(DeviceExtensions, khr_shader_float_controls)}, {"VK_KHR_spirv_1_4", offsetof(DeviceExtensions, khr_spirv_1_4)}, @@ -982,6 +990,8 @@ bool VulkanProvider::Initialize() { XELOGVK(" * Triangle fans: {}", device_portability_subset_features_.triangleFans ? "yes" : "no"); } + XELOGVK("* VK_KHR_sampler_ycbcr_conversion: {}", + device_extensions_.khr_sampler_ycbcr_conversion ? "yes" : "no"); XELOGVK("* VK_KHR_shader_float_controls: {}", device_extensions_.khr_shader_float_controls ? "yes" : "no"); if (device_extensions_.khr_shader_float_controls) { diff --git a/src/xenia/ui/vulkan/vulkan_provider.h b/src/xenia/ui/vulkan/vulkan_provider.h index fce603635..0680b5766 100644 --- a/src/xenia/ui/vulkan/vulkan_provider.h +++ b/src/xenia/ui/vulkan/vulkan_provider.h @@ -139,6 +139,8 @@ class VulkanProvider : public GraphicsProvider { bool khr_image_format_list; // Requires the VK_KHR_get_physical_device_properties2 instance extension. bool khr_portability_subset; + // Core since 1.1.0. + bool khr_sampler_ycbcr_conversion; // Core since 1.2.0. bool khr_shader_float_controls; // Core since 1.2.0.