import { GpuFragmentParams, KitTexture } from '../contract'; /** The resolver the pass manager passes to `bindInputs`: texture key → bound texture. */ type InputResolver = (key: string) => { texture: unknown; } | undefined; export interface LateBoundChildInput { /** * The child's RTT handle. Put it in the compute node's `outputs` so the fragment can sample * the same texture (`computeOutputs.childTexture`) instead of RTT-ing the child twice. */ readonly childTexture: KitTexture; /** Hand straight to the compute node's `bindInputs`. */ bindInputs: (resolve: InputResolver) => void; /** * The bind groups built by `buildGroups`, or `null` while the child RTT is still unallocated. * The canonical first line of `getComputeNodes` is `const g = child.bound(); if (!g) return null`. */ bound(): TGroups | null; /** Boolean form of {@link bound}, for readability in tests and guards. */ ready(): boolean; } /** * Name a compute hook's child input and defer its bind-group construction to `bindInputs`. * * `buildGroups` receives the resolved child texture — already cast to the type * `root.createBindGroup` accepts — and returns whatever collection of bind groups the shader * needs (a single group, a `{a, b}` orientation pair, an object of several). It re-runs on every * recompose, so anything it allocates must be safe to rebuild. * * Returns `null` when the node has no child at all, so a child-REQUIRED shader can write * `if (!child) return null` and inherit the "no child → no compute" branch. * * @example * const child = createLateBoundChildInput(params, (src) => ({ * bg: root.createBindGroup(layout, {src, prev: stateA, next: stateB, params: buf.buffer}), * })) * if (!child) return null * return { * outputs: {childTexture: child.childTexture, display}, * bindInputs: child.bindInputs, * getComputeNodes: () => { * const g = child.bound() * if (!g) return null * return [pipeline.with(g.bg)] * }, * } */ export declare function createLateBoundChildInput(params: GpuFragmentParams, buildGroups: (childTexture: never) => TGroups): LateBoundChildInput | null; export {}; //# sourceMappingURL=lateBoundChild.d.ts.map