From e56710e64fb41e23a8631b2695fe58f97a353063 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 7 Feb 2019 00:57:21 +0100 Subject: [PATCH] [d3d11] Add option to disable write-after-write barriers --- src/d3d11/d3d11_context_imm.cpp | 8 +++++++- src/d3d11/d3d11_options.cpp | 1 + src/d3d11/d3d11_options.h | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index bd3ba714d..df6f89c98 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -13,8 +13,14 @@ namespace dxvk { const Rc& Device) : D3D11DeviceContext(pParent, Device, DxvkCsChunkFlag::SingleUse), m_csThread(Device->createContext()) { - EmitCs([cDevice = m_device] (DxvkContext* ctx) { + EmitCs([ + cDevice = m_device, + cRelaxedBarriers = pParent->GetOptions()->relaxedBarriers + ] (DxvkContext* ctx) { ctx->beginRecording(cDevice->createCommandList()); + + if (cRelaxedBarriers) + ctx->setBarrierControl(DxvkBarrierControl::IgnoreWriteAfterWrite); }); ClearState(); diff --git a/src/d3d11/d3d11_options.cpp b/src/d3d11/d3d11_options.cpp index aa827ca41..ebcdd5ad4 100644 --- a/src/d3d11/d3d11_options.cpp +++ b/src/d3d11/d3d11_options.cpp @@ -9,6 +9,7 @@ namespace dxvk { this->dcSingleUseMode = config.getOption("d3d11.dcSingleUseMode", true); this->strictDivision = config.getOption("d3d11.strictDivision", false); this->zeroInitWorkgroupMemory = config.getOption("d3d11.zeroInitWorkgroupMemory", false); + this->relaxedBarriers = config.getOption("d3d11.relaxedBarriers", false); this->maxTessFactor = config.getOption("d3d11.maxTessFactor", 0); this->samplerAnisotropy = config.getOption("d3d11.samplerAnisotropy", -1); this->deferSurfaceCreation = config.getOption("dxgi.deferSurfaceCreation", false); diff --git a/src/d3d11/d3d11_options.h b/src/d3d11/d3d11_options.h index 58d32341f..4b738de82 100644 --- a/src/d3d11/d3d11_options.h +++ b/src/d3d11/d3d11_options.h @@ -36,6 +36,12 @@ namespace dxvk { /// TGSM in compute shaders before reading it. bool zeroInitWorkgroupMemory; + /// Use relaxed memory barriers + /// + /// May improve performance in some games, + /// but might also cause rendering issues. + bool relaxedBarriers; + /// Maximum tessellation factor. /// /// Limits tessellation factors in tessellation