yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
712ce653d
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type 2//TEST(compute):SIMPLE(filecheck=GLSL): -stage compute -entry computeMain -target glsl 3 4// Note: spirv_by_reference is only supported for passing opaque types, so this test won't produce 5// expected result on vulkan. 6//DISABLED_TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type 7 8[__NonCopyableType] 9struct MyType 10{ 11 float x; 12 __init() { x = 1.0; } 13} 14 15MyType myFunc1(float y) 16{ 17 __return_val = MyType(); 18 __return_val.x += y; 19} 20 21MyType myFunc0(float x) 22{ 23 return myFunc1(x + 1.0); 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 let f = myFunc0(2.0); 33 // CHECK: 4.0 34 // GLSL: main( 35 // GLSL-NOT: MyType {{.*}} = 36 outputBuffer[0] = f.x; 37}