yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
cfef0c6f6
master
1 2//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj 4//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj 5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 6//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj 7 8//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 9 10RWStructuredBuffer<int> outputBuffer; 11 12struct Thing<T> 13{ 14 T t; 15}; 16 17 18[numthreads(4, 1, 1)] 19void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 20{ 21 const int idx = asint(dispatchThreadID.x); 22 23 int size = 0; 24 25 switch (idx) 26 { 27 28 case 0: size = sizeof(Thing<float>); break; 29 case 1: size = sizeof(Thing<float3>); break; 30 case 2: size = sizeof(Thing<matrix<uint, 3, 2>>); break; 31 default: break; 32 } 33 34 outputBuffer[idx] = size; 35}