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 ownmax_texture_dimension_2dcan be far larger than anything worth allocating as a transient: a single 16384-squareRgba8Unormintermediate is a gigabyte.max_texture_sizetherefore 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::TooLargecarrying 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§
- Intermediate
Targets - The engine’s pool of off-screen intermediates, with its own frame clock.
Enums§
- Intermediate
Texture - 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_2dreports. - 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
pagetexels can be a render attachment oncaps’ adapter. - filter_
data_ texture_ descriptor - The filter-data texture’s descriptor at
heightrows. - filter_
data_ texture_ height - The filter-data texture height that holds
blocksparameter blocks, orNonefor a block count pastMAX_INTERMEDIATE_DIMENSIONrows. - 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.