yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

ArielG-NVFix minimal-optimization flag with texture atomics (#4660)f545ef300

master
733 B21 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile glsl_450 -stage compute -entry MainCs -line-directive-mode none
2//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile glsl_450 -stage compute -entry MainCs -line-directive-mode none -minimum-slang-optimization
3
4//CHECK: {{.*}} OpAtomicIAdd
5RWBuffer<uint> g_InterlockTest;
6
7[numthreads(1,1,1)]
8void MainCs( uint2 dispatchThreadID : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID )
9{
10	uint nVertexCount = 41;
11	uint nVertexBufferSize = 40;
12	uint nVertex = 3;
13
14	InterlockedAdd( g_InterlockTest[ 0 ], nVertexCount, nVertex );
15
16	// Did we overflow?
17	if ( nVertex + nVertexCount > nVertexBufferSize )
18	{
19		InterlockedAdd( g_InterlockTest[ 0 ], -int(nVertexCount) );
20	}
21}