1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[dxbc] Add option to force memory barriers after shared memory stores

This commit is contained in:
Philip Rebohle 2020-02-07 22:47:06 +01:00
parent 2f8fbf9114
commit 76a6f6eab9
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 21 additions and 0 deletions

View File

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

View File

@ -35,6 +35,13 @@ namespace dxvk {
/// TGSM in compute shaders before reading it.
bool zeroInitWorkgroupMemory;
/// Force thread-group shared memory barriers
///
/// Workaround for compute shaders that read and
/// write from the same shared memory location
/// without explicit synchronization.
bool forceTgsmBarriers;
/// Use relaxed memory barriers
///
/// May improve performance in some games,

View File

@ -5222,6 +5222,15 @@ namespace dxvk {
}
}
// Make sure that shared memory stores are made visible in
// case the game does not synchronize invocations properly
if (isTgsm && m_moduleInfo.options.forceTgsmBarriers) {
m_module.opMemoryBarrier(
m_module.constu32(spv::ScopeWorkgroup),
m_module.constu32(spv::MemorySemanticsWorkgroupMemoryMask
| spv::MemorySemanticsAcquireReleaseMask));
}
// End conditional block
if (!isTgsm) {
m_module.opBranch(cond.labelEnd);

View File

@ -40,6 +40,7 @@ namespace dxvk {
invariantPosition = options.invariantPosition;
enableRtOutputNanFixup = options.enableRtOutputNanFixup;
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
forceTgsmBarriers = options.forceTgsmBarriers;
dynamicIndexedConstantBufferAsSsbo = options.constantBufferRangeCheck;
// Disable early discard on RADV (with LLVM) due to GPU hangs

View File

@ -45,6 +45,9 @@ namespace dxvk {
/// Declare vertex positions as invariant
bool invariantPosition = false;
/// Insert memory barriers after TGSM stoes
bool forceTgsmBarriers = false;
/// Minimum storage buffer alignment
VkDeviceSize minSsboAlignment = 0;
};