1617a3babSopenharmony_ci#version 450 2617a3babSopenharmony_ci 3617a3babSopenharmony_ci#define MAX_VER 81 4617a3babSopenharmony_ci#define MAX_PRIM 32 5617a3babSopenharmony_ci#define MAX_VIEWS gl_MaxMeshViewCountNV 6617a3babSopenharmony_ci 7617a3babSopenharmony_ci#define BARRIER() \ 8617a3babSopenharmony_ci memoryBarrierShared(); \ 9617a3babSopenharmony_ci barrier(); 10617a3babSopenharmony_ci 11617a3babSopenharmony_ci#extension GL_NV_mesh_shader : enable 12617a3babSopenharmony_ci 13617a3babSopenharmony_cilayout(local_size_x = 32) in; 14617a3babSopenharmony_ci 15617a3babSopenharmony_cilayout(max_vertices=MAX_VER) out; 16617a3babSopenharmony_cilayout(max_primitives=MAX_PRIM) out; 17617a3babSopenharmony_cilayout(triangles) out; 18617a3babSopenharmony_ci 19617a3babSopenharmony_ci// test use of user-defined per-view attributes 20617a3babSopenharmony_ci 21617a3babSopenharmony_ci// mix of single-view and per-view attributes 22617a3babSopenharmony_cilayout(location=0) out block { 23617a3babSopenharmony_ci perprimitiveNV perviewNV vec4 color1[][3]; // Implicitly sized 24617a3babSopenharmony_ci perprimitiveNV vec4 color2[3]; 25617a3babSopenharmony_ci perviewNV vec4 color3[MAX_VIEWS][3]; // Explicitly sized 26617a3babSopenharmony_ci vec4 color4; 27617a3babSopenharmony_ci} b[]; 28617a3babSopenharmony_ci 29617a3babSopenharmony_ci// per-view block attributes 30617a3babSopenharmony_ciperviewNV layout(location=10) out perviewBlock { 31617a3babSopenharmony_ci perprimitiveNV vec4 color5[]; // Implicitly sized 32617a3babSopenharmony_ci perprimitiveNV vec4 color6[MAX_VIEWS][3]; // Explicitly sized 33617a3babSopenharmony_ci vec4 color7[][3]; // Implicitly sized 34617a3babSopenharmony_ci vec4 color8[MAX_VIEWS]; // Explicitly sized 35617a3babSopenharmony_ci} b2[]; 36617a3babSopenharmony_ci 37617a3babSopenharmony_ci// per-view non-block attributes 38617a3babSopenharmony_ciperviewNV layout(location=18) out vec4 nonBlk1[MAX_VER][MAX_VIEWS]; // Explicit+Explicit 39617a3babSopenharmony_ciperviewNV perprimitiveNV layout(location=19) out vec4 nonBlk2[MAX_PRIM][]; // Explicit+Implicit 40617a3babSopenharmony_ciperviewNV layout(location=20) out vec4 nonBlk3[][MAX_VIEWS]; // Implicit+Explicit 41617a3babSopenharmony_ciperviewNV perprimitiveNV layout(location=21) out vec4 nonBlk4[][]; // Implicit+Implicit 42617a3babSopenharmony_ci 43617a3babSopenharmony_ci// per-view non-block array attributes 44617a3babSopenharmony_ciperviewNV layout(location=22) out vec4 nonBlkArr1[MAX_VER][MAX_VIEWS][2]; // Explicit+Explicit 45617a3babSopenharmony_ciperviewNV perprimitiveNV layout(location=24) out vec4 nonBlkArr2[MAX_PRIM][][2]; // Explicit+Implicit 46617a3babSopenharmony_ciperviewNV layout(location=26) out vec4 nonBlkArr3[][MAX_VIEWS][2]; // Implicit+Explicit 47617a3babSopenharmony_ciperviewNV perprimitiveNV layout(location=28) out vec4 nonBlkArr4[][][2]; // Implicit+Implicit 48617a3babSopenharmony_ci 49617a3babSopenharmony_civoid main() 50617a3babSopenharmony_ci{ 51617a3babSopenharmony_ci uint iid = gl_LocalInvocationID.x; 52617a3babSopenharmony_ci uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS]; 53617a3babSopenharmony_ci 54617a3babSopenharmony_ci b[iid].color1[viewID][2] = vec4(1.0); 55617a3babSopenharmony_ci b[iid].color2[1] = vec4(2.0); 56617a3babSopenharmony_ci b[iid].color3[viewID][2] = vec4(3.0); 57617a3babSopenharmony_ci b[iid].color4 = vec4(4.0); 58617a3babSopenharmony_ci 59617a3babSopenharmony_ci BARRIER(); 60617a3babSopenharmony_ci 61617a3babSopenharmony_ci b2[iid].color5[viewID] = vec4(5.0); 62617a3babSopenharmony_ci b2[iid].color6[viewID][1] = vec4(6.0); 63617a3babSopenharmony_ci b2[iid].color7[viewID][2] = vec4(7.0); 64617a3babSopenharmony_ci b2[iid].color8[viewID] = vec4(8.0); 65617a3babSopenharmony_ci 66617a3babSopenharmony_ci BARRIER(); 67617a3babSopenharmony_ci} 68617a3babSopenharmony_ci 69