Expand description
User-shader path for the warp pass.
Sibling of crate::CompPipeline’s user-shader path. When a preset
ships a warp_shader=… block, [onedrop-codegen::ShaderCompiler]
translates it through the same HLSL→WGSL chain the comp pass uses
and emits a complete WGSL module against the ShaderUniforms bind-
group layout. The default crate::WarpPipeline runs the engine’s
hand-written warp.wgsl with a minimal 3-binding layout; this
parallel pipeline runs the user’s translated module against the
full 25-binding layout the codegen wrapper assumes.
§Wiring
- Vertex format: same
WarpVertexthe default warp pipeline consumes (pos_clip: vec2<f32>+uv_warp: vec2<f32>), so the warp mesh vertex buffer is shared verbatim. - Binding 1 (
sampler_main_texture): the renderer bindsprev_texturehere.GetPixel(uv)in the user shader therefore samples the previous frame at the per-pixel warped UV — exactly the MD2 warp convention. - Bindings 3..5 (
sampler_blur1/2/3_texture): the warp pass runs before the blur pipeline, so this frame’s blurred copies don’t exist yet. We bind the previous frame’s blur pyramid (prev_blur1/2/3_textureincrate::ChainTextures), mirroring howprev_texturecarries the previous warp output. AuthoredGetBlur1(uv)calls inside a translated warp shader therefore sample a true Gaussian-blurred copy — one frame stale — instead of un-blurredprev_texture. - Bindings 6..10 (
sampler_noise_*_texture): real noise pack views fromcrate::GpuContext’sNoisePack— identical to what the comp pipeline sees. - Bindings 15..22 (
sampler_user_<n>_texture): per-preset disk-loaded user textures, threaded through from the sameTextureBindingPlanthe comp side uses. - Binding 23 (
sampler_prev_main_texture): aliased toprev_texture.
Structs§
- User
Warp Pipeline - Pipeline + bind group + uniforms buffer for the user-authored warp
fragment shader. Instantiated lazily by
crate::WarpPipeline’sset_user_shader_with_plan; lives alongside the default warp path and replaces it at draw time when present. - Warp
AuxViews - View pack for the user warp pass.
Functions§
- build_
warp_ 🔒pipeline_ from_ wgsl - Build the wgpu render pipeline. Vertex layout matches
WarpVertex(pos_clipat @location(0),uv_warpat @location(1)); fragment targetstarget_formatwithBlendState::REPLACE(the warp pass owns the entire render target). - create_
user_ 🔒warp_ bind_ group - Build the 25-entry bind group for the user warp pass.