diff --git a/UnleashedRecomp/config.cpp b/UnleashedRecomp/config.cpp index b4c5357..00c412c 100644 --- a/UnleashedRecomp/config.cpp +++ b/UnleashedRecomp/config.cpp @@ -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); diff --git a/UnleashedRecomp/config.h b/UnleashedRecomp/config.h index d6159d9..58a3e14 100644 --- a/UnleashedRecomp/config.h +++ b/UnleashedRecomp/config.h @@ -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; diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index f872744..c3c6ad3 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -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 g_interface; static std::unique_ptr 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(); diff --git a/UnleashedRecomp/res/config.toml b/UnleashedRecomp/res/config.toml index 2b65155..6f9df20 100644 --- a/UnleashedRecomp/res/config.toml +++ b/UnleashedRecomp/res/config.toml @@ -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