mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-09 12:00:05 +00:00
40 lines
718 B
Plaintext
40 lines
718 B
Plaintext
|
#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();
|
||
|
}
|