yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e036c7f38
master
1//TEST:SIMPLE(filecheck=CHECK_FAIL): -target spirv -entry computeMain -stage compute -DFAIL 2//TEST:SIMPLE(filecheck=CHECK_PASS): -target spirv -entry computeMain -stage compute 3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -slang -compute -shaderobj -output-using-type 4 5interface ITwoParamGeneric<A, B> 6{ 7 int getVal(); 8} 9 10struct Foo<A, B> : ITwoParamGeneric<A, B> 11{ 12 int val = 0; 13 int getVal() 14 { 15 return val; 16 } 17} 18 19extension<A, B> Foo<A,B> where A == B 20{ 21 [mutating] 22 void setVal(int dataIn) 23 { 24 val = dataIn; 25 } 26} 27 28void test<A, B>(Foo<A,B> x) where A == B 29{ 30} 31 32//TEST_INPUT: set outBuffer = out ubuffer(data=[0 0 0 0], stride=4) 33RWStructuredBuffer<float4> outBuffer; 34 35void computeMain() 36{ 37//CHECK_FAIL-DAG: error 30027:{{.*}}'setVal'{{.*}}'Foo<int, float>'. 38//CHECK_FAIL-DAG: error 39999: could not specialize generic for arguments of type 39//CHECK_PASS: OpEntryPoint 40//CHECK: 3 41#ifdef FAIL 42 Foo<int, float> x = Foo<int, float>(); 43#else 44 Foo<int, int> x = Foo<int, int>(); 45#endif 46 x.setVal(3); 47 test(x); 48 outBuffer[0] = x.getVal(); 49}