glMultiDrawElementsIndirect- Extremely strange issue

I’m using the following code to render a few meshes and submeshes with glMultiDrawElementsIndirect https://pastebin.com/QMfhY5gd . Unfortunately, the result for all but the first mesh (and its submeshes) is completely mangled. Strangely enough, in RenderDoc, this appears to not be an issue, so I’m not really sure what I could do to fix it. What could be going wrong here?

OpenGL version: 4.5 core
RenderDoc version: 1.0 (API v 1.2.1)
OS: Windows 10
(Here is the capture in case anyone wants to peek at it: https://my.mixtape.moe/fiiagc.rdc )
Help would be sincerely appreciated, I’ve been banging my head against this wall for three days and nothing seems to cause any movement.

It looks like you’ve bound the same buffer (_instance->_indirectBuffer) as both the GL_DRAW_INDIRECT_BUFFER and the GL_ARRAY_BUFFER and are latching at least one vertex attribute from this ARRAY_BUFFER binding. That’s probably not what you’d intended to do.

As far as I know, it actually is; of the very sparse documentation I’ve found on this, this blog post: https://litasa.github.io/blog/2017/09/04/OpenGL-MultiDrawIndirect-with-Individual-Textures uses that as a method for getting the indirect ID (I use that same post’s code to color the different id objects for debugging purposes as well, actually)

Removing that bind does not change anything, unfortunately.

Also, I made a small typo in the original source file in AddMesh- The typo was not what produced the error, and was made when editing out comments for clarity before posting.
The actual code being used to render is here;
https://pastebin.com/QMfhY5gd

Ok. From your comment I assume you are intentionally trying to source both the indirect draw call params as well as some/all of your vertex attributes from the same buffer object, correct? If so, that’s fine. But the way the code sets up one of its vertex attribute bindings makes it look like a mistake. The source doesn’t contain enough detail to establish clearly whether this attr setup is correct though.

I’d suggest that you just start adding GL state queries to your code to validate your assumptions. For instance, do a readback of the content of the buffer object and make sure that the contents of all of the fields are where you think they are. Also read back your vertex attribute bindings and enables and verify that they are set to the correct buffers and buffer offsets that you think they are. My guess is that in validating your assumptions, you’ll eventually find out which one isn’t carrying through to reality.

Another suggestion would be to try your program on a different GPU+driver (I’d recommend NVidia here) to see if you get different results. That may also give you a thread to chase and help you avoid wasting time on the off chance that you’re tripping over a driver bug.

With only one GPU I like to switch from Windows to Linux. At lats for Intel or AMD that should work out fine in most cases. With Nvidia I’m not actually sure how much features the open driver supports. Also maybe brings performance issues because of limited re-clocking for Nvidia GPUs in this drivers.

Once should run with other drivers from time to time anyway to find all the spots where one is not standard conform and the current driver just happens to tolerate/ignore it.

Ah, sorry! My computer totally died shortly after this, and I was just able to fix it… turns out that my dying graphics card was the cause of this. The code runs perfectly fine on my new laptop.
Thanks for the help!