Vulkan: MAP_INVALIDATE_RANGE_BIT: shadow or exclude One method of dealing with glMapBufferRange + range invalidation; treat it like bufferSubData and stage the update. Another method is to ghost the buffer but copy only memory outside the invalidated range. This CL pursues a policy where if less than half of the buffer is invalidated, we stage. Otherwise, we ghost and copy only memory outside the invalidated range. DynamicBuffer is chosen over DynamicShadowBuffer because it turns out to end up implicitly tracking all active invalidate ranges (through its freelist), and performs buffer copy on GPU. if we use a DynamicShadowBuffer and then BufferVk::stagedUpdate, it's the same thing but more work (an extra memcpy into the staging buffer). To make this clear, we split the logic of stagedUpdate into two parts, the allocation/map, and the flush, and reuse one half in glMapBufferRange, and the other half in glUnmapBuffer. Test: Faster performance in MapBufferRange perf test, no non-noisy regress in trace tests Bug: angleproject:6634 Change-Id: Ie2e6a9586824b8cb59a97419bb8052acd1de2033 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3251686 Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Lingfeng Yang <lfy@google.com>