Expand description
Shadow rendering: mask → 2-pass Gaussian blur → composite onto main target.
For each ShadowDesc:
- Clear ping texture to transparent.
- Render white rect mask of the (offset-shifted) rect into ping using the solid pipeline.
- Horizontal blur ping → pong.
- Vertical blur pong → ping.
- Composite ping (tinted by shadow colour) onto the main
target_viewusingLoadOp::Load(alpha blending — shadow renders under content because it is composited before the solid/gradient/textured passes).
When blur_radius <= 0.5 the blur passes are skipped and the white mask is
composited directly, yielding a crisp (hard-edge) shadow.
Ping-pong textures are allocated once per render_shadows call and shared
across all shadows in the draw list.
Structs§
- Shadow
Desc - A parsed, ready-to-render shadow.
- Shadow
GpuState - GPU device/queue state needed for shadow rendering.
- Shadow
Pipelines - The three GPU pipelines needed for shadow rendering.
- Shadow
Render Stats - Render pass and draw call counts accumulated across all shadow descriptions
submitted by a single
render_shadowscall.
Constants§
- MAX_
BLUR_ RADIUS - Maximum Gaussian blur radius in pixels. Clamped to bound the tap-loop
iteration count (
2 * MAX_BLUR_RADIUS + 1 = 129iterations worst-case).
Functions§
- collect_
shadows - Collect all
DrawCommand::BoxShadowentries fromlistintoShadowDescvalues, translating each rect by its offset. - render_
shadows - Render all
descsshadows, compositing each ontogpu.target_view.