Forráskód Böngészése

Move sorting of render keys to RenderContext

Daniele Bartolini 12 éve
szülő
commit
24e3bcf187

+ 8 - 0
engine/renderers/backend/RenderContext.h

@@ -26,6 +26,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
+#include <algorithm>
+
 #include "Color4.h"
 #include "Matrix4x4.h"
 #include "CommandBuffer.h"
@@ -162,6 +164,7 @@ struct Sampler
 	uint32_t	flags;
 };
 
+/// Maintains the states necessary for a single draw call.
 struct RenderState
 {
 	void clear()
@@ -344,6 +347,11 @@ struct RenderContext
 		m_constants.commit();
 	}
 
+	void sort()
+	{
+		std::sort(m_keys, m_keys + m_num_states);
+	}
+
 public:
 
 	uint64_t m_flags;

+ 1 - 1
engine/renderers/backend/gl/GLRenderer.cpp

@@ -260,7 +260,7 @@ public:
 		uint8_t layer = 0xFF;
 
 		// Sort render keys
-		std::sort(context.m_keys, context.m_keys + context.m_num_states);
+		context.sort();
 
 		for (uint32_t s = 0; s < context.m_num_states; s++)
 		{