From acdf4433b7b8e022b3962cf05188d9da2513b31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Thu, 19 Oct 2017 16:16:23 +0200 Subject: Reserve vector size ahead of time in the AttachmentPack class Change-Id: Iaed11a9bc23da076dff7006d7aa34f17c6c2aac8 Reviewed-by: Paul Lemire --- src/render/backend/attachmentpack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/render/backend/attachmentpack.cpp b/src/render/backend/attachmentpack.cpp index 6dee7587b..9a08fdde4 100644 --- a/src/render/backend/attachmentpack.cpp +++ b/src/render/backend/attachmentpack.cpp @@ -67,11 +67,13 @@ AttachmentPack::AttachmentPack(const RenderTargetSelector *selector, const Rende // If nothing is specified, use all the attachments as draw buffers if (selectedAttachmentPoints.isEmpty()) { + m_drawBuffers.reserve(m_attachments.size()); for (const Attachment &attachment : qAsConst(m_attachments)) // only consider Color Attachments if (attachment.m_point <= QRenderTargetOutput::Color15) m_drawBuffers.push_back((int) attachment.m_point); } else { + m_drawBuffers.reserve(selectedAttachmentPoints.size()); for (QRenderTargetOutput::AttachmentPoint drawBuffer : selectedAttachmentPoints) if (drawBuffer <= QRenderTargetOutput::Color15) m_drawBuffers.push_back((int) drawBuffer); -- cgit v1.2.3