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 /tests/hlsl/simple | |
| 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 'tests/hlsl/simple')
| -rw-r--r-- | tests/hlsl/simple/globallycoherent.hlsl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/hlsl/simple/globallycoherent.hlsl b/tests/hlsl/simple/globallycoherent.hlsl new file mode 100644 index 000000000..70b5cdb2b --- /dev/null +++ b/tests/hlsl/simple/globallycoherent.hlsl @@ -0,0 +1,20 @@ +//TEST:COMPARE_HLSL:-profile cs_5_0 + +// Check output for `globallycoherent` + +#ifndef __SLANG__ +#define gBuffer gBuffer_0 +#define SV_DispatchThreadID SV_DISPATCHTHREADID +#endif + +globallycoherent +RWStructuredBuffer<uint> gBuffer : register(u0); + +[numthreads(16,1,1)] +void main( + uint tid : SV_DispatchThreadID) +{ + uint index = tid; + + gBuffer[index] = gBuffer[index + 1]; +} |
