diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-30 15:23:32 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-09-30 20:07:53 +0200 |
commit | 9e59024bf80124dbf301e8b3dca3dc4548fee428 (patch) | |
tree | fb3507ea76a57d1e72143821e565a6f6ae2e496e /src/gui/rhi/qrhi_p_p.h | |
parent | 7000b66f7e85e58d267b71322fbb3d5a0fc356b8 (diff) |
rhi: Speed up buffer and texture tracking
Task-number: QTBUG-78862
Change-Id: If278bd55530081cbbdbab8dd6e14d86e28da558e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhi_p_p.h')
-rw-r--r-- | src/gui/rhi/qrhi_p_p.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/rhi/qrhi_p_p.h b/src/gui/rhi/qrhi_p_p.h index 2cb96ebaf5..822da528f1 100644 --- a/src/gui/rhi/qrhi_p_p.h +++ b/src/gui/rhi/qrhi_p_p.h @@ -503,28 +503,32 @@ public: const UsageState &state); struct Buffer { - QRhiBuffer *buf; int slot; BufferAccess access; BufferStage stage; UsageState stateAtPassBegin; }; - const QVector<Buffer> *buffers() const { return &m_buffers; } + + using BufferIterator = QHash<QRhiBuffer *, Buffer>::const_iterator; + BufferIterator cbeginBuffers() const { return m_buffers.cbegin(); } + BufferIterator cendBuffers() const { return m_buffers.cend(); } struct Texture { - QRhiTexture *tex; TextureAccess access; TextureStage stage; UsageState stateAtPassBegin; }; - const QVector<Texture> *textures() const { return &m_textures; } + + using TextureIterator = QHash<QRhiTexture *, Texture>::const_iterator; + TextureIterator cbeginTextures() const { return m_textures.cbegin(); } + TextureIterator cendTextures() const { return m_textures.cend(); } static BufferStage toPassTrackerBufferStage(QRhiShaderResourceBinding::StageFlags stages); static TextureStage toPassTrackerTextureStage(QRhiShaderResourceBinding::StageFlags stages); private: - QVector<Buffer> m_buffers; - QVector<Texture> m_textures; + QHash<QRhiBuffer *, Buffer> m_buffers; + QHash<QRhiTexture *, Texture> m_textures; }; Q_DECLARE_TYPEINFO(QRhiPassResourceTracker::Buffer, Q_MOVABLE_TYPE); |