1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxgi] Add app-specific DXGI options

This commit is contained in:
Philip Rebohle 2018-05-24 12:31:04 +02:00
parent a43025294a
commit f087016e77
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 51 additions and 0 deletions

20
src/dxgi/dxgi_options.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "dxgi_options.h"
#include <unordered_map>
namespace dxvk {
const static std::unordered_map<std::string, DxgiOptions> 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();
}
}

30
src/dxgi/dxgi_options.h Normal file
View File

@ -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<DxgiOption>;
/**
* \brief Gets app-specific DXGI options
*
* \param [in] appName Application name
* \returns DXGI options for this application
*/
DxgiOptions getDxgiAppOptions(const std::string& appName);
}

View File

@ -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',