7 memoryBarrierShared(); \
10 #extension GL_NV_mesh_shader : enable
12 layout(local_size_x = 32) in;
14 layout(max_vertices=MAX_VER) out;
15 layout(max_primitives=MAX_PRIM) out;
16 layout(triangles) out;
18 // test use of builtins in mesh shaders:
22 uint iid = gl_LocalInvocationID.x;
23 uint gid = gl_WorkGroupID.x;
25 gl_MeshVerticesNV[iid].gl_Position = vec4(1.0);
26 gl_MeshVerticesNV[iid].gl_PointSize = 2.0;
27 gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0;
28 gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0;
32 gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position;
33 gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize;
34 gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3];
35 gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2];
39 gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6;
40 gl_MeshPrimitivesNV[iid].gl_Layer = 7;
41 gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8;
42 gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9;
46 gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID;
47 gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer;
48 gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex;
49 gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0];
54 gl_PrimitiveIndicesNV[0] = 257; // should truncate 257 -> 1
55 gl_PrimitiveIndicesNV[(MAX_PRIM * 3) - 1] = 2;
56 gl_PrimitiveIndicesNV[gid] = gl_PrimitiveIndicesNV[gid-1];
58 // writes 4 indices at offset gl_DrawID
59 writePackedPrimitiveIndices4x8NV(gl_DrawID, 0x01020304);
61 gl_PrimitiveCountNV = MAX_PRIM * 3;