yum-mirror/slang

Making it easier to work with shaders

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

Yong HeMetal: misc fixes and enable more tests. (#4374)cfef0c6f6

master
955 B36 linesraw
1
2//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
6//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
7
8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
9
10RWStructuredBuffer<int> outputBuffer;
11
12struct Thing<T>
13{
14    T t;
15};
16
17
18[numthreads(4, 1, 1)]
19void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
20{
21    const int idx = asint(dispatchThreadID.x);
22
23    int size = 0;
24    
25    switch (idx)
26    {   
27        
28        case 0:     size = alignof(Thing<float>); break;
29        case 1:     size = alignof(Thing<float3>); break;
30        case 2:     size = alignof(Thing<matrix<uint, 3, 2>>); break;
31        case 3:     size = alignof(bool); break;
32        default:    break; 
33    }
34
35    outputBuffer[idx] = size;
36}