Reuse the memory we use for vertex uploads.
authorGunnar Sletta <gunnar@sletta.org>
Tue, 6 Jan 2015 07:40:21 +0000 (08:40 +0100)
committerGunnar Sletta <gunnar@sletta.org>
Tue, 6 Jan 2015 16:18:27 +0000 (17:18 +0100)
commita371bac3fba73f92aaa63a68d8ab1ae81a1d1031
tree63b9b03a6a833a7cd7e2b421e3be275587156223
parentba455b8e1cbd3c892670cbd8b11278edfef7355d
Reuse the memory we use for vertex uploads.

Every batch would have its own buffer with its own memory
and the original idea was that it would stabilize so that
the same batch would be used over and over, so the memory
allocatd for each batch's buffer would be reused. In practice
batches get discarded and recycled in somewhat arbitrary
order so we always end up reallocating.

Instead, use a single buffer for all uploads. This saves us several
reallocations per frame, and also prevents pooling of several
potentially large allocated blocks inside the renderer.

The exception is when using visualization or for drivers
which have broken index buffer support (nouveau only currently),
where we keep the existing behavior as the buffer data is
needed during rendering and visualization.

Change-Id: Id29095e00128ec1ee6d4ac3caa8f2c17cc7bbd27
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h