summaryrefslogtreecommitdiff
path: root/tests/bugs/interlocked-add-uint-int.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-09 10:54:41 -0700
committerGitHub <noreply@github.com>2023-08-09 10:54:41 -0700
commit03a5bb4bc0391e2de3c2dfb9ff3213bc0ccd9664 (patch)
tree8bdc7fbf12777c2efe68e677f6802afdb70ba8fc /tests/bugs/interlocked-add-uint-int.slang
parentc4615fe0ae7e1849b23e9a96d1453794b0b40e90 (diff)
Various fixes in GLSL emit. (#3074)
* Fix name mangling of modified types. * Add `InterlockedAdd(__ref uint, int)` overload. * Fix. * Fix type error in ImageStore legalization. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/bugs/interlocked-add-uint-int.slang')
-rw-r--r--tests/bugs/interlocked-add-uint-int.slang19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/bugs/interlocked-add-uint-int.slang b/tests/bugs/interlocked-add-uint-int.slang
new file mode 100644
index 000000000..10baa7f17
--- /dev/null
+++ b/tests/bugs/interlocked-add-uint-int.slang
@@ -0,0 +1,19 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile glsl_450 -stage compute -entry MainCs -line-directive-mode none
+//CHECK: {{.*}} AtomicIAdd
+RWBuffer<uint> g_InterlockTest;
+
+[numthreads(1,1,1)]
+void MainCs( uint2 dispatchThreadID : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID )
+{
+ uint nVertexCount = 41;
+ uint nVertexBufferSize = 40;
+ uint nVertex = 3;
+
+ InterlockedAdd( g_InterlockTest[ 0 ], nVertexCount, nVertex );
+
+ // Did we overflow?
+ if ( nVertex + nVertexCount > nVertexBufferSize )
+ {
+ InterlockedAdd( g_InterlockTest[ 0 ], -int(nVertexCount) );
+ }
+} \ No newline at end of file