yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
dffbc797
main
1#version 460 2 3#define MAX_VER 81 4#define MAX_PRIM 32 5 6#define BARRIER() \ 7 memoryBarrierShared(); \ 8 barrier(); 9 10#extension GL_EXT_mesh_shader : enable 11 12layout(local_size_x = 32, local_size_y = 1, local_size_z = 1) in; 13 14layout(max_vertices=MAX_VER) out; 15layout(max_primitives=MAX_PRIM) out; 16layout(points) out; 17 18// test use of redeclared single-view builtins in mesh shaders: 19 20out gl_MeshPerVertexEXT { 21 vec4 gl_Position; 22 float gl_PointSize; 23 float gl_ClipDistance[4]; 24 float gl_CullDistance[4]; 25} gl_MeshVerticesEXT[MAX_VER]; // explicitly sized to MAX_VER 26 27perprimitiveEXT out gl_MeshPerPrimitiveEXT { 28 int gl_PrimitiveID; 29 int gl_Layer; 30 int gl_ViewportIndex; 31 bool gl_CullPrimitiveEXT; 32 int gl_PrimitiveShadingRateEXT; 33} gl_MeshPrimitivesEXT[]; // implicitly sized to MAX_PRIM 34 35out uint gl_PrimitivePointIndicesEXT[MAX_PRIM]; // explicitly sized to MAX_PRIM 36 37void main() 38{ 39 uint iid = gl_LocalInvocationID.x; 40 uint gid = gl_WorkGroupID.x; 41 42 SetMeshOutputsEXT(MAX_VER, MAX_PRIM); 43 44 gl_MeshVerticesEXT[iid].gl_Position = vec4(1.0); 45 gl_MeshVerticesEXT[iid].gl_PointSize = 2.0; 46 gl_MeshVerticesEXT[iid].gl_ClipDistance[3] = 3.0; 47 gl_MeshVerticesEXT[iid].gl_CullDistance[2] = 4.0; 48 49 50 BARRIER(); 51 52 gl_MeshPrimitivesEXT[iid].gl_PrimitiveID = 6; 53 gl_MeshPrimitivesEXT[iid].gl_Layer = 7; 54 gl_MeshPrimitivesEXT[iid].gl_ViewportIndex = 8; 55 gl_MeshPrimitivesEXT[iid].gl_CullPrimitiveEXT = false; 56 57 BARRIER(); 58 59 // check bound limits 60 gl_PrimitivePointIndicesEXT[0] = 1; 61 gl_PrimitivePointIndicesEXT[MAX_PRIM - 1] = 2; 62}