yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
4fb3b10b8
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 calls to overloaded generic functions can be resolved to prefer the 5// generic candidate with more specialized constraints. 6interface IBase 7{ 8 float get(); 9} 10interface IDerived : IBase 11{ 12 13} 14float process<T>(T v) 15{ 16 return 0.0; 17} 18float process<T : IBase>(T v) 19{ 20 return v.get(); 21} 22 23float process<T : IDerived>(T v) 24{ 25 return v.get() + 1.0; 26} 27 28struct D : IDerived 29{ 30 float get() { return 1.0; } 31} 32 33//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 34RWStructuredBuffer<float> outputBuffer; 35 36[numthreads(1,1,1)] 37void computeMain() 38{ 39 D d; 40 outputBuffer[0] = process(d); 41 // CHECK: 2.0 42}