Open cubanismo opened 4 years ago
Note this issue was pointed out by a developer here: https://forums.developer.nvidia.com/t/gldrawelementsindirect-throws-zero-buffer-bound-to-gl-draw-indirect-buffer/117307
The NVIDIA driver currently returns GL_INVALID_OPERATION for this case.
@cubanismo there is already this in the error section on page 367 of the OpenGL 4.6 core spec:
An INVALID_OPERATION error is generated if zero is bound to DRAW_INDIRECT_BUFFER
Is that enough?
Section 10.3.11 of the OpenGL 4.6 spec defines "Indirect commands in Buffer Objects", or the GL_DRAW_INDIRECT_BUFFER/GL_DISPATCH_INDIRECT_BUFFER buffer targets. It refers readers to section 10.3.9 for general properties of the mechanism. Section 10.3.9 notes behavior is undefined if buffer object zero is bound to an enabled array at draw time, but it is not clear from the language in section 10.3.11 if this property is inherited by indirect buffers. Notably, section 10.3.10 duplicates the zero-object undefined behavior property while referring to section 10.3.9 for general behavior, while section 10.3.11 does not, perhaps implying it is well-defined and supported for indirect commands to use client memory for their indirect command memory. Further, no error case is defined for this situation in the DrawIndirect commands. The only clarifying point that indicates to the contrary is that the compatibility profile spec contains additional language:
"If zero is bound to DRAW_INDIRECT_BUFFER, the corresponding DrawIndirect commands instead source their arguments directly from the indirect pointer in client memory"
Which clearly defines the behavior only in the compatibility profile, implying it is intended to be undefined in the core profile.
To clarify this in the core profile spec, I think an explicit error case should be added to the DrawIndirect commands (probably in DrawArraysIndirect, so it will be inherited by all of them), and the "undefined behavior" language from section 10.3.9/10.3.10 should be duplicated into section 10.3.11 as well.