UserWarpPipeline

Struct UserWarpPipeline 

Source
pub struct UserWarpPipeline {
    pipeline: RenderPipeline,
    bind_group: BindGroup,
    bind_group_layout: BindGroupLayout,
    pipeline_layout: PipelineLayout,
    uniforms_buffer: Buffer,
    sampler: Sampler,
    sampler_fw: Sampler,
    sampler_fc: Sampler,
    sampler_pw: Sampler,
    sampler_pc: Sampler,
    fallback_user_view: TextureView,
    user_texture_views: [TextureView; 8],
}
Expand description

Pipeline + bind group + uniforms buffer for the user-authored warp fragment shader. Instantiated lazily by crate::WarpPipeline’s set_user_shader_with_plan; lives alongside the default warp path and replaces it at draw time when present.

Fields§

§pipeline: RenderPipeline§bind_group: BindGroup§bind_group_layout: BindGroupLayout§pipeline_layout: PipelineLayout

Kept alive only so the pipeline’s bind-group layout reference stays valid for the lifetime of pipeline; wgpu owns the underlying handle indirectly.

§uniforms_buffer: Buffer§sampler: Sampler

sampler_main — linear / clamp-to-edge sampler bound at @binding(2).

§sampler_fw: Sampler

The four MD2 sampler variants the codegen wrapper expects at @bindings 11..14. Created fresh here rather than borrowed from the comp pipeline so the warp pass is self-contained.

§sampler_fc: Sampler§sampler_pw: Sampler§sampler_pc: Sampler§fallback_user_view: TextureView

1×1 white texture for unfilled user-texture slots. Sampled *X degrades to X, matching the comp pipeline’s fallback policy. Holds the texture alive (user_texture_views clones reference it for unfilled slots).

§user_texture_views: [TextureView; 8]

One view per user-texture slot. Updated by install_user_textures on every shader swap.

Implementations§

Source§

impl UserWarpPipeline

Source

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

Compile + wrap is the caller’s responsibility. wrapped_wgsl must be the fully-formed module produced by onedrop-codegen::wrap_user_warp_shader_with_plan.

prev_view is bound everywhere the wrapper expects a “current frame” texture (binding 1, 3, 4, 5, 23). Real noise_* views from the GPU context’s crate::noise::NoisePack are bound at 6..10. The user_views array supplies any preset-loaded disk textures (slots set to None get the 1×1 white fallback).

Source

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

Upload a fully-populated ShaderUniforms for this frame.

Source

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

Rebuild the bind group with fresh texture views (resize, prev texture invalidation, etc.). aux follows the same convention as the comp pipeline’s rebind_input_texture path.

Source

pub fn render( &self, encoder: &mut CommandEncoder, output_view: &TextureView, vertex_buffer: &Buffer, index_buffer: &Buffer, index_count: u32, )

Issue the warp pass with the user shader. Caller owns the encoder and the vertex/index buffers (shared with the default warp pipeline so the per-frame mesh upload is amortised).

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,