/** * @file shared.ts * @brief Shared GPU resources, program linking and resource creation errors. */ /** @brief Info log of the last program that failed to link. */ export declare const LAST_ERROR: string[]; /** * @brief Pass programs, their uniform locations and the buffers, vertex arrays and textures shared * by all shapes. */ export interface Shared { readonly vao: WebGLVertexArrayObject; readonly buildVao: WebGLVertexArrayObject; readonly lumaVao: WebGLVertexArrayObject; readonly ubo: WebGLBuffer; readonly frameUbo: WebGLBuffer; readonly unionUbo: WebGLBuffer; readonly instBuf: WebGLBuffer; readonly lumaBuf: WebGLBuffer; readonly pbo: WebGLBuffer; readonly backdrop: WebGLTexture; readonly present: WebGLProgram; readonly split: WebGLProgram; readonly splitT: WebGLUniformLocation; readonly capture: WebGLProgram; readonly captureS: WebGLUniformLocation; readonly first: WebGLProgram; readonly firstS: WebGLUniformLocation; readonly first8: WebGLProgram; readonly first8S: WebGLUniformLocation; readonly down8: WebGLProgram; readonly down8S: WebGLUniformLocation; readonly down: WebGLProgram; readonly downS: WebGLUniformLocation; readonly luma: WebGLProgram; readonly lumaW: WebGLUniformLocation; readonly lumaTex: WebGLTexture; readonly lumaFbo: WebGLFramebuffer; /** * @brief Float render targets can be used (blur pyramids in half floats, mask fields, * extended-range output). */ readonly halfFloat: boolean; /** @brief Programs link in the background and report when they are done (no wait to start one). */ readonly parallel: boolean; } /** * @brief Compile the pass programs and create the shared objects of a context. * @param lumaCap Width of the luminance reading target in pixels. * @returns The objects, or why they cannot be made. */ export declare function openShared(gl: WebGL2RenderingContext, lumaCap: number): Shared | string; /** @brief Compile and link a program, waiting for the result. */ export declare function link(gl: WebGL2RenderingContext, vs: string, fs: string): WebGLProgram | null; /** * @brief Compile and link a program without asking for the result, so nothing waits for the * driver yet. */ export declare function startLink(gl: WebGL2RenderingContext, vs: string, fs: string): LinkJob | null; /** @brief Whether a started link is done (always true without background linking). */ export declare function linkDone(gl: WebGL2RenderingContext, job: LinkJob, parallel: boolean): boolean; /** * @brief The program of a started link once it is done (waiting for it if needed), or null with the * log in `LAST_ERROR` when it failed. */ export declare function finishLink(gl: WebGL2RenderingContext, job: LinkJob | null): WebGLProgram | null; /** @brief Drop a started link without waiting for it. */ export declare function dropLink(gl: WebGL2RenderingContext, job: LinkJob): void;