| name | self-not-passctx-for-dispatch-resources |
| description | When a resource (pool, pipeline, buffer) is already accessible via self in a StratumRenderHook dispatch method, do not route it through PassCtx — that would require adding a crate dependency from titan-rendering-3d to titan-stratum-lighting, breaking the trait-bridge decoupling |
| source | auto-skill |
| extracted_at | 2026-06-15T21:07:04.805Z |
Use self, not PassCtx, for dispatch-accessible resources
When a StratumRenderHook dispatch method (record_stratum_vsm_*) needs access
to a resource owned by the concrete hook struct (e.g., VsmPagePool,
VsmMark, VsmAllocate), use self.field directly. Do NOT attempt to route
it through PassCtx.
Why: titan-rendering-3d does not depend on titan-stratum-lighting.
They are decoupled via the StratumRenderHook trait bridge. Adding a
VsmPagePool reference to PassCtx would require importing
titan_stratum_lighting::vsm::VsmPagePool in titan-rendering-3d, creating
a circular or reverse dependency that breaks the locked architecture.
The existing architecture is intentional — "Pay-for-what-you-use" decoupling
documented at stratum_hook.rs:2-6.
How to apply: The dispatch methods (record_stratum_vsm_mark, etc.)
already take &mut self, giving them direct access to self.vsm_page_pool,
self.vsm_mark, self.vsm_allocate, self.vsm_rasterize, and any other
fields on the concrete StratumDispatch struct. Use self.field.as_ref()
instead of ctx.field.
Correct pattern:
fn record_stratum_vsm_mark(&mut self, ctx: PassCtx<'_>) {
let Some(mark) = self.vsm_mark.as_ref() else { return; };
let Some(pool) = self.vsm_page_pool.as_ref() else { return; };
}
Wrong pattern (would fail to compile):
fn record_stratum_vsm_mark(&mut self, ctx: PassCtx<'_>) {
let Some(pool) = ctx.vsm_page_pool else { return; };
}
Env-var guards (debug-dumps) also live in the hook methods: The
vsm::vsm_disabled() function lives in titan-stratum-lighting. The
TITAN_VSM_DISABLE=1 guard belongs at the top of each dispatch method in
render_hook.rs, not in the dispatch-arm match in titan-rendering-3d/src/lib.rs.
This follows the same decoupling principle.