Skip to content

Commit

Permalink
[vulkan] Add supportsColorSpace method to Presenter
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad authored and doitsujin committed Dec 19, 2022
1 parent fd661d5 commit 50054d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/vulkan/vulkan_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ namespace dxvk::vk {
}


bool Presenter::supportsColorSpace(VkColorSpaceKHR colorspace) {
std::vector<VkSurfaceFormatKHR> 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);
}
Expand Down
8 changes: 8 additions & 0 deletions src/vulkan/vulkan_presenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<InstanceFn> m_vki;
Expand Down

0 comments on commit 50054d4

Please sign in to comment.