• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 450
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 shared memory in mesh shaders:
19
20writeonly uniform image2D uni_image;
21uniform block0 {
22    uint    uni_value;
23};
24
25shared vec4 mem[10];
26
27void main()
28{
29    uint iid = gl_LocalInvocationID.x;
30    uint gid = gl_WorkGroupID.x;
31
32    for (uint i = 0; i < 10; ++i) {
33        mem[i] = vec4(i+uni_value);
34    }
35    imageStore(uni_image, ivec2(iid), mem[gid]);
36    imageStore(uni_image, ivec2(iid), mem[gid+1]);
37
38    BARRIER();
39}
40