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.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.cpp')
| -rw-r--r-- | source/slang/ir.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index 664927e8a..599b02ea7 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -2954,6 +2954,11 @@ namespace Slang dump(context, "\n[earlydepthstencil]"); } break; + case kIRDecorationOp_GloballyCoherent: + { + dump(context, "\n[globallycoherent]"); + } + break; } } } @@ -5397,6 +5402,11 @@ namespace Slang context->builder->addDecoration<IREarlyDepthStencilDecoration>(clonedValue); } break; + case kIRDecorationOp_GloballyCoherent: + { + context->builder->addDecoration<IRGloballyCoherentDecoration>(clonedValue); + } + break; case kIRDecorationOp_VulkanHitAttributes: { context->builder->addDecoration<IRVulkanHitAttributesDecoration>(clonedValue); |
