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: PipelineLayoutKept 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: Samplersampler_main — linear / clamp-to-edge sampler bound at @binding(2).
sampler_fw: SamplerThe 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: TextureView1×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
impl UserWarpPipeline
Sourcepub fn new(
device: &Device,
queue: &Queue,
target_format: TextureFormat,
wrapped_wgsl: &str,
prev_view: &TextureView,
aux: &WarpAuxViews<'_>,
user_views: [Option<TextureView>; 8],
) -> Result<Self>
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).
Sourcepub fn update_uniforms(&self, queue: &Queue, uniforms: &ShaderUniforms)
pub fn update_uniforms(&self, queue: &Queue, uniforms: &ShaderUniforms)
Upload a fully-populated ShaderUniforms for this frame.
Sourcepub fn rebind_textures(
&mut self,
device: &Device,
prev_view: &TextureView,
aux: &WarpAuxViews<'_>,
)
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.
Sourcepub fn render(
&self,
encoder: &mut CommandEncoder,
output_view: &TextureView,
vertex_buffer: &Buffer,
index_buffer: &Buffer,
index_count: u32,
)
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§
impl Freeze for UserWarpPipeline
impl !RefUnwindSafe for UserWarpPipeline
impl Send for UserWarpPipeline
impl Sync for UserWarpPipeline
impl Unpin for UserWarpPipeline
impl !UnwindSafe for UserWarpPipeline
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
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>
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>
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