mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-18 13:54:16 +01:00
[d3d11] Use global user config for D3D11 options
This commit is contained in:
parent
524ff9e233
commit
dc31be7118
@ -514,7 +514,7 @@ namespace dxvk {
|
||||
UINT MapFlags) {
|
||||
// Some games (e.g. The Witcher 3) do not work correctly
|
||||
// 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;
|
||||
|
||||
// Wait for the any pending D3D11 command to be executed
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "../dxvk/dxvk_adapter.h"
|
||||
#include "../dxvk/dxvk_instance.h"
|
||||
|
||||
#include "d3d11_buffer.h"
|
||||
#include "d3d11_class_linkage.h"
|
||||
#include "d3d11_context_def.h"
|
||||
@ -93,7 +96,7 @@ namespace dxvk {
|
||||
m_featureFlags (FeatureFlags),
|
||||
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
|
||||
m_dxvkAdapter (m_dxvkDevice->adapter()),
|
||||
m_d3d11Options (D3D11GetAppOptions(env::getExeName())),
|
||||
m_d3d11Options (m_dxvkAdapter->instance()->config()),
|
||||
m_dxbcOptions (getDxbcAppOptions(env::getExeName()) |
|
||||
getDxbcDeviceOptions(m_dxvkDevice)) {
|
||||
Com<IDXGIAdapter> adapter;
|
||||
@ -661,7 +664,7 @@ namespace dxvk {
|
||||
|
||||
// Returning S_OK instead of an error fixes some issues
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -336,9 +336,9 @@ namespace dxvk {
|
||||
void FreeCounterSlice(const DxvkBufferSlice& Slice) {
|
||||
m_uavCounters->FreeSlice(Slice);
|
||||
}
|
||||
|
||||
bool TestOption(D3D11Option Option) const {
|
||||
return m_d3d11Options.test(Option);
|
||||
|
||||
const D3D11Options* GetOptions() const {
|
||||
return &m_d3d11Options;
|
||||
}
|
||||
|
||||
static bool CheckFeatureLevelSupport(
|
||||
@ -353,14 +353,14 @@ namespace dxvk {
|
||||
|
||||
IDXGIObject* m_container;
|
||||
Com<IDXGIVkAdapter> m_dxgiAdapter;
|
||||
|
||||
|
||||
const D3D_FEATURE_LEVEL m_featureLevel;
|
||||
const UINT m_featureFlags;
|
||||
|
||||
const Rc<DxvkDevice> m_dxvkDevice;
|
||||
const Rc<DxvkAdapter> m_dxvkAdapter;
|
||||
|
||||
const D3D11OptionSet m_d3d11Options;
|
||||
const D3D11Options m_d3d11Options;
|
||||
const DxbcOptions m_dxbcOptions;
|
||||
|
||||
D3D11Initializer* m_initializer = nullptr;
|
||||
|
@ -4,22 +4,9 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
const static std::unordered_map<std::string, D3D11OptionSet> g_d3d11AppOptions = {{
|
||||
{ "Dishonored2.exe", D3D11OptionSet(D3D11Option::AllowMapFlagNoWait) },
|
||||
{ "FarCry5.exe", D3D11OptionSet(D3D11Option::AllowMapFlagNoWait) },
|
||||
{ "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();
|
||||
D3D11Options::D3D11Options(const Config& config) {
|
||||
this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", false);
|
||||
this->fakeStreamOutSupport = config.getOption<bool>("d3d11.fakeStreamOutSupport", false);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "../util/config/config.h"
|
||||
|
||||
#include "d3d11_include.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
enum class D3D11Option : uint64_t {
|
||||
/**
|
||||
* \brief Handle D3D11_MAP_FLAG_DO_NOT_WAIT properly
|
||||
*
|
||||
* This can offer substantial speedups, but some games
|
||||
* (The Witcher 3, Elder Scrolls Online, possibly others)
|
||||
* seem to make incorrect assumptions about when a map
|
||||
* operation succeeds when that flag is set.
|
||||
*/
|
||||
AllowMapFlagNoWait = 0,
|
||||
|
||||
/**
|
||||
* \brief Fakes stream output support
|
||||
*
|
||||
* Temporary hack that fixes issues in some games
|
||||
* which technically need stream output but work
|
||||
* well enough without it. Will be removed once
|
||||
* Stream Output is properly supported in DXVK.
|
||||
*/
|
||||
FakeStreamOutSupport = 63,
|
||||
struct D3D11Options {
|
||||
D3D11Options(const Config& config);
|
||||
/// Handle D3D11_MAP_FLAG_DO_NOT_WAIT properly.
|
||||
///
|
||||
/// This can offer substantial speedups, but some games
|
||||
/// (The Witcher 3, Elder Scrolls Online, possibly others)
|
||||
/// seem to make incorrect assumptions about when a map
|
||||
/// operation succeeds when that flag is set.
|
||||
bool allowMapFlagNoWait;
|
||||
|
||||
/// Fakes stream output support.
|
||||
///
|
||||
/// Temporary hack that fixes issues in some games
|
||||
/// which technically need stream output but work
|
||||
/// well enough without it. Will be removed once
|
||||
/// Stream Output is properly supported in DXVK.
|
||||
bool fakeStreamOutSupport;
|
||||
};
|
||||
|
||||
using D3D11OptionSet = Flags<D3D11Option>;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retrieves per-app options
|
||||
*
|
||||
* \param [in] AppName Executable name
|
||||
* \returns D3D11 options
|
||||
*/
|
||||
D3D11OptionSet D3D11GetAppOptions(const std::string& AppName);
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user