Make graphics API configurable.

This commit is contained in:
Skyth 2024-10-20 23:20:52 +03:00
parent 02964750ad
commit b39bc1e065
4 changed files with 13 additions and 1 deletions

View file

@ -30,6 +30,7 @@ void Config::Load()
TOML_BEGIN_SECTION("Video")
{
TOML_READ_ENUM(EGraphicsAPI, GraphicsAPI);
TOML_READ_INTEGER(WindowWidth);
TOML_READ_INTEGER(WindowHeight);
TOML_READ_FLOAT(ResolutionScale);

View file

@ -43,6 +43,12 @@ enum EUIScaleMode : uint32_t
EUIScaleMode_Centre
};
enum EGraphicsAPI
{
GraphicsAPI_D3D12,
GraphicsAPI_Vulkan
};
class Config
{
public:
@ -62,6 +68,7 @@ public:
inline static bool WerehogBattleMusic = true;
// Video
inline static EGraphicsAPI GraphicsAPI = GraphicsAPI_D3D12;
inline static uint32_t WindowWidth = 1280;
inline static uint32_t WindowHeight = 720;
inline static float ResolutionScale = 1.0f;

View file

@ -126,7 +126,7 @@ static FORCEINLINE void SetDirtyValue(bool& dirtyState, T& dest, const T& src)
}
}
static bool g_vulkan = false;
static bool g_vulkan;
static std::unique_ptr<RenderInterface> g_interface;
static std::unique_ptr<RenderDevice> g_device;
@ -544,6 +544,9 @@ static void CreateHostDevice()
g_inputSlots[i].index = i;
Window::Init();
g_vulkan = Config::GraphicsAPI == GraphicsAPI_Vulkan;
LoadShaderCache();
g_interface = g_vulkan ? CreateVulkanInterface() : CreateD3D12Interface();

View file

@ -17,6 +17,7 @@ UnleashCancel = false # Determines whether Unleash can be cancelled b
WerehogBattleMusic = true # Determines whether to play the battle theme for enemy encounters as the Werehog.
[Video]
GraphicsAPI = 0 # 0 - D3D12; 1 - Vulkan
WindowWidth = 1280
WindowHeight = 720
ResolutionScale = 1.0