Expand description
Comp pass GPU pipeline.
Reads render_texture (warp output) and writes a display-ready frame to
final_texture. Filters here are display-only; they must not feed back
into the next frame’s warp. See shaders/comp.wgsl for the geometry/UV
conventions.
§Uniform layout
The bind group binds the standard ShaderUniforms layout (defined
in onedrop-codegen::prelude) at @group(0) @binding(0). This is the
same layout user comp shaders translated from MD2 HLSL expect, so a
future shader-swap path (sprint B2 follow-up) only needs to recreate
the render pipeline — bind group layout and buffer remain valid.
Structs§
- Comp
AuxViews - Texture views the comp pass binds beyond the main warp output and blur pyramid. Bundled into a struct so the pipeline constructor + the resize rebind path don’t take a 10-argument list.
- Comp
Pipeline - Owned
Comp 🔒AuxViews CompAuxViewswith owned (cloned) views —wgpu::TextureViewis a refcounted handle so cloning is cheap. Used insideCompPipelineto remember the latest aux bindings across user-shader swaps.
Constants§
- PREV_
MAIN_ BINDING - WGSL binding index for the previous-frame display texture used by the
echo effect. Sits immediately after the user-texture slots (binding 22
is the last user texture, 23 is
prev_main).
Functions§
- build_
pipeline_ 🔒from_ wgsl - Build a comp-pass
RenderPipelinefrom a fully-formed WGSL source string. - build_
user_ 🔒shader_ bind_ group_ layout - Build one of the four MD2 sampler variants used by
sampler_{fw,fc,pw,pc}. MD2 encodes the choice into the sampler name:f/p= filter mode (filtered=linear vs point=nearest),w/c= address mode (wrap vs clamp-to-edge). Real preset authoring intent is matched per call site (sampler_pw_main= high-frequency point sample wrapped to texture boundary;sampler_fc_main= smooth bilinear sample clamped at edges). Build the bind-group layout user-translated shaders bind against. - make_
fallback_ 🔒user_ texture_ view - 1×1 opaque white texture for unfilled user-texture slots. Returns just
the view — the underlying texture is created on the spot and kept alive
by the view’s refcounted handle. Sampling it produces
vec4(1, 1, 1, 1)so anytex2D(sampler_user_N_texture, uv) * Xdegrades toX. - make_
md2_ 🔒sampler