Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
excessive glClear()ing #4694
Looking at an apitrace of Processing's 3.2.1's QuadRendering demo, the handling of clearing is inefficient:
Two problems here:
double clearing depth
On i965, you will actually clear depth twice. Nobody expects an app to emit double clears of the same buffer, and i965 probably won't ever do the tracking necessary to elide your second clear.
Separate clearing of the buffers
On vc4, this resulted in 2 extra flushes of the job (huge memory bandwidth cost). This is common enough that I've now added workarounds for this to vc4 to coalesce the clears together, but you may still be triggering pathological behavior on other tiling renderers.
ok, the separate calls were not actually together in the code, but ended happening so because during frame initialization the renderer clears the depth and stencil buffers, and then the color buffer separately (only) when background() is called in draw(). Actually, it is a little trickier to fix properly, as it is not enough to just to clear depth, stencil, and color buffers in background. You would still need to clear depth and stencil buffers in sketches that don't clear the background.