You can see in the API inspector the list of calls preceding the draw.
I'm deeply puzzled by this, because of the following facts:
This problem only happens when the UI library returns more than one mesh. That is, the API calls for multiple meshes would go as follows:
// First mesh glUseProgram // set textures // bind vertex array glNamedBufferData // for the vertex buffer glNamedBufferData // for the index buffer glDrawElements // Second mesh glNamedBufferData // for the vertex buffer glNamedBufferData // for the index buffer glDrawElements ...
Why I find this strange:
- The vertex array object is fully set up at the start of the program, including the call to glVertexArrayVertexBuffer, and the binding of vbo to vao is never supposed to change, together with offset and stride.
- I removed every other draw call from the program for testing and left only those for the UI, so nothing should interfere
- The UI renders just fine in the program, it's only RenderDoc that complains
I see 2 possibilities - 1) I am using the API incorrectly, and 2) there's a bug in RenderDoc.
Would really appreciate if someone could shed some light onto this issue.
Nicol Bolas commented below
"including the call to glVertexArrayVertexBuffer" Are you sure about that?
I have captured Frame #0 and Frame #1815 in Renderdoc to illustrate that the call is made (see the image below) and noticed that in the second frame no errors were reported! It strongly suggests that if Frame #0 is not captured, then Renderdoc just doesn't know that the appropriate calls have been made and reports false errors.
Also quite expectedly, if I remove the call to glVertexArrayVertexBuffer, then nothing gets drawn and OpenGL complains. I almost think we've solved the mystery.
As per Nicol Bolas's suggestion I have rewritten the code so that all the meshes are packed into one vertex buffer and are loaded there once per frame. After this change Renderdoc stopped complaining. I mostly consider the issue solved, but one thing is still not clear:
If the assumption that Renderdoc needed Frame #0 to "know" about the call to
glVertexArrayVertexBuffer is correct, then why did it not complain when there was only 1 mesh to draw (i.e. there were no multiple draw calls with
glNamedBufferData between them).
If no one knows for sure why this is happening, I will probably raise an issue with Renderdoc and mark this question as done.