yum-mirror/slang

Making it easier to work with shaders

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

kaizhangNVFeature/initialize list side branch (#6058)9ec6b9168

master
768 B28 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 
2//TEST(compute):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
5RWStructuredBuffer<int> outputBuffer;
6
7/* Tests purpose is to confirm that use of `= {}` initialization 
8works with a generic */
9
10struct Check<T>
11{
12    // T is not default initialize type, because it's a generic type parameter.
13    // Therefore, when we synthesize the contructor, we won't create a default value
14    // for it.
15    // __init(T v);
16    T v;
17};
18
19[numthreads(4, 1, 1)]
20void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
21{
22    int index = int(dispatchThreadID.x);
23
24    Check<float> v = {0};
25    
26    outputBuffer[index] = index + int(v.v); 
27}
28