yum-mirror/slang

Making it easier to work with shaders

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

jsmall-nvidiaLanguage experiments (#2068)447b7e0e2

master
846 B38 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2
3/* Test around extension to a built in, to allow associating types with builtins. 
4
5Doesn't work
6
7.slang(22): internal error 99999: unexpected condition encountered in Slang compiler: should not appear in input syntax
8    int.Unsigned v = (int.Unsigned)10;
9
10*/
11
12
13//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
14RWStructuredBuffer<int> outputBuffer;
15
16interface IIntegral
17{
18    associatedtype Unsigned;
19};
20
21extension int : IIntegral
22{
23    typedef uint Unsigned;
24};
25
26[numthreads(4, 1, 1)]
27void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
28{    
29    int index = dispatchThreadID.x;
30    
31    // Works
32    int.Unsigned u = 10;
33
34    // Doesn't work
35    int.Unsigned v = (int.Unsigned)10;
36
37    outputBuffer[dispatchThreadID.x] = doThing<2>(index);
38}