-
Charlie Lao authored
BufferVk::mHostVisibleBufferPool is allocated when BufferVk::mBuffer is not hostvisible and we need to map it. In that case mHostVisibleBufferPool is allocated and data copied from mBuffer to it and the pointer to mHostVisibleBufferPool is returned to user. BufferVk::mMapInvalidateRangeStagingBuffer is used when map is called on a small range. In this case we allocate memory for the small range of buffer and return that intead of waiting for entire buffer for GPU to finish. Also when BufferSubData is called, we also needs to allocate a staging buffer and issue a copyBuffer from staging buffer to main buffer. This CL consolidate all these three usage cases into one mStagingBuffer. It removes mHostVisibleBufferPool and mMapInvalidateRangeStagingBuffer from BufferVk class. This makes overall logic of managing data consistency much simpler as well since we only have two buffers: The main buffer storage mBuffer or mStagingBuffer. And mIsStagingBufferMapped tracks if mStagingBuffer is the one actually mapped to user or not so that at unmap time we know if we should flush the data to mBuffer or not. Bug: b/208323792 Change-Id: I4f0c79a2d86da1a43844ed2ba83ddeb7dd4a5c0b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3335216 Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Charlie Lao <cclao@google.com>
43b0e92b