diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-02-17 13:22:38 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-02-20 18:06:32 +0100 |
commit | 7dbf9ae9e4b46b037f7935c08a701a819640554e (patch) | |
tree | dd14b1f7d4403664a2ae223381541bf527f5e784 /src/gui/rhi/qrhi.cpp | |
parent | 6cf3447f1d119a5e61c5abf3ac546ec4746ee5fe (diff) |
rhi: Remove QRhiSrb data getters
This is for internal use, QRhiShaderResourceBinding does not need
to have the data() getters. The backends can use any internal means
to access this, no need to have the getters in the frontend just for
that.
Now, Qt Quick 3D has a special case of accessing this, hence keeping
the two getters for now, to be removed in a follow up once that repo
updates.
While we are at it, share and reuse the sorting function.
Change-Id: Ia2308af79863c72ca65024ce6c00531d0256a2cb
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi.cpp')
-rw-r--r-- | src/gui/rhi/qrhi.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index fdf8acb3bb..4825721053 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -3367,7 +3367,7 @@ void QRhiImplementation::updateLayoutDesc(QRhiShaderResourceBindings *srb) srb->m_layoutDesc.clear(); auto layoutDescAppender = std::back_inserter(srb->m_layoutDesc); for (const QRhiShaderResourceBinding &b : std::as_const(srb->m_bindings)) { - const QRhiShaderResourceBinding::Data *d = b.data(); + const QRhiShaderResourceBinding::Data *d = &b.d; srb->m_layoutDescHash ^= uint(d->binding) ^ uint(d->stage) ^ uint(d->type) ^ uint(d->arraySize()); layoutDescAppender = d->serialize(layoutDescAppender); @@ -4083,8 +4083,8 @@ QRhiShaderResourceBinding QRhiShaderResourceBinding::bufferLoadStore( */ bool operator==(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBinding &b) noexcept { - const QRhiShaderResourceBinding::Data *da = a.data(); - const QRhiShaderResourceBinding::Data *db = b.data(); + const QRhiShaderResourceBinding::Data *da = QRhiImplementation::shaderResourceBindingData(a); + const QRhiShaderResourceBinding::Data *db = QRhiImplementation::shaderResourceBindingData(b); if (da == db) return true; @@ -4173,7 +4173,7 @@ bool operator!=(const QRhiShaderResourceBinding &a, const QRhiShaderResourceBind */ size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept { - const QRhiShaderResourceBinding::Data *d = b.data(); + const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b); size_t h = uint(d->binding) ^ uint(d->stage) ^ uint(d->type) ^ seed; switch (d->type) { case QRhiShaderResourceBinding::UniformBuffer: @@ -4207,7 +4207,7 @@ size_t qHash(const QRhiShaderResourceBinding &b, size_t seed) noexcept QDebug operator<<(QDebug dbg, const QRhiShaderResourceBinding &b) { QDebugStateSaver saver(dbg); - const QRhiShaderResourceBinding::Data *d = b.data(); + const QRhiShaderResourceBinding::Data *d = QRhiImplementation::shaderResourceBindingData(b); dbg.nospace() << "QRhiShaderResourceBinding(" << "binding=" << d->binding << " stage=" << d->stage @@ -5431,7 +5431,7 @@ bool QRhiImplementation::sanityCheckShaderResourceBindings(QRhiShaderResourceBin const int CHECKED_BINDINGS_COUNT = 64; bool bindingSeen[CHECKED_BINDINGS_COUNT] = {}; for (auto it = srb->cbeginBindings(), end = srb->cendBindings(); it != end; ++it) { - const int binding = it->data()->binding; + const int binding = shaderResourceBindingData(*it)->binding; if (binding >= CHECKED_BINDINGS_COUNT) continue; if (binding < 0) { @@ -5439,7 +5439,7 @@ bool QRhiImplementation::sanityCheckShaderResourceBindings(QRhiShaderResourceBin bindingsOk = false; continue; } - switch (it->data()->type) { + switch (shaderResourceBindingData(*it)->type) { case QRhiShaderResourceBinding::UniformBuffer: if (!bindingSeen[binding]) { bindingSeen[binding] = true; @@ -5493,7 +5493,7 @@ bool QRhiImplementation::sanityCheckShaderResourceBindings(QRhiShaderResourceBin } break; default: - qWarning("Unknown binding type %d", int(it->data()->type)); + qWarning("Unknown binding type %d", int(shaderResourceBindingData(*it)->type)); bindingsOk = false; break; } |