diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-10-09 18:47:14 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-10-11 10:58:41 +0200 |
commit | 9d804a54aef1a52b652f976b361b2b7e00073349 (patch) | |
tree | 7cecac3b484c6eb9ee273592397c16b9dba09f3d | |
parent | 2ac2809ec36af238b3755f176ef45427c1d32467 (diff) |
rhi: gl: Move some code out of the inner loops
Change-Id: I96c71ef45b93ab95250a2a3f0e9c10e8bc86d650
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 8 |
1 files 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<float, 256> 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 |