mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
Add refresh rate to window/mode info
This commit is contained in:
parent
935c73fb6c
commit
b811b78c09
|
@ -10,6 +10,7 @@
|
|||
#include "util.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
Log_SetChannel(Vulkan::SwapChain);
|
||||
|
||||
#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
|
@ -131,11 +132,14 @@ static VkSurfaceKHR CreateDisplaySurface(VkInstance instance, VkPhysicalDevice p
|
|||
const VkDisplayModePropertiesKHR* matched_mode = nullptr;
|
||||
for (const VkDisplayModePropertiesKHR& mode : modes)
|
||||
{
|
||||
Log_DevPrintf(" Mode %ux%u @ %u", mode.parameters.visibleRegion.width, mode.parameters.visibleRegion.height,
|
||||
mode.parameters.refreshRate);
|
||||
const float refresh_rate = static_cast<float>(mode.parameters.refreshRate) * 1000.0f;
|
||||
Log_DevPrintf(" Mode %ux%u @ %f", mode.parameters.visibleRegion.width, mode.parameters.visibleRegion.height,
|
||||
refresh_rate);
|
||||
|
||||
if (!matched_mode &&
|
||||
((wi.surface_width == 0 && wi.surface_height == 0) ||
|
||||
(mode.parameters.visibleRegion.width == wi.surface_width && mode.parameters.visibleRegion.height)))
|
||||
(mode.parameters.visibleRegion.width == wi.surface_width && mode.parameters.visibleRegion.height &&
|
||||
(wi.surface_refresh_rate == 0.0f || std::abs(refresh_rate - wi.surface_refresh_rate) < 0.1f))))
|
||||
{
|
||||
matched_mode = &mode;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ struct WindowInfo
|
|||
void* window_handle = nullptr;
|
||||
u32 surface_width = 0;
|
||||
u32 surface_height = 0;
|
||||
float surface_refresh_rate = 0.0f;
|
||||
float surface_scale = 1.0f;
|
||||
SurfaceFormat surface_format = SurfaceFormat::RGB8;
|
||||
|
||||
|
|
Loading…
Reference in a new issue