pub struct CustomShapeRenderer {
fill_pipelines: [RenderPipeline; 2],
outline_pipelines: [RenderPipeline; 2],
bind_group: BindGroup,
bgl: BindGroupLayout,
instance_buffer: Buffer,
uniform_buffer: Buffer,
sampler: Sampler,
instance_count: u32,
batches: Vec<CustomShapeBatch>,
}Expand description
GPU pass. Owns the per-frame instance storage buffer + the four pipelines (fill × alpha/additive, outline × alpha/additive). The fragment shader picks textured vs. solid via a per-instance flag bit, so we don’t need a separate textured pipeline.
Fields§
§fill_pipelines: [RenderPipeline; 2]§outline_pipelines: [RenderPipeline; 2]§bind_group: BindGroup§bgl: BindGroupLayout§instance_buffer: Buffer§uniform_buffer: Buffer§sampler: Sampler§instance_count: u32§batches: Vec<CustomShapeBatch>Implementations§
Source§impl CustomShapeRenderer
impl CustomShapeRenderer
pub fn new( device: &Device, format: TextureFormat, prev_texture_view: &TextureView, ) -> Self
Sourcepub fn rebind_prev_texture(
&mut self,
device: &Device,
prev_texture_view: &TextureView,
)
pub fn rebind_prev_texture( &mut self, device: &Device, prev_texture_view: &TextureView, )
Re-bind prev_texture_view after a resize / texture realloc. The
instance + uniform buffers persist, only the texture view
changes.
Sourcepub fn update(
&mut self,
queue: &Queue,
instances: &[CustomShapeInstance],
batches: &[CustomShapeBatch],
aspect: f32,
)
pub fn update( &mut self, queue: &Queue, instances: &[CustomShapeInstance], batches: &[CustomShapeBatch], aspect: f32, )
Replace the per-frame instance stream + batch list. Aspect ratio goes into the uniform buffer so the shader can correct the X radius without each instance carrying a copy.
Sourcepub fn render(&self, encoder: &mut CommandEncoder, view: &TextureView)
pub fn render(&self, encoder: &mut CommandEncoder, view: &TextureView)
Issue fill + (optional) outline draw calls for each batch. Loads existing contents (no clear); meant to overlay on the warp + wave output.
pub fn instance_count(&self) -> u32
pub fn batch_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for CustomShapeRenderer
impl !RefUnwindSafe for CustomShapeRenderer
impl Send for CustomShapeRenderer
impl Sync for CustomShapeRenderer
impl Unpin for CustomShapeRenderer
impl !UnwindSafe for CustomShapeRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more