Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nezticle/bb7d1fb13fa3e73a83756057eed9a9c5 to your computer and use it in GitHub Desktop.
Save nezticle/bb7d1fb13fa3e73a83756057eed9a9c5 to your computer and use it in GitHub Desktop.
Debug Back To Front sorting in Qt3D
From 0e8ec609def938ba5dc816073605b66cc213c0b9 Mon Sep 17 00:00:00 2001
From: Andy Nichols <andy.nichols@qt.io>
Date: Wed, 16 May 2018 13:32:04 +0200
Subject: [PATCH] DEBUG: Output BackToFront Sorting
Obviously dont merge this...
Change-Id: I5227419e0692192ff153a0c272ab00f4994ad865
---
src/render/renderers/opengl/renderer/renderview.cpp | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index c29448570..636b4d1fa 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -364,9 +364,22 @@ struct SubRangeSorter<QSortPolicy::BackToFront>
{
static void sortSubRange(CommandIt begin, const CommandIt end)
{
- std::stable_sort(begin, end, [] (RenderCommand *a, RenderCommand *b) {
+ QString outputString;
+ QTextStream outputStream(&outputString);
+ outputStream << "sortSubRange:\n";
+ std::for_each(begin, end, [&outputStream] (RenderCommand *a){
+ outputStream << "\t" << a << " " << a->m_depth << "\n";
+ });
+ //outputStream << "\tstable_sort\n";
+ std::stable_sort(begin, end, [&outputStream] (RenderCommand *a, RenderCommand *b) {
+ //outputStream << "\t\t" << a << " " << a->m_depth << " \t" << b << " " << b->m_depth << "\n";
return a->m_depth > b->m_depth;
});
+ outputStream << "sorted\n";
+ std::for_each(begin, end, [&outputStream] (RenderCommand *a){
+ outputStream << "\t" << a << " " << a->m_depth << "\n";
+ });
+ qDebug() << qPrintable(outputString);
}
};
--
2.14.3.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment