From f087016e77a5fe574905b625f344b62eac070c96 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 24 May 2018 12:31:04 +0200 Subject: [PATCH] [dxgi] Add app-specific DXGI options --- src/dxgi/dxgi_options.cpp | 20 ++++++++++++++++++++ src/dxgi/dxgi_options.h | 30 ++++++++++++++++++++++++++++++ src/dxgi/meson.build | 1 + 3 files changed, 51 insertions(+) create mode 100644 src/dxgi/dxgi_options.cpp create mode 100644 src/dxgi/dxgi_options.h diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp new file mode 100644 index 000000000..94df5f808 --- /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 000000000..11c8c999b --- /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 cc76baebd..5dfc33478 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',