diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-09-06 13:17:54 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 15:19:02 +0000 |
commit | 252d2e5f2a237862cc50f926f66184d499298239 (patch) | |
tree | cf5f7b7a27a5dc0f00dab967bdb57287c4a3f3bc /src/render/backend/renderview.cpp | |
parent | 391fe1d2c15f87e8f3bd31501346436c75b53d38 (diff) |
Rework resource handling
Rework the way the QResourceManager allocates and manages
it's resources. Get rid of the huge pre-allocated freelist,
and instead merge it with the counter field (that is now
always a quintptr large).
Give QHandle a direct pointer to it's data in addition to
the counter. This makes QHandle 8 or 16 bytes large, but
speeds up access to it's data and gives more safety on the
counter as that one now always has at least 31 bits.
Counter and the linked freelist use the same memory location.
To avoid potential conflicts, make sure the counter is always
an odd number, so it can't be a valid pointer.
Do not use INDEXBITS anymore, the resource manager can now
always allocate as many resources as we have RAM available
and will grow with the required use (and not allocate fixed
memory upfront).
This change reduces the memory consumption of the qardboard
example from a bit above 40 to 10MB.
Change-Id: I514f2d3f957f8635098fb88342e42e3361456340
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/backend/renderview.cpp')
-rw-r--r-- | src/render/backend/renderview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 8c9737689..7adf7c5d2 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -379,7 +379,7 @@ void sortByMaterial(QVector<RenderCommand *> &commands, int begin, const int end while (begin != end) { if (begin + 1 < rangeEnd) { std::stable_sort(commands.begin() + begin + 1, commands.begin() + rangeEnd, [] (RenderCommand *a, RenderCommand *b){ - return a->m_material < b->m_material; + return a->m_material.handle() < b->m_material.handle(); }); } begin = rangeEnd; |