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

[dxbc] Respect GloballyCoherent flag for UAVs

This commit is contained in:
Philip Rebohle 2018-03-31 16:41:19 +02:00
parent 770d94f796
commit 99d9a5df0b
4 changed files with 30 additions and 9 deletions

View File

@ -861,6 +861,9 @@ namespace dxvk {
m_module.decorateDescriptorSet(varId, 0); m_module.decorateDescriptorSet(varId, 0);
m_module.decorateBinding(varId, bindingId); m_module.decorateBinding(varId, bindingId);
if (ins.controls.uavFlags.test(DxbcUavFlag::GloballyCoherent))
m_module.decorate(varId, spv::DecorationCoherent);
// Declare a specialization constant which will // Declare a specialization constant which will
// store whether or not the resource is bound. // store whether or not the resource is bound.
const uint32_t specConstId = m_module.specConstBool(true); const uint32_t specConstId = m_module.specConstBool(true);
@ -979,6 +982,9 @@ namespace dxvk {
m_module.decorateDescriptorSet(varId, 0); m_module.decorateDescriptorSet(varId, 0);
m_module.decorateBinding(varId, bindingId); m_module.decorateBinding(varId, bindingId);
if (ins.controls.uavFlags.test(DxbcUavFlag::GloballyCoherent))
m_module.decorate(varId, spv::DecorationCoherent);
// Declare a specialization constant which will // Declare a specialization constant which will
// store whether or not the resource is bound. // store whether or not the resource is bound.
const uint32_t specConstId = m_module.specConstBool(true); const uint32_t specConstId = m_module.specConstBool(true);
@ -1995,15 +2001,20 @@ namespace dxvk {
} }
// Define memory scope and semantics based on the operands // Define memory scope and semantics based on the operands
uint32_t semantics = isUav uint32_t scope = 0;
? spv::MemorySemanticsUniformMemoryMask uint32_t semantics = 0;
: spv::MemorySemanticsWorkgroupMemoryMask;
// TODO verify whether this is even remotely correct if (isUav) {
semantics |= spv::MemorySemanticsAcquireReleaseMask; scope = spv::ScopeDevice;
semantics = spv::MemorySemanticsImageMemoryMask
| spv::MemorySemanticsAcquireReleaseMask;
} else {
scope = spv::ScopeWorkgroup;
semantics = spv::MemorySemanticsWorkgroupMemoryMask
| spv::MemorySemanticsAcquireReleaseMask;
}
// TODO for UAVs, respect globally coherent flag const uint32_t scopeId = m_module.constu32(scope);
const uint32_t scopeId = m_module.constu32(spv::ScopeWorkgroup);
const uint32_t semanticsId = m_module.constu32(semantics); const uint32_t semanticsId = m_module.constu32(semantics);
// Perform the atomic operation on the given pointer // Perform the atomic operation on the given pointer

View File

@ -132,6 +132,8 @@ namespace dxvk {
static_cast<DxbcTessOutputPrimitive>(bit::extract(token, 11, 13)); static_cast<DxbcTessOutputPrimitive>(bit::extract(token, 11, 13));
m_instruction.controls.tessPartitioning = m_instruction.controls.tessPartitioning =
static_cast<DxbcTessPartitioning>(bit::extract(token, 11, 13)); static_cast<DxbcTessPartitioning>(bit::extract(token, 11, 13));
m_instruction.controls.uavFlags =
static_cast<uint32_t>(bit::extract(token, 16, 16));
m_instruction.controls.controlPointCount = m_instruction.controls.controlPointCount =
static_cast<uint32_t>(bit::extract(token, 11, 16)); static_cast<uint32_t>(bit::extract(token, 11, 16));

View File

@ -201,8 +201,6 @@ namespace dxvk {
/** /**
* \brief Instruction operand * \brief Instruction operand
*
*
*/ */
struct DxbcRegister { struct DxbcRegister {
DxbcOperandType type; DxbcOperandType type;
@ -254,6 +252,7 @@ namespace dxvk {
DxbcTessDomain tessDomain; DxbcTessDomain tessDomain;
DxbcTessOutputPrimitive tessOutputPrimitive; DxbcTessOutputPrimitive tessOutputPrimitive;
DxbcTessPartitioning tessPartitioning; DxbcTessPartitioning tessPartitioning;
DxbcUavFlags uavFlags;
uint32_t controlPointCount; uint32_t controlPointCount;
}; };

View File

@ -574,6 +574,15 @@ namespace dxvk {
FractEven = 4, FractEven = 4,
}; };
/**
* \brief UAV definition flags
*/
enum class DxbcUavFlag : uint32_t {
GloballyCoherent = 0,
};
using DxbcUavFlags = Flags<DxbcUavFlag>;
/** /**
* \brief Tessellator output primitive * \brief Tessellator output primitive
*/ */