diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp new file mode 100644 index 00000000..94df5f80 --- /dev/null +++ b/src/dxgi/dxgi_options.cpp @@ -0,0 +1,20 @@ +#include "dxgi_options.h" + +#include + +namespace dxvk { + + const static std::unordered_map g_dxgiAppOptions = {{ + { "Frostpunk.exe", DxgiOptions(DxgiOption::DeferSurfaceCreation) }, + }}; + + + DxgiOptions getDxgiAppOptions(const std::string& appName) { + auto appOptions = g_dxgiAppOptions.find(appName); + + return appOptions != g_dxgiAppOptions.end() + ? appOptions->second + : DxgiOptions(); + } + +} \ No newline at end of file diff --git a/src/dxgi/dxgi_options.h b/src/dxgi/dxgi_options.h new file mode 100644 index 00000000..11c8c999 --- /dev/null +++ b/src/dxgi/dxgi_options.h @@ -0,0 +1,30 @@ +#pragma once + +#include "dxgi_include.h" + +namespace dxvk { + + /** + * \brief DXGI options + * + * Per-app options that control the + * behaviour of some DXGI classes. + */ + enum class DxgiOption : uint64_t { + /// Defer surface creation until first present call. This + /// fixes issues with games that create multiple swap chains + /// for a single window that may interfere with each other. + DeferSurfaceCreation, + }; + + using DxgiOptions = Flags; + + /** + * \brief Gets app-specific DXGI options + * + * \param [in] appName Application name + * \returns DXGI options for this application + */ + DxgiOptions getDxgiAppOptions(const std::string& appName); + +} diff --git a/src/dxgi/meson.build b/src/dxgi/meson.build index cc76baeb..5dfc3347 100644 --- a/src/dxgi/meson.build +++ b/src/dxgi/meson.build @@ -10,6 +10,7 @@ dxgi_src = [ 'dxgi_factory.cpp', 'dxgi_format.cpp', 'dxgi_main.cpp', + 'dxgi_options.cpp', 'dxgi_output.cpp', 'dxgi_presenter.cpp', 'dxgi_swapchain.cpp',