yum-mirror/slang

Making it easier to work with shaders

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

Harsh Aggarwal (NVIDIA)Fix#8084: Batch-8: Enable cuda tests (#8268)1562f98c0

master
734 B37 linesraw
1//TEST(compute):COMPARE_COMPUTE: -shaderobj
2//TEST(compute):COMPARE_COMPUTE: -shaderobj -cuda
3
4// Confirm that a struct type defined in a generic parent works
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
7RWStructuredBuffer<float> outputBuffer;
8
9struct GenStruct<T>
10{
11    struct SubType
12    {
13        T x;
14    };
15    T getVal(SubType v)
16    {
17        return v.x;
18    }
19};
20
21T test<T>(T val)
22{
23    GenStruct<T>.SubType sb;
24    sb.x = val;
25    GenStruct<T> obj;
26    return obj.getVal(sb);
27}
28
29
30[numthreads(4, 1, 1)]
31void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
32{
33    uint tid = dispatchThreadID.x;
34    float inVal = float(tid);
35    float outVal = test(inVal);
36    outputBuffer[tid] = outVal.x;
37}