• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 320 es
2
3#define MAX_VER  81
4#define MAX_PRIM 32
5
6#define BARRIER() \
7    memoryBarrierShared(); \
8    barrier();
9
10#extension GL_NV_mesh_shader : enable
11
12layout(local_size_x = 32) in;
13
14layout(max_vertices=MAX_VER) out;
15layout(max_primitives=MAX_PRIM) out;
16layout(triangles) out;
17
18// test use of user defined interface out blocks:
19
20// per-primitive block
21perprimitiveNV layout(location=0) out myblock {
22    float f;
23    float fArr[4];
24    vec3 pos;
25    vec4 posArr[4];
26    mat4 m;
27    mat3 mArr[2];
28} blk[];
29
30// per-vertex block
31layout(location=20) out myblock2 {
32    float f;
33    vec4 pos;
34    mat4 m;
35} blk2[];
36
37void main()
38{
39    int iid = int(gl_LocalInvocationID.x);
40    int gid = int(gl_WorkGroupID.x);
41
42    blk[iid].f               = 11.0;
43    blk[iid+1].fArr[gid]     = blk[iid].f;
44    blk[iid/2].pos.yzx       = vec3(14.0, 15.0, 13.0);
45    blk[iid*2].posArr[1].yzw = blk[iid/2].pos;
46    blk[iid/4].m[2].wzyx     = vec4(13.0, 14.0, 15.0, 16.0);
47    blk[iid].mArr[0][1][1]   = blk[iid/4].m[2].w;
48    blk[iid*4].mArr[1][gid]  = vec3(17.0, 18.0, 19.0);
49
50    BARRIER();
51
52    blk2[iid].f           = blk2[iid-1].f + 20.0;
53    blk2[iid].pos         = vec4(21.0, 22.0, 23.0, 24.0);
54    blk2[iid+1].m[gid]    = blk2[iid].pos;
55    blk2[iid+1].m[gid][2] = 29.0;
56    blk2[iid+2].m[3]      = blk2[iid+1].m[gid];
57
58    BARRIER();
59}
60