yum-mirror/slang

Making it easier to work with shaders

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

Yong HeWarning on lossy implicit casts. (#2367)adaea0e99

master
672 B28 linesraw
1// struct-inheritance-import.slang
2
3//TEST(compute):COMPARE_COMPUTE:
4
5// This test confirms that the synthesized code for struct type inheritance
6// includes proper linkage decorations so that it can work across modules.
7
8import struct_inheritance_imported;
9
10int test(int val)
11{
12    Derived d;
13    d.a = val;
14
15    return 0x100 + d.a*0x10 + getA(d);
16}
17
18//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
19RWStructuredBuffer<int> outputBuffer;
20
21[numthreads(4, 1, 1)]
22void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
23{
24    uint tid = dispatchThreadID.x;
25    int inVal = int(tid);
26    int outVal = test(inVal);
27    outputBuffer[tid] = outVal;
28}