import { BufferDisplayMode, BuffersPayload, TexturePixelType } from "../debug-protocol.js"; import { BuffersSubscription } from "./SubscriberRegistry.js"; import { DataTexture, Texture } from "three"; import { WebGPURenderer } from "three/webgpu"; //#region src/debug/DebugTextureRegistry.d.ts /** Minimal shape used for GPU readback. Matches three's `RenderTarget`. */ interface ReadableRenderTarget { width: number; height: number; texture: Texture; } /** * Provider-side debug texture store. Hands off async readbacks to a * renderer-specific adapter at flush time; caches samples between * flushes so consumers always see the most recent successful read. */ declare class DebugTextureRegistry { private _entries; private _removed; /** Lazy GPU downsampler used by render-target readbacks with a cap. */ private _downsampler; /** * Register (or replace) a debug texture. * * For `DataTexture`, the CPU buffer is already on hand and readback * is free. For `RenderTarget` inputs, readback is async and fires on * each `drain()` call matching the filter. */ register(name: string, source: DataTexture | ReadableRenderTarget, pixelType: TexturePixelType, opts?: { label?: string; display?: BufferDisplayMode; }): void; touch(name: string): void; unregister(name: string): void; /** * Fill `out.entries` with a delta. `subscription`: * - Map entries name → { mode, thumbSize? } determines which entries * get pixels shipped. Names not in the map get metadata-only so the * consumer UI can still list/cycle available buffers. * - An empty map means every entry ships metadata-only. * * Readbacks are fired asynchronously; the first drain after a * filter change may ship metadata-only and then pick up the sample * on the next drain. This is fine — the consumer just re-renders * whatever it has. * * Returns `true` when the payload was written (the caller should * include `atlas:tick` in the data packet). */ drain(out: BuffersPayload, subscription: BuffersSubscription, _renderer: WebGPURenderer | undefined): boolean; /** * Kick readbacks for entries the subscription wants pixels for. * Called at end-of-frame when the render targets are fully rendered — * the GPU copy captures consistent content. No-op for entries that * already have a readback in flight. Entries not in the subscription * produce no GPU work at all. */ readbackAll(subscription: BuffersSubscription, renderer: WebGPURenderer): void; /** Force the next drain to re-emit everything. */ resetDelta(): void; dispose(): void; /** * Fire off a readback if none is pending. Data textures resolve * synchronously (cheap, no renderer needed); render targets need * the renderer for async read. */ private _readback; } //#endregion export { DebugTextureRegistry }; //# sourceMappingURL=DebugTextureRegistry.d.ts.map