[d3d11] Introduce d3d11.ignoreGraphicsBarriers option

This commit is contained in:
Philip Rebohle 2021-09-08 15:20:01 +02:00
parent 5109000747
commit 67391a7bb0
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
6 changed files with 33 additions and 4 deletions

View File

@ -158,6 +158,16 @@
# d3d11.relaxedBarriers = False # 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 # 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 # 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. # disable AF entirely. Negative values will have no effect.

View File

@ -128,7 +128,10 @@ namespace dxvk {
if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE) if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE)
flags.set(DxvkBarrierControl::IgnoreWriteAfterWrite); flags.set(DxvkBarrierControl::IgnoreWriteAfterWrite);
if (ControlFlags & D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV)
flags.set(DxvkBarrierControl::IgnoreGraphicsBarriers);
m_ctx->EmitCs([cFlags = flags] (DxvkContext* ctx) { m_ctx->EmitCs([cFlags = flags] (DxvkContext* ctx) {
ctx->setBarrierControl(cFlags); ctx->setBarrierControl(cFlags);
}); });

View File

@ -16,13 +16,21 @@ namespace dxvk {
m_csThread(Device->createContext()), m_csThread(Device->createContext()),
m_videoContext(this, Device) { m_videoContext(this, Device) {
EmitCs([ EmitCs([
cDevice = m_device, cDevice = m_device,
cRelaxedBarriers = pParent->GetOptions()->relaxedBarriers cRelaxedBarriers = pParent->GetOptions()->relaxedBarriers,
cIgnoreGraphicsBarriers = pParent->GetOptions()->ignoreGraphicsBarriers
] (DxvkContext* ctx) { ] (DxvkContext* ctx) {
ctx->beginRecording(cDevice->createCommandList()); ctx->beginRecording(cDevice->createCommandList());
DxvkBarrierControlFlags barrierControl;
if (cRelaxedBarriers) if (cRelaxedBarriers)
ctx->setBarrierControl(DxvkBarrierControl::IgnoreWriteAfterWrite); barrierControl.set(DxvkBarrierControl::IgnoreWriteAfterWrite);
if (cIgnoreGraphicsBarriers)
barrierControl.set(DxvkBarrierControl::IgnoreGraphicsBarriers);
ctx->setBarrierControl(barrierControl);
}); });
ClearState(); ClearState();

View File

@ -22,6 +22,7 @@ enum D3D11_VK_EXTENSION : uint32_t {
*/ */
enum D3D11_VK_BARRIER_CONTROL : uint32_t { enum D3D11_VK_BARRIER_CONTROL : uint32_t {
D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE = 1 << 0, D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE = 1 << 0,
D3D11_VK_BARRIER_CONTROL_IGNORE_GRAPHICS_UAV = 1 << 1,
}; };

View File

@ -12,6 +12,7 @@ namespace dxvk {
this->zeroInitWorkgroupMemory = config.getOption<bool>("d3d11.zeroInitWorkgroupMemory", false); this->zeroInitWorkgroupMemory = config.getOption<bool>("d3d11.zeroInitWorkgroupMemory", false);
this->forceTgsmBarriers = config.getOption<bool>("d3d11.forceTgsmBarriers", false); this->forceTgsmBarriers = config.getOption<bool>("d3d11.forceTgsmBarriers", false);
this->relaxedBarriers = config.getOption<bool>("d3d11.relaxedBarriers", false); this->relaxedBarriers = config.getOption<bool>("d3d11.relaxedBarriers", false);
this->ignoreGraphicsBarriers = config.getOption<bool>("d3d11.ignoreGraphicsBarriers", false);
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0); this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1); this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true); this->invariantPosition = config.getOption<bool>("d3d11.invariantPosition", true);

View File

@ -48,6 +48,12 @@ namespace dxvk {
/// but might also cause rendering issues. /// but might also cause rendering issues.
bool relaxedBarriers; bool relaxedBarriers;
/// Ignore graphics barriers
///
/// May improve performance in some games,
/// but might also cause rendering issues.
bool ignoreGraphicsBarriers;
/// Maximum tessellation factor. /// Maximum tessellation factor.
/// ///
/// Limits tessellation factors in tessellation /// Limits tessellation factors in tessellation