Hello,
When using DrawMeshTasksIndirectNV, I’ve expanded
typedef struct
{
uint count;
uint first;
} DrawMeshTasksIndirectCommandNV;
to include a meshID so that my struct is now
typedef struct
{
uint count;
uint first;
uint meshID;
} DrawMeshTasksIndirectCommandNV;
which indexes into an array of meshes. So, if a terrain model has 16 tiles (meshes), the gl_DrawID will be used to index into an array of terrain meshes in my task shader which will then compute an LOD, do an early cull, etc.
I have verified that the data in the buffers is correct, via NSight Graphics.
count = 16 because of 16 terrain tile meshes (each tile has a command)
offset = 0
stride = 12 sizeof(DrawMeshTasksIndrectCommandNV)
my mesh shader draw call is
glMultiDrawMeshTasksIndirectNV(0, 16, 12);
My task shader has DrawMeshTasksIndirectCommandNV bound as an SSBO
struct DrawCommand
{
uint taskCount;
uint firstTask;
uint meshID;
};
layout(std430, binding = 5) readonly buffer drawCommand
{
DrawCommand commands[];
};
...
uint idx = gl_DrawID;
uint meshID = commands[idx].meshID;
// Use meshID to index into mesh array
When I run, I see one tile, as if gl_DrawID is stuck at 0.
However, if I force stride to be 0, I see 5 tiles, but ill-defined.
I’m doing something wrong here. Any help is greatly appreciated.
Thanks,
DC