3 #define MAX_VIEWS gl_MaxMeshViewCountNV
6 memoryBarrierShared(); \
9 #extension GL_NV_mesh_shader : enable
11 layout(local_size_x = 32) in;
13 // test use of shared memory in task shaders:
14 layout(binding=0) writeonly uniform image2D uni_image;
20 // test use of task memory in task shaders:
29 uint iid = gl_LocalInvocationID.x;
30 uint gid = gl_WorkGroupID.x;
31 uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS];
33 // 1. shared memory load and stores
34 for (uint i = 0; i < 10; ++i) {
35 mem[i] = vec4(i + uni_value);
37 imageStore(uni_image, ivec2(iid), mem[gid]);
38 imageStore(uni_image, ivec2(iid), mem[gid+1]);
42 // 2. task memory stores
44 mytask.dummy = vec2(30.0, 31.0);
45 mytask.submesh[0] = vec2(32.0, 33.0);
46 mytask.submesh[1] = vec2(34.0, 35.0);
47 mytask.submesh[2] = mytask.submesh[gid%2];
48 mytask.viewID = viewID;