pub struct Renderer { /* private fields */ }
Expand description
Renders a scene into a texture or surface.
Implementations§
source§impl Renderer
impl Renderer
sourcepub fn new(device: &Device, options: RendererOptions) -> Result<Self>
pub fn new(device: &Device, options: RendererOptions) -> Result<Self>
Creates a new renderer for the specified device.
sourcepub fn render_to_texture(
&mut self,
device: &Device,
queue: &Queue,
scene: &Scene,
texture: &TextureView,
params: &RenderParams
) -> Result<()>
pub fn render_to_texture( &mut self, device: &Device, queue: &Queue, scene: &Scene, texture: &TextureView, params: &RenderParams ) -> Result<()>
Renders a scene to the target texture.
The texture is assumed to be of the specified dimensions and have been created with
the wgpu::TextureFormat::Rgba8Unorm
format and the wgpu::TextureUsages::STORAGE_BINDING
flag set.
sourcepub fn render_to_surface(
&mut self,
device: &Device,
queue: &Queue,
scene: &Scene,
surface: &SurfaceTexture,
params: &RenderParams
) -> Result<()>
pub fn render_to_surface( &mut self, device: &Device, queue: &Queue, scene: &Scene, surface: &SurfaceTexture, params: &RenderParams ) -> Result<()>
Renders a scene to the target surface.
This renders to an intermediate texture and then runs a render pass to blit to the specified surface texture.
The surface is assumed to be of the specified dimensions and have been configured with
the same format passed in the constructing RendererOptions
’ surface_format
.
Panics if surface_format
was None
sourcepub async fn render_to_texture_async(
&mut self,
device: &Device,
queue: &Queue,
scene: &Scene,
texture: &TextureView,
params: &RenderParams
) -> Result<Option<BumpAllocators>>
pub async fn render_to_texture_async( &mut self, device: &Device, queue: &Queue, scene: &Scene, texture: &TextureView, params: &RenderParams ) -> Result<Option<BumpAllocators>>
Renders a scene to the target texture.
The texture is assumed to be of the specified dimensions and have been created with
the wgpu::TextureFormat::Rgba8Unorm
format and the wgpu::TextureUsages::STORAGE_BINDING
flag set.
The return value is the value of the BumpAllocators
in this rendering, which is currently used
for debug output.
This return type is not stable, and will likely be changed when a more principled way to access relevant statistics is implemented