WarpPipeline

Struct WarpPipeline 

Source
pub struct WarpPipeline {
    pipeline: RenderPipeline,
    bind_group_layout: BindGroupLayout,
    bind_group: BindGroup,
    sampler: Sampler,
    uniforms_buffer: Buffer,
    vertex_buffer: Buffer,
    index_buffer: Buffer,
    index_count: u32,
    vertex_count: u32,
    user_pipeline: Option<UserWarpPipeline>,
    target_format: TextureFormat,
}

Fields§

§pipeline: RenderPipeline§bind_group_layout: BindGroupLayout§bind_group: BindGroup§sampler: Sampler§uniforms_buffer: Buffer§vertex_buffer: Buffer§index_buffer: Buffer§index_count: u32§vertex_count: u32§user_pipeline: Option<UserWarpPipeline>

Active when a preset’s translated warp shader compiled successfully. The default pipeline above stays built so failed compiles fall back transparently. See UserWarpPipeline.

§target_format: TextureFormat

Target format remembered so the user pipeline can be rebuilt after a preset swap without re-asking the caller.

Implementations§

Source§

impl WarpPipeline

Source

pub fn new( device: &Device, target_format: TextureFormat, prev_texture_view: &TextureView, mesh: &WarpMesh, ) -> Result<Self>

Source

pub fn set_user_shader_with_plan( &mut self, device: &Device, queue: &Queue, wrapped_wgsl: &str, prev_view: &TextureView, aux: &WarpAuxViews<'_>, user_views: [Option<TextureView>; 8], ) -> Result<()>

Swap in a user-translated warp fragment shader. Mirrors [CompPipeline::set_user_shader_with_plan]: the WGSL must have already been validated by onedrop_codegen::ShaderCompiler, the renderer threads prev_view + aux (noise textures, etc.) + a per-preset user_views array of disk-loaded textures.

On success the warp pass uses the user pipeline; on failure the default mesh-warp pipeline keeps running.

Source

pub fn reset_to_default(&mut self)

Drop the user warp shader and route the pass back through the engine’s default warp.wgsl. Idempotent.

Source

pub fn has_user_shader(&self) -> bool

true when the user pipeline is currently driving the warp pass.

Source

pub fn update_user_uniforms(&self, queue: &Queue, uniforms: &ShaderUniforms)

Upload ShaderUniforms to the user pipeline’s uniform buffer. Caller passes the same ShaderUniforms the comp pass receives — q-channels, time, audio levels, roam vectors, etc.

Source

pub fn rebind_user_textures( &mut self, device: &Device, prev_view: &TextureView, aux: &WarpAuxViews<'_>, )

Rebind the user pipeline’s texture views after a resize. No-op when no user shader is active. The renderer threads the new prev_view + refreshed aux (blur/noise views may have been recreated by [ChainTextures] on resize).

Source

fn create_bind_group( device: &Device, layout: &BindGroupLayout, uniforms_buffer: &Buffer, prev_texture_view: &TextureView, sampler: &Sampler, ) -> BindGroup

Source

pub fn rebind_prev_texture( &mut self, device: &Device, prev_texture_view: &TextureView, )

Re-create the bind group after the prev texture view is invalidated (e.g., on resize).

Source

pub fn update_uniforms( &self, queue: &Queue, decay: f32, aspect: f32, flags: u32, )

Source

pub fn rebuild_mesh(&mut self, device: &Device, mesh: &WarpMesh)

Reallocate the vertex + index buffers for a different-sized mesh. Used by MilkRenderer::set_mesh_size when the user picks a new mesh quality at runtime. The bind group is unaffected because it references the prev-texture view, not the vertex buffer.

Source

pub fn update_vertices(&self, queue: &Queue, vertices: &[WarpVertex])

Upload new per-vertex warped UVs.

vertices.len() must equal the original mesh vertex count.

Source

pub fn render(&self, encoder: &mut CommandEncoder, output_view: &TextureView)

Issue draw commands. Caller owns the encoder.

When the user warp pipeline is active (set_user_shader_with_plan has succeeded), delegate to it; the vertex/index buffers are shared so the per-frame mesh upload still applies. Otherwise the engine’s hand-written warp.wgsl runs as before.

Source

pub fn vertex_count(&self) -> u32

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,