This patch cleans up PBVH draw to build the PBVH draw cache in two steps, eliminating a variety of bugs. The various draw engines submit requests for GPU attributes to PBVH, which then creates the GPU batches.
There are a number of evil things done to make this work given limitations in the draw manager design:
1. The batch creation step still happens within a single viewport draw call. While the mesh cache is shared between viewports it's not built prior to viewport draw, which means in some cases the GPU mesh may be built multiple times. For example, say there are two viewports, A and B. A builds the mesh cache it needs, then draws. B checks the mesh cache and sees it needs more attributes, so it rebuilds the cache and then draws.
2. Because of #1 we cannot avoid invalidating batches within the batch building process, corrupting memory. This is avoided by clearing and reinitializing the same `GPUBatch` structures with new VBOs. This works as the draw cache only stores pointers to batches and not the VBOs themselves.
3. The code paths where engines request GPU attributes are still rather messy and confusing.
Other notes:
# `PBVH_draw_cb` has been rewritten into two functions, `BKE_pbvh_get_batches` and `BKE_pbvh_update_batches.`
# Code still needs to be threaded.
# Fast navigate is not yet implemented.
# Delay view updates is implemented but not tested.
# There is a bug where objects briefly disappear and then reappear when the attribute layout changes.
This patch was originally D15368.