blob: b9d2f6d7ed7fdbf1c20ccc2941ccc51ab0021ca9 [file] [log] [blame] [edit]
#version 450
#define MAX_VER 81
#define MAX_PRIM 32
#define BARRIER() \
memoryBarrierShared(); \
barrier();
#extension GL_NV_mesh_shader : enable
layout(local_size_x = 32) in;
layout(max_vertices=MAX_VER) out;
layout(max_primitives=MAX_PRIM) out;
layout(triangles) out;
// test use of shared memory in mesh shaders:
writeonly uniform image2D uni_image;
uniform block0 {
uint uni_value;
};
shared vec4 mem[10];
void main()
{
uint iid = gl_LocalInvocationID.x;
uint gid = gl_WorkGroupID.x;
for (uint i = 0; i < 10; ++i) {
mem[i] = vec4(i+uni_value);
}
imageStore(uni_image, ivec2(iid), mem[gid]);
imageStore(uni_image, ivec2(iid), mem[gid+1]);
BARRIER();
}