yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9d9997670
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type 3 4interface IFoo<T : __BuiltinFloatingPointType> 5{ 6 bool requirement(T v1); 7} 8 9struct Bar<T : __BuiltinFloatingPointType, A : IFoo<T>, B : IFoo<T>> 10{ 11 [Differentiable] 12 T doThing(T a) 13 { 14 return a * T(2.0); 15 } 16} 17 18struct Foo : IFoo<float> 19{ 20 bool requirement(float v) 21 { 22 return v > 0.5; 23 } 24} 25 26//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 27RWStructuredBuffer<float> outputBuffer; 28 29[numthreads(1, 1, 1)] 30void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 31{ 32 int tid = dispatchThreadID.x; 33 Bar<float, Foo, Foo> obj; 34 outputBuffer[tid] = obj.doThing(2.0f); 35 // CHECK: 4 36}