This a follow up for a question I answered on GameDev SE. The question was simply Is glDrawArraysInstanced in OpenGL parallel when drawing those instances?

My answer was in the lines of "the GPU might execute multiple draw calls in parallel depending on multiple things, for instance if two draw calls use the same vertex shaders." Here is the full answer.

In the comments the OP mentioned, "I think it should be sequential. After all, some of blending mode depends of sequence"

Now, I am little bit confused. Is my answer of it will still parallelize them when it can valid? Can someone clarify this?


1 Answer 1


The result should be as if it was executed sequentially one triangle at a time. This is important so that each frame is deterministic. If it wasn't then drawing the same frame multiple times could create different results and create a flickering image on screen.

However that does not mean parallelization is impossible. Vertices can be computed in parallel. Their results will be ordered and fed to the rasterizer which will feed the fragment shader stage.

The same happens with pixels. Typically a group of pixels from a triangle can be computed in parallel and blended. A non-overlapping triangle can then also be filled at the same time however if triangle overlaps one currently busy then the result of the fragment shader must be buffered until the corresponding pixels of the previous triangle are done so blending can happen in the correct order.

  • $\begingroup$ It's entirely possible to run the pixel shader for overlapping triangles at the same time. All that matters is that the blending happens sequentially. Pixel shaders can kick off a lot of work to the blending unit in any order, which can then reorder all those blend operations depending on the triangle that it came from. $\endgroup$ Nov 5, 2015 at 14:44
  • $\begingroup$ I've seen situations where flickering does occur due to multiple triangles lying in the same plane, but I don't remember if that happened while the camera/world/etc. transforms were static or if it required movement and recalculation. That's an edge case, though. $\endgroup$
    – JAB
    Nov 5, 2015 at 16:07
  • $\begingroup$ @JAB It sounds like you're referring to z-fighting. This usually occurs due to the fact that even if two primitives are analytically co-planar, quantization in the interpolator produces a pattern where some pixels from both primitives are visible. The pattern will shift, causing flickering, only if the vertices (or camera) are moved, otherwise the interference pattern should be consistent between frames. $\endgroup$
    – MooseBoys
    Nov 5, 2015 at 17:46
  • $\begingroup$ @MooseBoys That's exactly it, yeah. It's been a few years since I did much with 3D graphics. $\endgroup$
    – JAB
    Nov 5, 2015 at 18:43
  • $\begingroup$ Besides just running multiple vertices and pixels in parallel, it's also possible for multiple draw calls to be in flight at the same time, if enough GPU resources are available and there is no dependency between the draw calls. $\endgroup$ Nov 5, 2015 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.