pub trait Renderer {
type RendererDrawData: DrawData;
// Required methods
fn create_renderer(ctx: &RenderContext) -> Self;
fn draw(
&self,
render_pipelines: &StaticResourcePoolReadLockAccessor<'_, GpuRenderPipelineHandle, RenderPipeline>,
phase: DrawPhase,
pass: &mut RenderPass<'_>,
draw_data: &Self::RendererDrawData
) -> Result<(), DrawError>;
fn participated_phases() -> &'static [DrawPhase];
}
Expand description
A Renderer encapsulate the knowledge of how to render a certain kind of primitives.
It is an immutable, long-lived datastructure that only holds onto resources that will be needed
for each of its Renderer::draw
invocations.
Any data that might be different per specific Renderer::draw
invocation is stored in DrawData
.
Required Associated Types§
Required Methods§
fn create_renderer(ctx: &RenderContext) -> Self
sourcefn draw(
&self,
render_pipelines: &StaticResourcePoolReadLockAccessor<'_, GpuRenderPipelineHandle, RenderPipeline>,
phase: DrawPhase,
pass: &mut RenderPass<'_>,
draw_data: &Self::RendererDrawData
) -> Result<(), DrawError>
fn draw( &self, render_pipelines: &StaticResourcePoolReadLockAccessor<'_, GpuRenderPipelineHandle, RenderPipeline>, phase: DrawPhase, pass: &mut RenderPass<'_>, draw_data: &Self::RendererDrawData ) -> Result<(), DrawError>
Called once per phase given by Renderer::participated_phases
.
sourcefn participated_phases() -> &'static [DrawPhase]
fn participated_phases() -> &'static [DrawPhase]
Combination of flags indicating in which phases Renderer::draw
should be called.
Object Safety§
This trait is not object safe.