1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Use global user config for D3D11 options

This commit is contained in:
Philip Rebohle 2018-08-07 14:58:08 +02:00
parent 524ff9e233
commit dc31be7118
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 33 additions and 55 deletions

View File

@ -514,7 +514,7 @@ namespace dxvk {
UINT MapFlags) { UINT MapFlags) {
// Some games (e.g. The Witcher 3) do not work correctly // Some games (e.g. The Witcher 3) do not work correctly
// when a map fails with D3D11_MAP_FLAG_DO_NOT_WAIT set // when a map fails with D3D11_MAP_FLAG_DO_NOT_WAIT set
if (!m_parent->TestOption(D3D11Option::AllowMapFlagNoWait)) if (!m_parent->GetOptions()->allowMapFlagNoWait)
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT; MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT;
// Wait for the any pending D3D11 command to be executed // Wait for the any pending D3D11 command to be executed

View File

@ -1,6 +1,9 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include "../dxvk/dxvk_adapter.h"
#include "../dxvk/dxvk_instance.h"
#include "d3d11_buffer.h" #include "d3d11_buffer.h"
#include "d3d11_class_linkage.h" #include "d3d11_class_linkage.h"
#include "d3d11_context_def.h" #include "d3d11_context_def.h"
@ -93,7 +96,7 @@ namespace dxvk {
m_featureFlags (FeatureFlags), m_featureFlags (FeatureFlags),
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()), m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
m_dxvkAdapter (m_dxvkDevice->adapter()), m_dxvkAdapter (m_dxvkDevice->adapter()),
m_d3d11Options (D3D11GetAppOptions(env::getExeName())), m_d3d11Options (m_dxvkAdapter->instance()->config()),
m_dxbcOptions (getDxbcAppOptions(env::getExeName()) | m_dxbcOptions (getDxbcAppOptions(env::getExeName()) |
getDxbcDeviceOptions(m_dxvkDevice)) { getDxbcDeviceOptions(m_dxvkDevice)) {
Com<IDXGIAdapter> adapter; Com<IDXGIAdapter> adapter;
@ -661,7 +664,7 @@ namespace dxvk {
// Returning S_OK instead of an error fixes some issues // Returning S_OK instead of an error fixes some issues
// with Overwatch until this is properly implemented // with Overwatch until this is properly implemented
return m_d3d11Options.test(D3D11Option::FakeStreamOutSupport) ? S_OK : E_NOTIMPL; return m_d3d11Options.fakeStreamOutSupport ? S_OK : E_NOTIMPL;
} }

View File

@ -337,8 +337,8 @@ namespace dxvk {
m_uavCounters->FreeSlice(Slice); m_uavCounters->FreeSlice(Slice);
} }
bool TestOption(D3D11Option Option) const { const D3D11Options* GetOptions() const {
return m_d3d11Options.test(Option); return &m_d3d11Options;
} }
static bool CheckFeatureLevelSupport( static bool CheckFeatureLevelSupport(
@ -360,7 +360,7 @@ namespace dxvk {
const Rc<DxvkDevice> m_dxvkDevice; const Rc<DxvkDevice> m_dxvkDevice;
const Rc<DxvkAdapter> m_dxvkAdapter; const Rc<DxvkAdapter> m_dxvkAdapter;
const D3D11OptionSet m_d3d11Options; const D3D11Options m_d3d11Options;
const DxbcOptions m_dxbcOptions; const DxbcOptions m_dxbcOptions;
D3D11Initializer* m_initializer = nullptr; D3D11Initializer* m_initializer = nullptr;

View File

@ -4,22 +4,9 @@
namespace dxvk { namespace dxvk {
const static std::unordered_map<std::string, D3D11OptionSet> g_d3d11AppOptions = {{ D3D11Options::D3D11Options(const Config& config) {
{ "Dishonored2.exe", D3D11OptionSet(D3D11Option::AllowMapFlagNoWait) }, this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", false);
{ "FarCry5.exe", D3D11OptionSet(D3D11Option::AllowMapFlagNoWait) }, this->fakeStreamOutSupport = config.getOption<bool>("d3d11.fakeStreamOutSupport", false);
{ "ffxv_s.exe", D3D11OptionSet(D3D11Option::FakeStreamOutSupport) },
{ "Overwatch.exe", D3D11OptionSet(D3D11Option::FakeStreamOutSupport) },
{ "F1_2015.exe", D3D11OptionSet(D3D11Option::FakeStreamOutSupport) },
{ "Mafia3.exe", D3D11OptionSet(D3D11Option::FakeStreamOutSupport) },
}};
D3D11OptionSet D3D11GetAppOptions(const std::string& AppName) {
auto appOptions = g_d3d11AppOptions.find(AppName);
return appOptions != g_d3d11AppOptions.end()
? appOptions->second
: D3D11OptionSet();
} }
} }

View File

@ -1,40 +1,28 @@
#pragma once #pragma once
#include "../util/config/config.h"
#include "d3d11_include.h" #include "d3d11_include.h"
namespace dxvk { namespace dxvk {
enum class D3D11Option : uint64_t { struct D3D11Options {
/** D3D11Options(const Config& config);
* \brief Handle D3D11_MAP_FLAG_DO_NOT_WAIT properly /// Handle D3D11_MAP_FLAG_DO_NOT_WAIT properly.
* ///
* This can offer substantial speedups, but some games /// This can offer substantial speedups, but some games
* (The Witcher 3, Elder Scrolls Online, possibly others) /// (The Witcher 3, Elder Scrolls Online, possibly others)
* seem to make incorrect assumptions about when a map /// seem to make incorrect assumptions about when a map
* operation succeeds when that flag is set. /// operation succeeds when that flag is set.
*/ bool allowMapFlagNoWait;
AllowMapFlagNoWait = 0,
/** /// Fakes stream output support.
* \brief Fakes stream output support ///
* /// Temporary hack that fixes issues in some games
* Temporary hack that fixes issues in some games /// which technically need stream output but work
* which technically need stream output but work /// well enough without it. Will be removed once
* well enough without it. Will be removed once /// Stream Output is properly supported in DXVK.
* Stream Output is properly supported in DXVK. bool fakeStreamOutSupport;
*/
FakeStreamOutSupport = 63,
}; };
using D3D11OptionSet = Flags<D3D11Option>;
/**
* \brief Retrieves per-app options
*
* \param [in] AppName Executable name
* \returns D3D11 options
*/
D3D11OptionSet D3D11GetAppOptions(const std::string& AppName);
} }