yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d3fd7470e
master
1//TEST:SIMPLE(filecheck=CHECK): -target glsl -stage compute -entry computeMain 2//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain 3//TEST:SIMPLE(filecheck=CHECK): -target cuda -stage compute -entry computeMain 4//TEST:SIMPLE(filecheck=CHECK): -target cpp -stage compute -entry computeMain 5 6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 7RWStructuredBuffer<int> outputBuffer; 8 9 10interface IFoo 11{ 12 int foo(int a); 13} 14 15struct MyImpl : IFoo 16{ 17 int foo(int a) { return a; } 18} 19 20struct MyImpl1 : IFoo 21{ 22 int foo(int a) { return a; } 23} 24 25int test(IFoo foo, int idx) 26{ 27 int val = 0; 28 // CHECK: error 20002: syntax error. 29 if ((let a = foo as MyImpl)) 30 { 31 val = a.foo(idx); 32 } 33 return (val); 34} 35 36 37[numthreads(4, 1, 1)] 38void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID) 39{ 40 MyImpl impl; 41 outputBuffer[dispatchThreadID.x] = test(impl, dispatchThreadID.x); 42}