[d3d11] Introduce d3d11.enableContextLock option

This commit is contained in:
Philip Rebohle 2022-08-24 12:27:02 +02:00
parent 86bdda70b4
commit 559fa50f54
6 changed files with 32 additions and 6 deletions

View File

@ -236,6 +236,14 @@
# d3d11.cachedDynamicResources = ""
# Force-enables the D3D11 context lock via the ID3D10Multithread
# interface. This may be useful to debug race conditions.
#
# Supported values: True, False
# d3d11.enableContextLock = False
# Sets number of pipeline compiler threads.
#
# If the graphics pipeline library feature is enabled, the given

View File

@ -6,9 +6,12 @@ namespace dxvk {
D3D10Multithread::D3D10Multithread(
IUnknown* pParent,
BOOL Protected)
BOOL Protected,
BOOL Force)
: m_parent (pParent),
m_protected (Protected) {
m_protected (Protected || Force),
m_enabled (Protected),
m_forced (Force) {
}
@ -49,12 +52,18 @@ namespace dxvk {
BOOL STDMETHODCALLTYPE D3D10Multithread::SetMultithreadProtected(
BOOL bMTProtect) {
return std::exchange(m_protected, bMTProtect);
BOOL result = m_enabled;
m_enabled = bMTProtect;
if (!m_forced)
m_protected = m_enabled;
return result;
}
BOOL STDMETHODCALLTYPE D3D10Multithread::GetMultithreadProtected() {
return m_protected;
return m_enabled;
}
}

View File

@ -64,7 +64,8 @@ namespace dxvk {
D3D10Multithread(
IUnknown* pParent,
BOOL Protected);
BOOL Protected,
BOOL Force);
~D3D10Multithread();
@ -95,6 +96,8 @@ namespace dxvk {
IUnknown* m_parent;
BOOL m_protected;
BOOL m_enabled;
BOOL m_forced;
sync::RecursiveSpinlock m_mutex;

View File

@ -18,7 +18,7 @@ namespace dxvk {
: D3D11CommonContext<D3D11ImmediateContext>(pParent, Device, 0, DxvkCsChunkFlag::SingleUse),
m_csThread(Device, Device->createContext(DxvkContextType::Primary)),
m_maxImplicitDiscardSize(pParent->GetOptions()->maxImplicitDiscardSize),
m_multithread(this, false),
m_multithread(this, false, pParent->GetOptions()->enableContextLock),
m_videoContext(this, Device) {
EmitCs([
cDevice = m_device,

View File

@ -25,6 +25,7 @@ namespace dxvk {
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);
this->floatControls = config.getOption<bool>("d3d11.floatControls", true);
this->disableMsaa = config.getOption<bool>("d3d11.disableMsaa", false);
this->enableContextLock = config.getOption<bool>("d3d11.enableContextLock", false);
this->deferSurfaceCreation = config.getOption<bool>("dxgi.deferSurfaceCreation", false);
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);

View File

@ -111,6 +111,11 @@ namespace dxvk {
/// in cached system memory. Enabled automatically when recording
/// an api trace.
uint32_t cachedDynamicResources;
/// Always lock immediate context on every API call. May be
/// useful for debugging purposes or when applications have
/// race conditions.
bool enableContextLock;
};
}