Closed chrisforbes closed 10 years ago
Here's the indirect buffer layout:
typedef struct {
GLuint count;
GLuint primCount;
GLuint firstIndex;
GLint baseVertex;
GLuint reservedMustBeZero;
} DrawElementsIndirectCommand;
and for nonindexed rendering:
typedef struct {
GLuint count;
GLuint primCount;
GLuint first;
GLuint reservedMustBeZero;
} DrawArraysIndirectCommand;
The immediate HUGE wrinkle in this is that hardware wants a vertex count, but the spec requires the BO to contain a primitive count.
Scratch that, I misread the spec.
This basically works now, except that Haswell doesn't like the register writes from a userspace batch.
The idea with draw_indirect is to source parameters for rendering commands from a BO. This allows better pipelined rendering if the GPU is generating the rendering commands.
On Gen7, this is done as follows:
Indirect Parameter Enable
(dw0.10) set.NOTE: This can be reasonably extended to ARB_multi_draw_indirect by looping over offsets in the BO. The hardware provides no facility for automatically walking the BO, moving values to the MMIO registers and triggering draws, but the driver knows how big it is so can do the right thing.