yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
0bb826f8b
master
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -profile glsl_460 2//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute 3//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-cpu -compute 4 5// Check that when generating spirv directly, we use a loop 6// to copy large arrays in a local variable to a buffer, instead of emitting 7// unrolled code that reads each element of the array individually. 8 9struct WorkData 10{ 11 int B[1024]; 12}; 13 14//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4, count=1024) 15RWStructuredBuffer<WorkData> resultBuffer; 16 17// CHECK: OpLoopMerge 18// CHECK: OpLoopMerge 19 20// BUF: 0 21// BUF: 1 22[numthreads(1, 1, 1)] 23void computeMain(uint3 tid: SV_DispatchThreadID) 24{ 25 WorkData wd; 26 for (int i = 0; i < 1024; i++) 27 wd.B[i] = i; 28 resultBuffer[0] = wd; 29}