aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@sletta.org>2015-01-06 08:40:21 +0100
committerGunnar Sletta <gunnar@sletta.org>2015-01-06 17:18:27 +0100
commita371bac3fba73f92aaa63a68d8ab1ae81a1d1031 (patch)
tree63b9b03a6a833a7cd7e2b421e3be275587156223 /src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
parentba455b8e1cbd3c892670cbd8b11278edfef7355d (diff)
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>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h')
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index 29604cf820..50bea04f23 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -255,6 +255,8 @@ inline QDebug operator << (QDebug d, const Rect &r) {
struct Buffer {
GLuint id;
int size;
+ // Data is only valid while preparing the upload. Exception is if we are using the
+ // broken IBO workaround or we are using a visualization mode.
char *data;
};
@@ -549,7 +551,7 @@ private:
friend class Updater;
- void map(Buffer *buffer, int size);
+ void map(Buffer *buffer, int size, bool isIndexBuf = false);
void unmap(Buffer *buffer, bool isIndexBuf = false);
void buildRenderListsFromScratch();
@@ -640,6 +642,10 @@ private:
const QSGClipNode *m_currentClip;
ClipType m_currentClipType;
+ QDataBuffer<char> m_vertexUploadPool;
+#ifdef QSG_SEPARATE_INDEX_BUFFER
+ QDataBuffer<char> m_indexUploadPool;
+#endif
// For minimal OpenGL core profile support
QOpenGLVertexArrayObject *m_vao;