1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 04:24:11 +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.decorateBinding(varId, bindingId);
if (ins.controls.uavFlags.test(DxbcUavFlag::GloballyCoherent))
m_module.decorate(varId, spv::DecorationCoherent);
// Declare a specialization constant which will
// store whether or not the resource is bound.
const uint32_t specConstId = m_module.specConstBool(true);
@ -979,6 +982,9 @@ namespace dxvk {
m_module.decorateDescriptorSet(varId, 0);
m_module.decorateBinding(varId, bindingId);
if (ins.controls.uavFlags.test(DxbcUavFlag::GloballyCoherent))
m_module.decorate(varId, spv::DecorationCoherent);
// Declare a specialization constant which will
// store whether or not the resource is bound.
const uint32_t specConstId = m_module.specConstBool(true);
@ -1995,15 +2001,20 @@ namespace dxvk {
}
// Define memory scope and semantics based on the operands
uint32_t semantics = isUav
? spv::MemorySemanticsUniformMemoryMask
: spv::MemorySemanticsWorkgroupMemoryMask;
uint32_t scope = 0;
uint32_t semantics = 0;
// TODO verify whether this is even remotely correct
semantics |= spv::MemorySemanticsAcquireReleaseMask;
if (isUav) {
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(spv::ScopeWorkgroup);
const uint32_t scopeId = m_module.constu32(scope);
const uint32_t semanticsId = m_module.constu32(semantics);
// Perform the atomic operation on the given pointer

View File

@ -132,6 +132,8 @@ namespace dxvk {
static_cast<DxbcTessOutputPrimitive>(bit::extract(token, 11, 13));
m_instruction.controls.tessPartitioning =
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 =
static_cast<uint32_t>(bit::extract(token, 11, 16));

View File

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

View File

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