diff --git a/dxvk.conf b/dxvk.conf index 89d204d7..554f3b06 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -158,6 +158,16 @@ # d3d11.relaxedBarriers = False +# Ignores barriers around UAV writes from fragment shaders. +# +# This may improve performance in some games, but may also introduce +# rendering issues. Please don't report bugs with the option enabled. +# +# Supported values: True, False + +# d3d11.ignoreGraphicsBarriers = False + + # Overrides anisotropic filtering for all samplers. Set this to a positive # value to enable AF for all samplers in the game, or to 0 in order to # disable AF entirely. Negative values will have no effect. diff --git a/src/d3d11/d3d11_context_ext.cpp b/src/d3d11/d3d11_context_ext.cpp index b5a933b3..2f91c8bf 100644 --- a/src/d3d11/d3d11_context_ext.cpp +++ b/src/d3d11/d3d11_context_ext.cpp @@ -128,7 +128,10 @@ namespace dxvk { if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE) flags.set(DxvkBarrierControl::IgnoreWriteAfterWrite); - + + if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV) + flags.set(DxvkBarrierControl::IgnoreGraphicsBarriers); + m_ctx->EmitCs([cFlags = flags] (DxvkContext* ctx) { ctx->setBarrierControl(cFlags); }); diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 307110da..adaf2810 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -16,13 +16,21 @@ namespace dxvk { m_csThread(Device->createContext()), m_videoContext(this, Device) { EmitCs([ - cDevice = m_device, - cRelaxedBarriers = pParent->GetOptions()->relaxedBarriers + cDevice = m_device, + cRelaxedBarriers = pParent->GetOptions()->relaxedBarriers, + cIgnoreGraphicsBarriers = pParent->GetOptions()->ignoreGraphicsBarriers ] (DxvkContext* ctx) { ctx->beginRecording(cDevice->createCommandList()); + DxvkBarrierControlFlags barrierControl; + if (cRelaxedBarriers) - ctx->setBarrierControl(DxvkBarrierControl::IgnoreWriteAfterWrite); + barrierControl.set(DxvkBarrierControl::IgnoreWriteAfterWrite); + + if (cIgnoreGraphicsBarriers) + barrierControl.set(DxvkBarrierControl::IgnoreGraphicsBarriers); + + ctx->setBarrierControl(barrierControl); }); ClearState(); diff --git a/src/d3d11/d3d11_interfaces.h b/src/d3d11/d3d11_interfaces.h index 42b319a7..03d0ca55 100644 --- a/src/d3d11/d3d11_interfaces.h +++ b/src/d3d11/d3d11_interfaces.h @@ -22,6 +22,7 @@ enum D3D11_VK_EXTENSION : uint32_t { */ enum D3D11_VK_BARRIER_CONTROL : uint32_t { D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE = 1 << 0, + D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV = 1 << 1, }; diff --git a/src/d3d11/d3d11_options.cpp b/src/d3d11/d3d11_options.cpp index 486b078b..dac86465 100644 --- a/src/d3d11/d3d11_options.cpp +++ b/src/d3d11/d3d11_options.cpp @@ -12,6 +12,7 @@ namespace dxvk { this->zeroInitWorkgroupMemory = config.getOption("d3d11.zeroInitWorkgroupMemory", false); this->forceTgsmBarriers = config.getOption("d3d11.forceTgsmBarriers", false); this->relaxedBarriers = config.getOption("d3d11.relaxedBarriers", false); + this->ignoreGraphicsBarriers = config.getOption("d3d11.ignoreGraphicsBarriers", false); this->maxTessFactor = config.getOption("d3d11.maxTessFactor", 0); this->samplerAnisotropy = config.getOption("d3d11.samplerAnisotropy", -1); this->invariantPosition = config.getOption("d3d11.invariantPosition", true); diff --git a/src/d3d11/d3d11_options.h b/src/d3d11/d3d11_options.h index 8a109520..40a76aca 100644 --- a/src/d3d11/d3d11_options.h +++ b/src/d3d11/d3d11_options.h @@ -48,6 +48,12 @@ namespace dxvk { /// but might also cause rendering issues. bool relaxedBarriers; + /// Ignore graphics barriers + /// + /// May improve performance in some games, + /// but might also cause rendering issues. + bool ignoreGraphicsBarriers; + /// Maximum tessellation factor. /// /// Limits tessellation factors in tessellation