1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-17 17:52:11 +01:00

[dxbc] Fix explicit memory barrier semantics

This imitates glslang behaviour for barrier instructions and
sets AcquireRelease semantics for all explicit memory barriers.
This commit is contained in:
Philip Rebohle 2018-03-30 17:59:57 +02:00
parent 47e78d0a95
commit 770d94f796

View File

@ -2153,8 +2153,8 @@ namespace dxvk {
// scope is defined by the operand control bits.
const DxbcSyncFlags flags = ins.controls.syncFlags;
uint32_t executionScope = 0;
uint32_t memoryScope = 0;
uint32_t executionScope = spv::ScopeInvocation;
uint32_t memoryScope = spv::ScopeInvocation;
uint32_t memorySemantics = 0;
if (flags.test(DxbcSyncFlag::ThreadsInGroup))
@ -2162,25 +2162,30 @@ namespace dxvk {
if (flags.test(DxbcSyncFlag::ThreadGroupSharedMemory)) {
memoryScope = spv::ScopeWorkgroup;
memorySemantics |= spv::MemorySemanticsWorkgroupMemoryMask;
memorySemantics |= spv::MemorySemanticsWorkgroupMemoryMask
| spv::MemorySemanticsAcquireReleaseMask;
}
if (flags.test(DxbcSyncFlag::UavMemoryGroup)) {
memoryScope = spv::ScopeWorkgroup;
memorySemantics |= spv::MemorySemanticsUniformMemoryMask;
memorySemantics |= spv::MemorySemanticsImageMemoryMask
| spv::MemorySemanticsUniformMemoryMask
| spv::MemorySemanticsAcquireReleaseMask;
}
if (flags.test(DxbcSyncFlag::UavMemoryGlobal)) {
memoryScope = spv::ScopeDevice;
memorySemantics |= spv::MemorySemanticsUniformMemoryMask;
memorySemantics |= spv::MemorySemanticsImageMemoryMask
| spv::MemorySemanticsUniformMemoryMask
| spv::MemorySemanticsAcquireReleaseMask;
}
if (executionScope != 0) {
if (executionScope != spv::ScopeInvocation) {
m_module.opControlBarrier(
m_module.constu32(executionScope),
m_module.constu32(memoryScope),
m_module.constu32(memorySemantics));
} else if (memorySemantics != spv::MemorySemanticsMaskNone) {
} else if (memoryScope != spv::ScopeInvocation) {
m_module.opMemoryBarrier(
m_module.constu32(memoryScope),
m_module.constu32(memorySemantics));