Expand description
GPU-side data layouts the strip shaders read.
Every type in this module is byte-compatible with the sparse-strip reference renderer’s own layouts, so the ported WGSL reads them unchanged. Layout drift is a silent mis-render rather than a compile error, so each struct carries a compile-time size assertion beside it and the integration tests pin the exact bytes.
Nothing here touches a wgpu::Device: sizing, addressing and packing are
pure functions over plain values, host-testable with no GPU in the loop —
the same pure-decision split frust-gpu follows. The one live-GPU input
these functions need is frust_gpu::TierCaps::resource_texture_dim, which
the caller passes in as a plain u32.
Two resource textures are described here, both Rgba32Uint:
- the alpha texture, holding the strip renderer’s 1-byte coverage values 16 to a texel (4 per channel), and
- the encoded-paint texture (
paint_texture), holding 16-byte-aligned paint records back to back.
Both are sized resource_texture_dim texels wide so the shader can turn a
flat index into a texel coordinate with a shift, and both grow in height
only — never shrink — up to the same dimension, past which the frame path
returns an error instead of asserting.
Re-exports§
pub use atlas::ATLAS_FORMAT;pub use atlas::ATLAS_USAGES;pub use atlas::AtlasArray;pub use atlas::lower_encoded_image;pub use bindings::ExternalRuns;pub use bindings::ExternalTextures;pub use bindings::lower_encoded_external;pub use config::GpuConfig;pub use config::tex_width_bits;pub use depth::DepthAttachment;pub use depth::DepthTexture;pub use paint_texture::GpuBlurredRoundedRect;pub use paint_texture::GpuEncodedImage;pub use paint_texture::GpuEncodedPaint;pub use paint_texture::GpuLinearGradient;pub use paint_texture::GpuRadialGradient;pub use paint_texture::GpuSweepGradient;pub use pipelines::EnginePipeline;pub use pipelines::EngineShaderModule;pub use pipelines::EngineShaders;pub use strips::GpuStrip;pub use strips::StripDraw;pub use targets::IntermediateTargets;pub use targets::IntermediateTexture;
Modules§
- atlas
- The image atlas array, and the encoded-image record the strip shader reads it through.
- bindings
- The registry of caller-owned textures a frame’s strip passes sample, and the per-frame batching that binds each of them in turn.
- config
- The
Configuniform every strip shader binds. - depth
- The depth attachment the opaque strip pass establishes and the alpha pass tests against.
- paint_
texture - The encoded-paint records the fragment shader samples, and the
Rgba32Uinttexture they are serialized into. - pipelines
- The nine render pipelines the engine draws with, as plain values.
- present
- The present pass: the engine’s premultiplied frame, converted for a swapchain that stores STRAIGHT alpha.
- shader_
src - The engine’s WGSL sources, assembled at compile time.
- strips
- The strip instance the vertex shader steps over, and the conversion into
it from a rasterized
Strip. - targets
- The per-renderer pool the engine draws its off-screen intermediates from.
Structs§
- Alpha
Address - Where one alpha value lives in an alpha texture: its texel, the channel within that texel, and the byte within that channel.
Constants§
- ALPHAS_
PER_ CHANNEL - 1-byte alpha values packed into one texel channel.
- ALPHAS_
PER_ TEXEL - 1-byte alpha values packed into one texel.
- MIN_
RESOURCE_ TEXTURE_ HEIGHT - The height a resource texture starts at, before any content forces it to grow.
- RESOURCE_
TEXTURE_ FORMAT - The texture format both resource textures (alphas, encoded paints) use.
- RESOURCE_
TEXTURE_ USAGES - The usages both resource textures are created with: sampled by the strip shaders, written by a queue upload, never a render attachment.
- TEXEL_
BYTES - Bytes in one
Rgba32Uinttexel: four channels of four bytes. - TEXEL_
BYTES_ SHIFT log2ofTEXEL_BYTES, so a byte count is a shift away from a texel count (the shader does the same, since a downlevel target has nofirstTrailingBit).
Functions§
- alpha_
address - The address of alpha value
alpha_idxin an alpha texturewidthtexels wide. - alpha_
texture_ descriptor - The descriptor for an alpha texture of
widthxheighttexels. - alpha_
texture_ height - The alpha-texture height needed to hold
alphas_lencoverage bytes in a textureresource_texture_dimtexels wide. - grow_
alpha_ texture_ height - The height an alpha texture currently
current_heighttall must be recreated at to holdalphas_lencoverage bytes, orNonewhen the existing texture already fits. - resource_
bytes_ per_ row - The
bytes_per_rowof a resource texturewidthtexels wide. - resource_
texture_ bytes - The total byte footprint of a resource texture of
widthxheighttexels — the size an upload buffer is padded to. - resource_
texture_ descriptor - A resource-texture descriptor:
Rgba32Uint, single mip, single sample, sampled-and-uploadable. - with_
padded_ alphas - Runs
uploadoveralphaspadded with zeroes to the full byte footprint of awidthxheightalpha texture, then truncates it back to its original length.