summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-08-10 11:53:08 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-08-10 16:57:58 +0200
commit1b63d866c6e8d157c5034af4bfd1caa996487f18 (patch)
tree2e97d78b043d6d008a0a8c690466cd571e2dc9f7 /src
parent87a3909fe151821c46da9cf028895e1bbf54e9d1 (diff)
rhi: sort attributeInfo by names
So that geometries with the same attributes but added in a different order still generate the same key. Change-Id: I0feb42fd00f546dd9421d645d68d49ede1bab590 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/renderers/rhi/renderer/renderview.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/renderers/rhi/renderer/renderview.cpp b/src/plugins/renderers/rhi/renderer/renderview.cpp
index 19b46e512..9742ebbdd 100644
--- a/src/plugins/renderers/rhi/renderer/renderview.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderview.cpp
@@ -928,6 +928,14 @@ EntityRenderCommandData RenderView::buildDrawRenderCommands(const Entity **entit
}
}
+ // Sort attributes by name so that same attributes added
+ // in different order would still result in the same geometeyLayout key
+ std::sort(command.m_attributeInfo.begin(),
+ command.m_attributeInfo.end(),
+ [] (const AttributeInfo &a, const AttributeInfo &b) {
+ return a.nameId < b.nameId;
+ });
+
command.m_drawIndexed = (indexAttribute != nullptr);
command.m_drawIndirect = (indirectAttribute != nullptr);
command.indexAttribute = nullptr;