yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
599dae52e
master
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK): -d3d12 -compute -shaderobj -output-using-type 2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHK): -vk -compute -shaderobj -output-using-type 3 4 5// Test that we can synthesize a [mutating] interface requirement from a nonmutating implementation, 6// and the interface requirement signature contains an output interface-typed parameter. 7 8//TEST_INPUT: ubuffer(data=[0 0], stride=4):out,name outputBuffer 9RWStructuredBuffer<int> outputBuffer; 10 11interface IFoo 12{ 13 int getVal(); 14}; 15 16interface IBar 17{ 18 [mutating] void method(out IFoo o); 19}; 20 21struct FooImpl : IFoo 22{ 23 int x; 24 int getVal() { return x; } 25} 26 27struct BarImpl : IBar 28{ 29 void method(out IFoo o) 30 { 31 o = FooImpl(1); 32 } 33}; 34 35[numthreads(1,1,1)] 36void computeMain() 37{ 38 BarImpl bar; 39 IFoo foo; 40 bar.method(foo); 41 // CHK: 1 42 outputBuffer[0] = foo.getVal(); 43}