From c3c34bf4ca78caff285fbf5f24c5f355ca040bd1 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 29 Nov 2018 07:48:23 -0800 Subject: 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. --- source/slang/ir.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/slang/ir.cpp') 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(clonedValue); } break; + case kIRDecorationOp_GloballyCoherent: + { + context->builder->addDecoration(clonedValue); + } + break; case kIRDecorationOp_VulkanHitAttributes: { context->builder->addDecoration(clonedValue); -- cgit v1.2.3