• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
2#extension GL_EXT_mesh_shader : enable
3
4struct PositionColor {
5    vec4 position;
6    vec4 color;
7};
8
9layout(set=0, binding=0, std430) readonly buffer PositionColorBlock {
10    PositionColor posColor[];
11} vtxData;
12
13layout(push_constant, std430) uniform PushConstantBlock {
14    uint vertexOffset;
15} pc;
16
17layout(local_size_x=1) in;
18layout(lines) out;
19layout(max_vertices=2, max_primitives=1) out;
20
21layout(location = 0) out vec4 outColor[];
22
23void main() {
24    SetMeshOutputsEXT(2u, 1u);
25    const uint firstVertex = uint(gl_WorkGroupID.x) + pc.vertexOffset;
26    for (uint i = 0u; i < 2u; ++i)
27    {
28        const uint srcIdx = firstVertex + i;
29        gl_MeshVerticesEXT[i].gl_Position = vtxData.posColor[srcIdx].position;
30        outColor[i] = vtxData.posColor[srcIdx].color;
31    }
32    gl_PrimitiveLineIndicesEXT[0] = uvec2(0, 1);
33}
34