Support for refresh rate and sync interval (#2989)
* Add support for querying the refresh rate and sync interval
This commit is contained in:
@@ -17,19 +17,6 @@
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Math/MathUtils.h>
|
||||
|
||||
|
||||
void OnVsyncIntervalChanged(uint32_t const& interval)
|
||||
{
|
||||
AzFramework::WindowNotificationBus::Broadcast(
|
||||
&AzFramework::WindowNotificationBus::Events::OnVsyncIntervalChanged,
|
||||
AZ::GetClamp(interval, 0u, 4u));
|
||||
}
|
||||
|
||||
// NOTE: On change, broadcasts the new requested vsync interval to all windows.
|
||||
// The value of the vsync interval is constrained between 0 and 4
|
||||
// Vsync intervals greater than 1 are not currently supported on the Vulkan RHI (see #2061 for discussion)
|
||||
AZ_CVAR(uint32_t, rpi_vsync_interval, 1, OnVsyncIntervalChanged, AZ::ConsoleFunctorFlags::Null, "Set swapchain vsync interval");
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
namespace RPI
|
||||
@@ -158,9 +145,13 @@ namespace AZ
|
||||
|
||||
const RHI::WindowHandle windowHandle = RHI::WindowHandle(reinterpret_cast<uintptr_t>(m_windowHandle));
|
||||
|
||||
uint32_t syncInterval = 1;
|
||||
AzFramework::WindowRequestBus::EventResult(
|
||||
syncInterval, m_windowHandle, &AzFramework::WindowRequestBus::Events::GetSyncInterval);
|
||||
|
||||
RHI::SwapChainDescriptor descriptor;
|
||||
descriptor.m_window = windowHandle;
|
||||
descriptor.m_verticalSyncInterval = rpi_vsync_interval;
|
||||
descriptor.m_verticalSyncInterval = syncInterval;
|
||||
descriptor.m_dimensions.m_imageWidth = width;
|
||||
descriptor.m_dimensions.m_imageHeight = height;
|
||||
descriptor.m_dimensions.m_imageCount = 3;
|
||||
|
||||
Reference in New Issue
Block a user