From 50054d4675e3e8f490a6fc86c4bc9ea28ec0b0c3 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sun, 18 Dec 2022 22:59:20 +0000 Subject: [PATCH] [vulkan] Add supportsColorSpace method to Presenter --- src/vulkan/vulkan_presenter.cpp | 13 +++++++++++++ src/vulkan/vulkan_presenter.h | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/src/vulkan/vulkan_presenter.cpp b/src/vulkan/vulkan_presenter.cpp index 0a10676ea..5bcebfaec 100644 --- a/src/vulkan/vulkan_presenter.cpp +++ b/src/vulkan/vulkan_presenter.cpp @@ -220,6 +220,19 @@ namespace dxvk::vk { } + bool Presenter::supportsColorSpace(VkColorSpaceKHR colorspace) { + std::vector surfaceFormats; + getSupportedFormats(surfaceFormats, VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT); + + for (const auto& surfaceFormat : surfaceFormats) { + if (surfaceFormat.colorSpace == colorspace) + return true; + } + + return false; + } + + void Presenter::setFrameRateLimit(double frameRate) { m_fpsLimiter.setTargetFrameRate(frameRate); } diff --git a/src/vulkan/vulkan_presenter.h b/src/vulkan/vulkan_presenter.h index 170d81c38..0de46d44c 100644 --- a/src/vulkan/vulkan_presenter.h +++ b/src/vulkan/vulkan_presenter.h @@ -183,6 +183,14 @@ namespace dxvk::vk { return m_swapchain; } + /** + * \brief Checks if a presenter supports the colorspace + * + * \param [in] colorspace The colorspace to test + * * \returns \c true if the presenter supports the colorspace + */ + bool supportsColorSpace(VkColorSpaceKHR colorspace); + private: Rc m_vki;