yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1//TEST_CATEGORY(wave, compute) 2//DISABLE_TEST:COMPARE_COMPUTE_EX:-cpu -compute -shaderobj 3//DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -shaderobj 4//TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -shaderobj 5//TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj 6//TEST:COMPARE_COMPUTE_EX:-cuda -compute -shaderobj 7//TEST:COMPARE_COMPUTE_EX:-wgpu -compute -shaderobj 8//TEST:COMPARE_COMPUTE_EX:-metal -compute -shaderobj 9 10//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer 11RWStructuredBuffer<int> outputBuffer; 12 13[numthreads(4, 1, 1)] 14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 15{ 16 uint idx = dispatchThreadID.x; 17 uint laneId = WaveGetLaneIndex(); 18 // The laneCount will be dependent on target hardware. It seems a count of 1 is valid in spec. 19 // For now we'll just check it's not 0. 20 uint laneCount = WaveGetLaneCount(); 21 outputBuffer[idx] = int(((laneCount > 0) ? 0x100 : 0) + laneId); 22}