yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
d87493a46
master
1// mutating-method-syn.slang 2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute 3// Test ability to directly output SPIR-V 4 5interface IFoo 6{ 7 [mutating] 8 int bar(inout int y); 9} 10 11struct Val : IFoo 12{ 13 int x; 14 15 int bar(int y) 16 { 17 return x + y; 18 } 19} 20 21int test<T:IFoo>(inout T f, inout int y) 22{ 23 return f.bar(y); 24} 25 26//TEST_INPUT:set result = out ubuffer(data=[0 0 0 0], stride=4) 27 28RWStructuredBuffer<int> result; 29[numthreads(1,1,1)] 30void computeMain() 31{ 32 Val v; 33 int y = 0; 34 v.x = 1; 35 36 // CHECK: 1 37 result[0] = test(v, y); 38}