diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-28 14:43:58 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-30 20:07:36 +0200 |
commit | d4c17725abe381d247d6c453dafe87b8e17e80de (patch) | |
tree | 9e3438ec23e08dac26a0407c243d91c794fffcec /src/gui/rhi/qrhigles2.cpp | |
parent | e1ed2c3864e2b9aeeebec25de60ab62eb254b591 (diff) |
De-d-pointer QRhiShaderResourceBinding
Sad to see this go since the d pointer pattern with implicit sharing
would have been perfect for this class, had this been a public API.
However, as binary compatibility will not be a concern for QRhi classes,
it is wasteful to allocate memory on every QRhiShaderResourceBinding.
This allows users, such as Qt Quick, to use QRhiShaderResourceBinding as
a cheap, simple, value class, without having to invent their own
alternatives in performance critical places.
The change brings a not insignficant improvement in certain qmlbench scenes
(the ones with thousands of unbatched geometry nodes).
Change-Id: I6d1dced6498d9ad625f90ead78bc0a417ea99ed8
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 11beda5b92..5afba774a9 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -868,7 +868,7 @@ void QRhiGles2::setShaderResources(QRhiCommandBuffer *cb, QRhiShaderResourceBind QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, srb); bool hasDynamicOffsetInSrb = false; for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) { - const QRhiShaderResourceBindingPrivate *b = QRhiShaderResourceBindingPrivate::get(&srbD->m_bindings[i]); + const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data(); switch (b->type) { case QRhiShaderResourceBinding::UniformBuffer: // no BufUniformRead / AccessUniform because no real uniform buffers are used @@ -2306,7 +2306,7 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC int texUnit = 0; for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) { - const QRhiShaderResourceBindingPrivate *b = QRhiShaderResourceBindingPrivate::get(&srbD->m_bindings[i]); + const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data(); switch (b->type) { case QRhiShaderResourceBinding::UniformBuffer: |