As we all know, when ripping batches with standard glDrawElements() or glDrawElementsInstanced(), with a standard VBO bound with glBindBuffer( GL_ELEMENT_ARRAY_BUFFER ) containing the index list, you can provide a byte-offset into this VBO via the “const void *indices” argument to these draw calls. This allows you to place the index list for a batch anywhere within the bound buffer.
However, when using glDrawElementsIndirect() or glMultiDrawElementsIndirect(), there is no such argument to provide a byte-offset into the GL_ELEMENT_ARRAY_BUFFER. So, logically, one would think you should just account for the byte offset by binding it, not with ol’ glBindBuffer(), but with glBindBufferRange instead, providing the byte offset into the buffer to the “offset” parameter of this API call…
…except that glBindBufferRange does not accept GL_ELEMENT_ARRAY_BUFFER as a valid buffer target. (???)
How do you do this? Am I missing something?
That is, how do you provide a byte-offset into a buffer object to use for fetching the index list in a glDrawElementsIndirect() call?
[HR][/HR]
…as an aside, it’s interesting to note that if you use NV bindless with glDrawElementsIndirect() or glMultiDrawElementsIndirect(), it doesn’t appear that you have any problem with byte offsets into the index buffer, as you’d provide the byte offset into the glBufferAddressRangeNV() call as usual before launching the draw call:
glBufferAddressRangeNV( GL_ELEMENT_ARRAY_ADDRESS_NV, 0, gpu_addr+offset, size );