yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
09a9d6733
master
1//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -emit-spirv-directly -output-using-type 2//DISABLED_TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -wgpu 3//DISABLED_TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d12 4//DISABLED_TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -d3d11 5//DISABLED_TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK): -metal 6 7interface IFoo 8{ 9 int getVal(); 10} 11 12struct Foo : IFoo 13{ 14 int val; 15 int getVal() { return val; } 16} 17 18struct Bar : IFoo 19{ 20 float val; 21 int getVal() { return (int)val + 1; } 22} 23 24//TEST_INPUT: set pFoo = ubuffer(data=[0 0 2 0 2.0f], stride=4); 25//TEST_INPUT: type_conformance Foo:IFoo = 1; 26//TEST_INPUT: type_conformance Bar:IFoo = 2; 27uniform IFoo* pFoo; 28 29//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4); 30RWStructuredBuffer<float> outputBuffer; 31 32[numthreads(1,1,1)] 33void computeMain() 34{ 35 // CHECK: 3.0 36 outputBuffer[0] = pFoo->getVal(); 37}