yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
1e4265edd
master
1//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -dx11 -compute 2//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -dx12 -compute 3//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -cpu -compute 4//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -cuda -compute 5//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -wgsl -compute 6//DISABLE_TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -mtl -compute 7//TEST(compute,vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK): -vk -compute 8 9// Slang allows the type of system value semantics to differ from their 10// "canonical" type - e.g. `uint8_t tid : SV_DispatchThreadID` is technically 11// valid and refers to the first element in the underlying uint3 vector. 12 13// TEST_INPUT: ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer 14RWStructuredBuffer<int> outputBuffer; 15 16[numthreads(2, 4, 1)] 17void computeMain( 18 uint ind : SV_GroupIndex, 19 vector<uint, 2> tid: SV_DispatchThreadID, 20 int localTid : SV_GroupThreadID 21){ 22 // CHECK: 0 23 // CHECK-NEXT: 5 24 // CHECK-NEXT: 8 25 // CHECK-NEXT: D 26 // CHECK-NEXT: 10 27 // CHECK-NEXT: 15 28 // CHECK-NEXT: 18 29 // CHECK-NEXT: 1D 30 outputBuffer[ind] = 4 * (tid.x + 2 * tid.y) + localTid; 31}