You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
718 B
40 lines
718 B
#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();
|
|
}
|