diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-11-29 07:48:23 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-29 07:48:23 -0800 |
| commit | c3c34bf4ca78caff285fbf5f24c5f355ca040bd1 (patch) | |
| tree | 459e8a3b65fed29f597aa8a68e70f0b3e991cf54 /source/slang/ir-serialize.cpp | |
| parent | 7f0ccc5580faa43c2554d9d016c27ebe069362c5 (diff) | |
Add support for globallycoherent modifier (#732)
The `globallycoherent` modifier indicates that resource might be read or written by threads outside of the current thread group, so that any memory barriers that affect it should guarantee coherency at the global memory scope, and not just thread-group scope. The equivalent GLSL modifier appears to be `coherent`.
This change adds the front-end modifier, transforms it into an IR-level decoration during lowering, and then checks for the modifier during code emit.
Note: this logic may not behave correctly when `globallycoherent` is added to a field in a `struct`, since the modifier would then need to be propagated to any variables created during type legalization. Checking up on that is left to future work.
Note: it isn't entirely clear if `globallycoherent` should be treated as a declaration modifier or a type modifier. The point is moot for now because Slang doesn't have any support for type modifiers, but when we get around to that we will need to make a decision.
Diffstat (limited to 'source/slang/ir-serialize.cpp')
| -rw-r--r-- | source/slang/ir-serialize.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/slang/ir-serialize.cpp b/source/slang/ir-serialize.cpp index d8a01fb56..03e10c8e2 100644 --- a/source/slang/ir-serialize.cpp +++ b/source/slang/ir-serialize.cpp @@ -708,6 +708,7 @@ Result IRSerialWriter::write(IRModule* module, SourceManager* sourceManager, Opt case kIRDecorationOp_VulkanHitAttributes: case kIRDecorationOp_EarlyDepthStencil: case kIRDecorationOp_ReadNone: + case kIRDecorationOp_GloballyCoherent: { dstInst.m_payloadType = PayloadType::Empty; break; @@ -1574,6 +1575,12 @@ IRDecoration* IRSerialReader::_createDecoration(const Ser::Inst& srcInst) SLANG_ASSERT(srcInst.m_payloadType == PayloadType::Empty); return decor; } + case kIRDecorationOp_GloballyCoherent: + { + auto decor = createEmptyDecoration<IRGloballyCoherentDecoration>(m_module); + SLANG_ASSERT(srcInst.m_payloadType == PayloadType::Empty); + return decor; + } case kIRDecorationOp_VulkanHitAttributes: { auto decor = createEmptyDecoration<IRVulkanHitAttributesDecoration>(m_module); |
