@luma.gl/core
Version:
The luma.gl core Device API
54 lines • 2.83 kB
TypeScript
import { Device } from "../adapter/device.js";
import { ComputePipeline, type ComputePipelineProps } from "../adapter/resources/compute-pipeline.js";
import { RenderPipeline, type RenderPipelineProps } from "../adapter/resources/render-pipeline.js";
import type { SharedRenderPipeline } from "../adapter/resources/shared-render-pipeline.js";
export type PipelineFactoryProps = RenderPipelineProps;
/**
* Efficiently creates / caches pipelines
*/
export declare class PipelineFactory {
static defaultProps: Required<PipelineFactoryProps>;
/** Get the singleton default pipeline factory for the specified device */
static getDefaultPipelineFactory(device: Device): PipelineFactory;
readonly device: Device;
private _hashCounter;
private readonly _hashes;
private readonly _renderPipelineCache;
private readonly _computePipelineCache;
private readonly _sharedRenderPipelineCache;
get [Symbol.toStringTag](): string;
toString(): string;
constructor(device: Device);
/**
* WebGL has two cache layers with different priorities:
* - `_sharedRenderPipelineCache` owns `WEBGLSharedRenderPipeline` / `WebGLProgram` reuse.
* - `_renderPipelineCache` owns `RenderPipeline` wrapper reuse.
*
* Shared WebGL program reuse is the hard requirement. Wrapper reuse is beneficial,
* but wrapper cache misses are acceptable if that keeps the cache logic simple and
* prevents incorrect cache hits.
*
* In particular, wrapper hash logic must never force program creation or linked-program
* introspection just to decide whether a shared WebGL program can be reused.
*/
/** Return a RenderPipeline matching supplied props. Reuses an equivalent pipeline if already created. */
createRenderPipeline(props: RenderPipelineProps): RenderPipeline;
/** Return a ComputePipeline matching supplied props. Reuses an equivalent pipeline if already created. */
createComputePipeline(props: ComputePipelineProps): ComputePipeline;
release(pipeline: RenderPipeline | ComputePipeline): void;
createSharedRenderPipeline(props: RenderPipelineProps): SharedRenderPipeline;
releaseSharedRenderPipeline(pipeline: RenderPipeline): void;
/** Destroy a cached pipeline, removing it from the cache if configured to do so. */
private _destroyPipeline;
/** Get the appropriate cache for the type of pipeline */
private _getCache;
/** Calculate a hash based on all the inputs for a compute pipeline */
private _hashComputePipeline;
/** Calculate a hash based on all the inputs for a render pipeline */
private _hashRenderPipeline;
private _hashSharedRenderPipeline;
private _getHash;
private _getWebGLVaryingHash;
private _getWebGPUAttachmentHash;
}
//# sourceMappingURL=pipeline-factory.d.ts.map