yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
20bd48659
master
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-compute -output-using-type 2//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -output-using-type 3 4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 5RWStructuredBuffer<int> outputBuffer; 6 7int g(int arr[]) 8{ 9 int tmp[] = arr; 10 return tmp.getCount(); 11} 12 13int test(int arr[]) 14{ 15 return arr[0] + g(arr); 16} 17 18int test2<T>(inout T arr[]) 19{ 20 unmodified(arr); 21 return arr.getCount(); 22} 23 24[numthreads(1, 1, 1)] 25void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) 26{ 27 int arr[3] = {1, 2, 3}; 28 29 // CHECK: 4 30 outputBuffer[0] = test(arr); 31 32 // CHECK: 3 33 outputBuffer[1] = test2(arr); 34 35 int arr2[2] = { 1, 2 }; 36 37 // CHECK: 3 38 outputBuffer[2] = test(arr2); 39 40 // CHECK: 2 41 outputBuffer[3] = test2(arr2); 42 43}