yum-mirror/slang

Making it easier to work with shaders

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

Yong HeImplement explciit binding for metal and wgsl. (#5778)7dabfa76c

master
566 B24 linesraw
1//TEST(compute):COMPARE_COMPUTE: -shaderobj
2//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj
3
4// Test that a global variable (not a shader parameter)
5// with an initializer works.
6
7static int gVar = 16;
8
9int test(int inVal)
10{
11	return inVal + gVar;
12}
13
14//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):out,name=outputBuffer
15RWStructuredBuffer<int> outputBuffer;
16
17[numthreads(4, 1, 1)]
18void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
19{
20	uint tid = dispatchThreadID.x;
21	int inVal = outputBuffer[tid];
22	int outVal = test(inVal);
23	outputBuffer[tid] = outVal;
24}