- return new Renderer(dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, depthFunction, stencilParameters);
+MemoryPoolObjectAllocator<Renderer> gRenderRendererMemoryPool;
+}
+
+void Renderer::PrepareCommandBuffer()
+{
+ // Reset latest geometry informations, So we can bind the first of geometry.
+ ReuseLatestBindedVertexAttributes(nullptr);
+
+ // todo : Fill here as many caches as we can store for reduce the number of command buffers
+}
+
+RendererKey Renderer::NewKey(SceneGraph::RenderDataProvider* dataProvider,
+ Render::Geometry* geometry,
+ uint32_t blendingBitmask,
+ const Vector4& blendColor,
+ FaceCullingMode::Type faceCullingMode,
+ bool preMultipliedAlphaEnabled,
+ DepthWriteMode::Type depthWriteMode,
+ DepthTestMode::Type depthTestMode,
+ DepthFunction::Type depthFunction,
+ StencilParameters& stencilParameters)
+{
+ void* ptr = gRenderRendererMemoryPool.AllocateRawThreadSafe();
+ auto key = gRenderRendererMemoryPool.GetKeyFromPtr(static_cast<Renderer*>(ptr));
+
+ // Use placement new to construct renderer.
+ new(ptr) Renderer(dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, depthFunction, stencilParameters);
+ return RendererKey(key);