Ver código fonte

Making the renderer defered (tiler up front). WIP parallel visibility tests

Panagiotis Christopoulos Charitos 13 anos atrás
pai
commit
cf3924ff44
2 arquivos alterados com 30 adições e 1 exclusões
  1. 1 1
      src/renderer/Renderer.cpp
  2. 29 0
      src/scene/VisibilityTester.cpp

+ 1 - 1
src/renderer/Renderer.cpp

@@ -80,8 +80,8 @@ void Renderer::render(Scene& scene_)
 
 	viewProjectionMat = cam.getViewProjectionMatrix();
 
-	ms.run();
 	tiler.updateTiles(scene->getActiveCamera(), ms.getDepthFai());
+	ms.run();
 	is.run();
 	if(pps.getEnabled())
 	{

+ 29 - 0
src/scene/VisibilityTester.cpp

@@ -4,11 +4,15 @@
 #include "anki/scene/Renderable.h"
 #include "anki/scene/Light.h"
 #include "anki/renderer/Renderer.h"
+#include "anki/core/ThreadPool.h"
 
 namespace anki {
 
+//==============================================================================
+// Misc                                                                        =
 //==============================================================================
 
+//==============================================================================
 struct DistanceSortFunctor
 {
 	Vec3 origin;
@@ -26,6 +30,31 @@ struct DistanceSortFunctor
 	}
 };
 
+//==============================================================================
+struct MaterialSortFunctor
+{
+	// XXX
+};
+
+//==============================================================================
+struct TestJob: ThreadJob
+{
+	U count;
+	Scene::Types<SceneNode>::Container::iterator nodes;
+	VisibilityInfo::Renderables* renderables;
+	VisibilityInfo::Lights* lights;
+
+	void operator()(U threadId, U threadsCount)
+	{
+		U64 start, end;
+		choseStartEnd(threadId, threadsCount, count, start, end);
+
+		for(auto it = nodes + start; it != nodes + end; it++)
+		{
+		}
+	}
+};
+
 //==============================================================================
 VisibilityTester::~VisibilityTester()
 {}