yum-mirror/slang

Making it easier to work with shaders

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

skallweitNVenable more metal tests (#4326)712ce653d

master
692 B30 linesraw
1// scope.slang
2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
3//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
4//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
5
6// Confirm that scoping on enums and types works 
7
8struct Thing
9{
10    int a;
11    static Thing make(int v)
12    {
13        Thing thing;
14        thing.a = v;
15        return thing;
16    }
17};
18
19//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
20RWStructuredBuffer<int> outputBuffer;
21
22[numthreads(4, 1, 1)]
23void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
24{
25    int tid = dispatchThreadID.x;
26
27    Thing thing = Thing::make(tid);
28
29    outputBuffer[tid] = thing.a;
30}