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

[d3d11] Added D3D11Options

Includes a per-app knob for Witcher 3 to disable D3D11_MAP_FLAG_DO_NOT_WAIT.
This commit is contained in:
Philip Rebohle 2018-03-24 17:02:24 +01:00
parent ac94c42380
commit bd69e843c2
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 15 additions and 4 deletions

View File

@ -220,10 +220,7 @@ namespace dxvk {
if (pResource->GetMapMode() == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) {
const VkImageType imageType = mappedImage->info().type;
// Wait for the resource to become available. Forwarding
// DO_NOT_WAIT would break The Witcher 3 for some reason.
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT;
// Wait for the resource to become available
if (!WaitForResource(mappedImage, MapFlags))
return DXGI_ERROR_WAS_STILL_DRAWING;
@ -346,6 +343,11 @@ namespace dxvk {
bool D3D11ImmediateContext::WaitForResource(
const Rc<DxvkResource>& Resource,
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::IgnoreMapFlagNoWait))
MapFlags &= ~D3D11_MAP_FLAG_DO_NOT_WAIT;
// Wait for the any pending D3D11 command to be executed
// on the CS thread so that we can determine whether the
// resource is currently in use or not.

View File

@ -25,6 +25,7 @@ namespace dxvk {
m_featureFlags (featureFlags),
m_dxvkDevice (m_dxgiDevice->GetDXVKDevice()),
m_dxvkAdapter (m_dxvkDevice->adapter()),
m_d3d11Options (D3D11GetAppOptions(env::getExeName())),
m_dxbcOptions (m_dxvkDevice) {
Com<IDXGIAdapter> adapter;

View File

@ -10,6 +10,7 @@
#include "../util/com/com_private_data.h"
#include "d3d11_interfaces.h"
#include "d3d11_options.h"
#include "d3d11_state.h"
#include "d3d11_util.h"
@ -283,6 +284,10 @@ namespace dxvk {
DXGI_FORMAT format,
DxgiFormatMode mode) const;
bool TestOption(D3D11Option Option) const {
return m_d3d11Options.test(Option);
}
static bool CheckFeatureLevelSupport(
const Rc<DxvkAdapter>& adapter,
D3D_FEATURE_LEVEL featureLevel);
@ -303,6 +308,7 @@ namespace dxvk {
const Rc<DxvkDevice> m_dxvkDevice;
const Rc<DxvkAdapter> m_dxvkAdapter;
const D3D11OptionSet m_d3d11Options;
const DxbcOptions m_dxbcOptions;
D3D11ImmediateContext* m_context = nullptr;

View File

@ -11,6 +11,7 @@ d3d11_src = [
'd3d11_enums.cpp',
'd3d11_input_layout.cpp',
'd3d11_main.cpp',
'd3d11_options.cpp',
'd3d11_present.cpp',
'd3d11_query.cpp',
'd3d11_rasterizer.cpp',

View File

@ -19,6 +19,7 @@
#include "../util/util_enum.h"
#include "../util/util_error.h"
#include "../util/util_flags.h"
#include "../util/util_math.h"
#include "../util/util_string.h"