yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1b82501dd
master
1//TEST(compute):COMPARE_COMPUTE: -shaderobj 2//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj 3//TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj 4 5//TEST_INPUT:ubuffer(data=[0 0 0], stride=4):out,name=outputBuffer 6RWStructuredBuffer<int> outputBuffer; 7 8interface IDroppable 9{ 10 void drop(inout int i); 11}; 12 13interface IDiscombobulatable 14{ 15 void discombobulate(inout int i, int param); 16} 17 18void genericFunc<T>(int param) 19 where T : IDroppable, IDiscombobulatable 20{ 21 T t; 22 int i = 0; 23 defer t.drop(i); 24 25 int p = param; 26 defer t.discombobulate(i, p); 27 t.discombobulate(i, p); 28 p += 1; 29} 30 31struct TestType : IDroppable, IDiscombobulatable 32{ 33 void drop(inout int i) 34 { 35 outputBuffer[i++] = 0xFF; 36 } 37 38 void discombobulate(inout int i, int param) 39 { 40 outputBuffer[i++] = param; 41 } 42} 43 44[numthreads(1, 1, 1)] 45void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) 46{ 47 genericFunc<TestType>(2); 48}