From 00d3afe4ff22f146a9ac9dc4f9fce004deb91333 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 16 Oct 2024 15:39:38 +0200 Subject: [PATCH] rhi: Reduce prealloc for some internal VLAs in resource update batches Change-Id: If95ed36401e03b44648ef1b41701c8d522c1ce99 Reviewed-by: Andy Nichols (cherry picked from commit 502114ba99dca60f1511f3d74487312fe370336b) Reviewed-by: Qt Cherry-pick Bot --- src/gui/rhi/qrhi.cpp | 4 ++-- src/gui/rhi/qrhi_p.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index 521ea92d942..5a6bdc9e31c 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -9439,8 +9439,8 @@ void QRhiResourceUpdateBatchPrivate::merge(QRhiResourceUpdateBatchPrivate *other bool QRhiResourceUpdateBatchPrivate::hasOptimalCapacity() const { - return activeBufferOpCount < BUFFER_OPS_STATIC_ALLOC - 16 - && activeTextureOpCount < TEXTURE_OPS_STATIC_ALLOC - 16; + return activeBufferOpCount < BUFFER_OPS_STATIC_ALLOC - 4 + && activeTextureOpCount < TEXTURE_OPS_STATIC_ALLOC - 4; } void QRhiResourceUpdateBatchPrivate::trimOpLists() diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index fc3da12f787..68e3533053b 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -527,11 +527,11 @@ public: }; int activeBufferOpCount = 0; // this is the real number of used elements in bufferOps, not bufferOps.count() - static const int BUFFER_OPS_STATIC_ALLOC = 1024; + static const int BUFFER_OPS_STATIC_ALLOC = 64; QVarLengthArray bufferOps; int activeTextureOpCount = 0; // this is the real number of used elements in textureOps, not textureOps.count() - static const int TEXTURE_OPS_STATIC_ALLOC = 256; + static const int TEXTURE_OPS_STATIC_ALLOC = 32; QVarLengthArray textureOps; QRhiResourceUpdateBatch *q = nullptr;