diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-12-03 14:57:19 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-03 14:57:19 -0800 |
| commit | d161d97681937f0546eb8835cf9e497cb1b4369c (patch) | |
| tree | 3d02ba21b7ca3fe739232b2846401511b80e4b52 /tests | |
| parent | 3d60cc0ca818556b78f38a59eb5521044b8a6b71 (diff) | |
Add Vulkan translations for HLSL barrier operations (#737)
Fixes #730
The most basic of these already had translations added, and the Slang approach to cross-compilation made adding the new ones almost trivial. I also took the time to confirm that using "operator comma" for the sequencing (since the single HLSL function call needs to expand to a sequence of GLSL function calls) works fine with glslang.
I added a test case to confirm that all of these operations can compile down to SPIR-V.
I am not personally confident that these translations are perfect, but they are based on what was [linked](https://anteru.net/blog/2016/mapping-between-hlsl-and-glsl/index.html) from #730. The one difference is where that blog post was listing `memoryBarrierImage, memoryBarrierImage` I assumed they meant `memoryBarrierImage, memoryBarrierBuffer`.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cross-compile/barriers.slang | 14 | ||||
| -rw-r--r-- | tests/cross-compile/barriers.slang.glsl | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/cross-compile/barriers.slang b/tests/cross-compile/barriers.slang new file mode 100644 index 000000000..f6fb9ac3c --- /dev/null +++ b/tests/cross-compile/barriers.slang @@ -0,0 +1,14 @@ +//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage compute + +// Confirm that all HLSL barrier operations can be used when cross-compiling. + +[numthreads(1,1,1)] +void main() +{ + AllMemoryBarrier(); + AllMemoryBarrierWithGroupSync(); + DeviceMemoryBarrier(); + DeviceMemoryBarrierWithGroupSync(); + GroupMemoryBarrier(); + GroupMemoryBarrierWithGroupSync(); +} diff --git a/tests/cross-compile/barriers.slang.glsl b/tests/cross-compile/barriers.slang.glsl new file mode 100644 index 000000000..281e684db --- /dev/null +++ b/tests/cross-compile/barriers.slang.glsl @@ -0,0 +1,14 @@ +#version 450 + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() +{ + (memoryBarrier(), groupMemoryBarrier(), memoryBarrierImage(), memoryBarrierBuffer()); + (memoryBarrier(), groupMemoryBarrier(), memoryBarrierImage(), memoryBarrierBuffer(), barrier()); + (memoryBarrier(), memoryBarrierImage(), memoryBarrierBuffer()); + (memoryBarrier(), memoryBarrierImage(), memoryBarrierBuffer(), barrier()); + groupMemoryBarrier(); + (groupMemoryBarrier(), barrier()); + + return; +} |
