| name | capability-propagation |
| description | When threading adapter capability flags from device creation through init-time constructors across crate boundaries, add a bool parameter to the constructor chain rather than trying to route through per-frame PassCtx — init-time allocations happen before per-frame dispatch and need the flag at construction time |
| source | auto-skill |
| extracted_at | 2026-06-15T03:49:26.570Z |
Capability flag propagation through init chain
When an adapter capability probed at device creation (e.g. compact format
support, f16 storage, ray queries) is needed during init-time resource
allocation (e.g. buffer stride selection), the flag must be threaded through
the constructor chain, not the per-frame PassCtx.
Why: Init-time constructors (StratumDispatch::new, CellCandidateBuffer::new)
run before any frame dispatch. The PassCtx is per-frame and populated with
cached capability flags from Renderer3d, but init code has no PassCtx.
How to thread:
- Store the flag on
Renderer3d (probed at device creation)
- Add a public accessor:
pub fn compact_storage_supported(&self) -> bool
- Pass it through the constructor:
StratumDispatch::new(..., compact_storage)
- Continue threading to leaf allocators:
CellCandidateBuffer::new(..., compact_storage)
Call site pattern (editor/lib.rs):
let dispatch = StratumDispatch::new(
renderer.device(),
renderer.queue(),
resolution,
provider,
stratum_quality,
renderer.compact_storage_supported(),
);
Constructor pattern:
pub fn new(
device: &wgpu::Device,
compact_storage: bool,
) -> Self { ... }
When the capability is always true on desktop but needs probing on mobile:
Use a runtime probe, not #[cfg] — Titan ships one binary across platforms
and the probe is cheap (one get_texture_format_features call at boot). On
desktop the probe always passes; on mobile it correctly detects older Mali/
Adreno GPUs that lack STORAGE_BINDING for compact formats.