Skip to main content

Module targets

Module targets 

Source
Expand description

The per-renderer pool the engine draws its off-screen intermediates from.

A layer, a filter input, a scratch copy — every target that is not the frame’s own surface is a short-lived texture that a later pass in the same frame samples and nothing outlives the frame. Allocating one per frame is the cost frust_gpu::TexturePool exists to remove, so the engine holds one pool per renderer (one per surface, since a renderer is per surface) and takes its intermediates from there.

Two engine-level decisions sit on top of the substrate pool.

  • A ceiling of MAX_INTERMEDIATE_DIMENSION. The adapter’s own max_texture_dimension_2d can be far larger than anything worth allocating as a transient: a single 16384-square Rgba8Unorm intermediate is a gigabyte. max_texture_size therefore takes the smaller of the adapter’s ceiling and 8192, which is the largest intermediate the engine will ask a driver for.
  • An over-ceiling request is a value, not an error. A layer larger than that ceiling is answered with IntermediateTexture::TooLarge carrying the extent that was refused, so a caller sees exactly what it asked for and skips the layer rather than taking a device error mid-frame. A caller that instead splits the layer into bands never reaches this arm: every band is sized inside the same ceiling, and all of a layer’s bands share one extent, so a banded layer draws one texture out of this pool and reuses it band after band.

Like the substrate pool this type is generic over the texture and view types, so its keying, reuse and aging are exercised against a counting fake with no GPU in the loop. The engine always uses the default IntermediateTargets<wgpu::Texture, wgpu::TextureView>.

§The one off-screen target this module does not hand out

atlas_layer_config describes a pass whose colour attachment is one layer of the glyph/image atlas array — a target crate::gpu::atlas owns outright and deliberately keeps out of the pool (its module doc gives the reason: residency across frames is the atlas’s whole purpose). The allocation therefore belongs there; the viewport decision belongs here, beside IntermediateTargets::descriptor, because it is the same decision this module already makes for every other target that is not the frame’s own surface — what extent the vertex stage maps its NDC against, and which resource-texture widths the fragment stage reconstructs by shift.

§The filter pass’s two extras

A filter round renders between two pooled pages this module hands out, and needs two things beyond them: the filter-data texture holding the frame’s parameter blocks (filter_data_texture_descriptor, sized by filter_data_texture_height) and the bilinear filter_sampler its kernels read the source page through — the engine’s first and only sampler. Both are described here, beside the pages they are used with; crate::renderer::FilterResources owns the live resources.

Structs§

IntermediateTargets
The engine’s pool of off-screen intermediates, with its own frame clock.

Enums§

IntermediateTexture
The result of asking for an intermediate: a pooled texture, or the extent that was refused.

Constants§

FILTER_DATA_TEXTURE_WIDTH
Texels per row of the filter-data texture.
INTERMEDIATE_USAGE
The usage every intermediate is created with: drawn into by a strip pass, then sampled by the pass that composites it.
MAX_INTERMEDIATE_DIMENSION
The largest intermediate the engine allocates on any adapter, whatever its own max_texture_dimension_2d reports.
RESIZE_KEEP_ALIVE_FRAMES
How many of the most recent frames’ parked entries a surface resize keeps (see IntermediateTargets::drop_parked).

Functions§

atlas_layer_config
The viewport uniform a strip pass whose colour attachment is one atlas array layer draws with.
atlas_page_fits
Whether an atlas page of page texels can be a render attachment on caps’ adapter.
filter_data_texture_descriptor
The filter-data texture’s descriptor at height rows.
filter_data_texture_height
The filter-data texture height that holds blocks parameter blocks, or None for a block count past MAX_INTERMEDIATE_DIMENSION rows.
filter_sampler
The engine’s one sampler, which the blur kernels read their source page through.
max_texture_size
The largest intermediate extent the engine will request on caps’ adapter.