yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f02b08490
master
1// for.slang 2 3// Test active mask synthesis for a standard `for` 4// loop over an integer, with no `break` or `continue` 5// logic. 6 7//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute 8//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute 9//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 10//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute 11//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -capability cuda_sm_7_0 12 13//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name buffer 14RWStructuredBuffer<int> buffer; 15 16#define THREAD_COUNT 4 17#define WRITE(IDX) buffer[IDX*THREAD_COUNT + tid] = WaveGetActiveMask() 18 19void test(int tid) 20{ 21 for(int ii = 0; ii < tid; ++ii) 22 { 23 WRITE(ii); 24 } 25 WRITE(THREAD_COUNT); 26} 27 28[numthreads(THREAD_COUNT, 1, 1)] 29void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 30{ 31 test(dispatchThreadID.x); 32}