yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d65530246
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 4// Test that we can use `where` clause to constrain the type of a type pack. 5 6interface IFoo 7{ 8 associatedtype TA; 9} 10 11struct FooImpl : IFoo 12{ 13 typealias TA = int; 14} 15 16void add(inout int a, int b) 17{ 18 a += b; 19} 20 21int process<each T>(T v) where T == int 22{ 23 int result = 0; 24 expand add(result, each v); 25 return result; 26} 27 28//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 29RWStructuredBuffer<float> outputBuffer; 30 31[numthreads(1,1,1)] 32void computeMain() 33{ 34 outputBuffer[0] = process(1,2,3); 35 // CHECK: 6.0 36}