Remove triple buffering from options menu, turn it to an enum.

This commit is contained in:
Skyth 2024-11-22 14:59:39 +03:00
parent 0f5b71f1d5
commit e3f7eba9a6
5 changed files with 31 additions and 8 deletions

View file

@ -51,7 +51,7 @@ public:
});
CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true);
CONFIG_DEFINE_LOCALISED("Video", bool, TripleBuffering, true);
CONFIG_DEFINE_ENUM("Video", ETripleBuffering, TripleBuffering, ETripleBuffering::Auto);
CONFIG_DEFINE_LOCALISED("Video", int32_t, FPS, 60);
CONFIG_DEFINE_LOCALISED("Video", float, Brightness, 0.5f);
CONFIG_DEFINE_ENUM_LOCALISED("Video", EAntiAliasing, AntiAliasing, EAntiAliasing::MSAA4x);

View file

@ -122,6 +122,20 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EAspectRatio)
{ "16:9", EAspectRatio::Widescreen }
};
enum class ETripleBuffering : uint32_t
{
Auto,
On,
Off
};
CONFIG_DEFINE_ENUM_TEMPLATE(ETripleBuffering)
{
{ "Auto", ETripleBuffering::Auto },
{ "On", ETripleBuffering::On },
{ "Off", ETripleBuffering::Off }
};
enum class EAntiAliasing : uint32_t
{
None = 0,

View file

@ -1149,7 +1149,22 @@ static void CreateHostDevice()
g_copyCommandList = g_device->createCommandList(RenderCommandListType::COPY);
g_copyCommandFence = g_device->createCommandFence();
g_swapChain = g_queue->createSwapChain(Window::s_handle, Config::TripleBuffering ? 3 : 2, BACKBUFFER_FORMAT);
uint32_t bufferCount = 2;
switch (Config::TripleBuffering)
{
case ETripleBuffering::Auto:
bufferCount = g_vulkan ? 2 : 3; // Defaulting to 3 is fine on D3D12 thanks to flip discard model.
break;
case ETripleBuffering::On:
bufferCount = 3;
break;
case ETripleBuffering::Off:
bufferCount = 2;
break;
}
g_swapChain = g_queue->createSwapChain(Window::s_handle, bufferCount, BACKBUFFER_FORMAT);
g_swapChain->setVsyncEnabled(Config::VSync);
g_swapChainValid = !g_swapChain->needsResize();

View file

@ -222,11 +222,6 @@ CONFIG_DEFINE_LOCALE(VSync)
{ ELanguage::English, { "V-Sync", "[PLACEHOLDER]" } }
};
CONFIG_DEFINE_LOCALE(TripleBuffering)
{
{ ELanguage::English, { "Triple Buffering", "[PLACEHOLDER]" } }
};
CONFIG_DEFINE_LOCALE(FPS)
{
{ ELanguage::English, { "FPS", "[PLACEHOLDER]" } }

View file

@ -877,7 +877,6 @@ static void DrawConfigOptions()
DrawConfigOption(rowCount++, yOffset, &Config::ResolutionScale, true, nullptr, 0.25f, 1.0f, 2.0f);
DrawConfigOption(rowCount++, yOffset, &Config::Fullscreen, true);
DrawConfigOption(rowCount++, yOffset, &Config::VSync, true);
DrawConfigOption(rowCount++, yOffset, &Config::TripleBuffering, true);
DrawConfigOption(rowCount++, yOffset, &Config::FPS, true, nullptr, 15, 120, 240);
DrawConfigOption(rowCount++, yOffset, &Config::Brightness, true);
DrawConfigOption(rowCount++, yOffset, &Config::AntiAliasing, true);