yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
05547e253
master
1//TEST(smoke,compute):COMPARE_COMPUTE:-cpu -shaderobj 2 3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 4RWStructuredBuffer<int> outputBuffer; 5 6struct A<let I : int> 7{ 8 int f() { return I; } 9}; 10 11struct B<let U : uint> : IDefaultInitializable 12{ 13 A<U> a; 14}; 15 16int foo<let I : int>(A<I> a) 17{ 18 return a.f(); 19} 20 21int bar<let U : uint>(B<U> b) 22{ 23 return foo(b.a); 24 // We previously were inferring the type at which to call `foo` as `U` 25 // instead of `int(U)`. This then cause the typechecker to impmediately 26 // fail because `U` does not unify with the type of `B<U>`'s `a` member, 27 // namely `int(U)`. 28} 29 30[numthreads(4, 1, 1)] 31void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 32{ 33 A<1> a; 34 B<1> b; 35 b.a = a; 36 outputBuffer[dispatchThreadID.x] = bar<1>(b); 37}