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 -DTARGET_VK 2//TEST:SIMPLE(filecheck=CHECK_SPV): -allow-glsl -stage compute -entry computeMain -target spirv -emit-spirv-directly -DTARGET_VK 3 4// missing implementation of most builtin values due to non trivial translation 5//DISABLE_TEST:SIMPLE(filecheck=CHECK_HLSL): -allow-glsl -stage compute -entry computeMain -target hlsl -DTARGET_HLSL 6// missing implementation of most builtin values due to non trivial translation 7//DISABLE_TEST:SIMPLE(filecheck=CHECK_CUDA): -allow-glsl -stage compute -entry computeMain -target cuda -DTARGET_CUDA 8//missing implementation of system (varying?) values 9//DISABLE_TEST:SIMPLE(filecheck=CHECK_CPP): -allow-glsl -stage compute -entry computeMain -target cpp -DTARGET_CPP 10 11//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -xslang -DTARGET_VK 12//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-vk -compute -entry computeMain -allow-glsl -emit-spirv-directly -xslang -DTARGET_VK 13//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-wgpu -compute -entry computeMain -allow-glsl 14 15// There are some issues with the Metal backend when using glsl-style syntax - this should be fixed. 16//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=BUF):-metal -compute -entry computeMain -allow-glsl -xslang -DTARGET_METAL 17 18#version 430 19 20//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer 21buffer MyBlockName2 22{ 23 uint data[]; 24} outputBuffer; 25 26layout(local_size_x = 32) in; 27 28[shader("compute")] 29void computeMain() 30{ 31 if (gl_GlobalInvocationID.x == 3) { 32 outputBuffer.data[0] = true 33 && gl_SubgroupSize == 32 34 && gl_SubgroupInvocationID == 3 35 // These intrinsics are only available on Vulkan(SPIRV and GLSL). 36#if defined(TARGET_VK) 37 && gl_SubgroupID == 0 //1 subgroup, 0 based indexing 38 && gl_NumSubgroups == 1 39 && gl_SubgroupEqMask == uvec4(0b1000,0,0,0) 40 && gl_SubgroupGeMask == uvec4(0xFFFFFFF8,0,0,0) 41 && gl_SubgroupGtMask == uvec4(0xFFFFFFF0,0,0,0) 42 && gl_SubgroupLeMask == uvec4(0b1111,0,0,0) 43 && gl_SubgroupLtMask == uvec4(0b111,0,0,0) 44#endif 45 ; 46 } 47 // CHECK_GLSL: void main( 48 // CHECK_SPV: OpEntryPoint 49 // CHECK_HLSL: void computeMain( 50 // CHECK_CUDA: void computeMain( 51 // CHECK_CPP: void _computeMain( 52 // BUF: 1 53}