RenderDoc for Oculus render stage trace with DrawProceduralIndirect() / glDrawArraysIndirect()
Hi all,
I've recently been working on adding indirect draw calls (using Unity version 2020.3.25f1) with our app. I've noticed some unexpected results from render stage traces in RenderDoc for Oculus and I'm wondering if anyone has insight into this.
As part of this, I've been switching code from using Unity's Graphics.DrawProcedural() function to Graphics.DrawProceduralIndirect(). (On OpenGL, this corresponds to the glDrawArraysIndirect() function).
As a baseline, here's what a render stage trace from our app looks like using direct rendering (DrawProcedural). There are two surfaces, corresponding to the outputs for each eye. This screenshot looks correct to me, and appears logical.
The next screenshot below is from indirect drawing. The app logic is the same as for the first screenshot, other than that the draw call parameters are uploaded from the CPU to indirect arguments buffers and then rendered with indirect draw calls using Unity's DrawProceduralIndirect(). Here, the first surface appears to be taking much longer than the second surface, which doesn't make much sense to me.
Interestingly, if I use the same RenderDoc capture from indirect rendering as the screenshot above, but click the "Time durations for render stages" button in RenderDoc a second time, I get a different render stage trace. This trace has more equal durations for the two surfaces / eyes, which makes sense. However, surface 0x9 appears twice in the timeline, whereas surface 0x8 only appears once, and I'm not sure why this is. There's also a gap in the middle of the timeline.
I have a few questions - any help with the following would be much appreciated!
- It's not obvious to me why direct vs indirect drawing would cause this difference. I think it could be that there is some sort of synchronization issue with the indirect draw call arguments buffer that could cause this. Is this difference expected?
- Why does clicking the "Time durations for render stages" button twice give such a different result with indirect drawing? If I click the button twice with direct drawing, the new trace is substantially the same.
- What does the gap in the middle of the last screenshot indicate? Does this indicate the GPU idling / stalling or something else?
Many thanks.
