From 9d804a54aef1a52b652f976b361b2b7e00073349 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 9 Oct 2020 18:47:14 +0200 Subject: [PATCH] rhi: gl: Move some code out of the inner loops Change-Id: I96c71ef45b93ab95250a2a3f0e9c10e8bc86d650 Reviewed-by: Andy Nichols --- src/gui/rhi/qrhigles2.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 0ec2ff9c35..1ea116d78c 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -2851,6 +2851,10 @@ void QRhiGles2::bindShaderResources(QGles2CommandBuffer *cbD, int texUnit = 1; // start from unit 1, keep 0 for resource mgmt stuff to avoid clashes bool activeTexUnitAltered = false; QVarLengthArray packedFloatArray; + QGles2UniformDescriptionVector &uniforms(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniforms + : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniforms); + QGles2UniformState *uniformState = maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniformState + : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniformState; for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) { const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data(); @@ -2867,10 +2871,6 @@ void QRhiGles2::bindShaderResources(QGles2CommandBuffer *cbD, } QGles2Buffer *bufD = QRHI_RES(QGles2Buffer, b->u.ubuf.buf); const char *bufView = bufD->ubuf + viewOffset; - QGles2UniformDescriptionVector &uniforms(maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniforms - : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniforms); - QGles2UniformState *uniformState = maybeGraphicsPs ? QRHI_RES(QGles2GraphicsPipeline, maybeGraphicsPs)->uniformState - : QRHI_RES(QGles2ComputePipeline, maybeComputePs)->uniformState; for (const QGles2UniformDescription &uniform : qAsConst(uniforms)) { if (uniform.binding == b->binding) { // in a uniform buffer everything is at least 4 byte aligned