Skip to main content

mln_webgpu/
custom_layer.rs

1// What a custom layer's host gets of a WebGPU frame. The pass and the
2// encoder are the frame's own wgpu objects, moved to the host for the call
3// and back after it.
4
5/// The frame's command encoder outside the map's render pass, for a custom
6/// layer's prerender. End each pass begun on `encoder` before the call
7/// returns, and leave the encoder in place.
8pub struct CustomLayerEncoder {
9    pub device: wgpu::Device,
10    pub queue: wgpu::Queue,
11    pub encoder: wgpu::CommandEncoder,
12}
13
14/// The map's render pass at a custom layer's place in the style.
15///
16/// Set your own pipeline, bind groups, buffers, viewport, scissor rectangle
17/// and stencil reference on `pass`: the map sets what its next draws need
18/// again. Leave `pass` in place.
19pub struct CustomLayerPass {
20    pub device: wgpu::Device,
21    pub queue: wgpu::Queue,
22    pub pass: wgpu::RenderPass<'static>,
23    pub color_format: wgpu::TextureFormat,
24    /// None when the pass has no depth-stencil attachment.
25    pub depth_stencil_format: Option<wgpu::TextureFormat>,
26    pub sample_count: u32,
27}