Class InstancingBufferUploadRenderer
- Namespace
- Stride.CommunityToolkit.Rendering.Instancing
- Assembly
- Stride.CommunityToolkit.dll
Manages and uploads the GPU buffers of every registered BufferedEntityInstancing.
public class InstancingBufferUploadRenderer : SceneRendererBase, IComponent, IReferencable, ICollectorHolder, ISceneRenderer, IRenderCollector, IGraphicsRenderer, IGraphicsRendererBase, IGraphicsRendererCore, IDisposable
- Inheritance
-
InstancingBufferUploadRenderer
- Implements
- Inherited Members
Remarks
A buffered instancing needs two things that can only happen on the main thread at specific points in the frame, which is what this renderer provides. Stride's frame order is: entity processors gather, then the compositor collects, then render features extract and prepare, then the compositor draws. Buffers are therefore created or grown during collect - before the render feature reads them - and uploaded during draw.
It must run before the renderer that draws the scene, so the upload is recorded ahead of the draw
calls that read it; otherwise the frame renders the previous frame's positions.
AddInstancingBufferUpload inserts it in the right place.
Fields
ProfilingKey
The block the profiler shows this renderer's GPU time under.
public static readonly ProfilingKey ProfilingKey
Field Value
Properties
Targets
Gets the instancings whose buffers this renderer manages.
[DataMemberIgnore]
public List<BufferedEntityInstancing> Targets { get; }
Property Value
Remarks
DataMemberIgnoreAttribute matters: SceneRendererBase is a data contract, and without it Stride's assembly processor tries to generate a serializer for the GPU buffers behind these and fails the build.
Methods
CollectCore(RenderContext)
protected override void CollectCore(RenderContext context)
Parameters
contextRenderContext
DrawCore(RenderContext, RenderDrawContext)
protected override void DrawCore(RenderContext context, RenderDrawContext drawContext)
Parameters
contextRenderContextdrawContextRenderDrawContext