yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f4d5372d3
master
1//TEST:SIMPLE(filecheck=CHECK_GLSL): -allow-glsl -stage compute -entry computeMain -target glsl 2//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly 3//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl 4//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly 5 6#version 460 7 8//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 9buffer MyBlockName2 10{ 11 uint data[]; 12} outputBuffer; 13 14layout(local_size_x = 4) in; 15 16bool testAnyInvocation() 17{ 18 return true 19 && anyInvocation(gl_GlobalInvocationID.x == 0) 20 && anyInvocation(gl_GlobalInvocationID.x == 8) == false 21 ; 22} 23bool testAllInvocations() 24{ 25 return true 26 && allInvocations(true) 27 && allInvocations(gl_GlobalInvocationID.x == 0) == false 28 ; 29} 30bool testAllInvocationsEqual() 31{ 32 return true 33 && allInvocationsEqual(false) 34 && allInvocationsEqual(gl_GlobalInvocationID.x == 0) == false 35 ; 36} 37 38[shader("compute")] 39void computeMain() 40{ 41 outputBuffer.data[0] = true 42 && testAnyInvocation() 43 && testAllInvocations() 44 && testAllInvocationsEqual() 45 ; 46 // CHECK_GLSL: void main( 47 // CHECK_SPV: OpEntryPoint 48 // BUF: 1 49}