import { type BufferUsage, type DrawCommand, type LdrPostprocessPresentationOptions, type RenderBuffer, type RenderDevice, type RenderDeviceDiagnostics, type RenderDeviceInfo, type RenderShaderProgram, type RenderTarget, type RenderTargetDescriptor, type ShaderSources } from "./RenderDevice";
export interface WebGL2DeviceOptions {
    readonly canvas: HTMLCanvasElement | OffscreenCanvas;
    readonly antialias?: boolean;
    readonly alpha?: boolean;
    readonly preserveDrawingBuffer?: boolean;
    readonly errorCheckMode?: WebGL2ErrorCheckMode;
}
export type WebGL2ErrorCheckMode = "strict" | "frame";
export declare class WebGL2Device implements RenderDevice {
    private readonly errorCheckMode;
    readonly kind = "webgl2";
    readonly info: RenderDeviceInfo;
    disposed: boolean;
    contextLost: boolean;
    private readonly gl;
    private nextId;
    private drawCalls;
    private buffers;
    private shaders;
    private renderTargets;
    private activeRenderTarget;
    private textures;
    private textureUploadModes;
    private fallbackTexture;
    private fallbackCubeTexture;
    private readonly samplerObjectCache;
    private presentationProgram;
    private ldrPostprocessProgram;
    private depthReadbackProgram;
    private readonly uniformLocationCache;
    private readonly textureSamplerParameterCache;
    private readonly stateCache;
    private readonly textureUnitBindings;
    private readonly vertexArrayCache;
    private readonly vertexFormatIds;
    private presentationVertexArray;
    private activeTextureUnitIndex;
    private shaderProgramCreateCount;
    private uniformLocationLookupCount;
    private bufferUpdateCount;
    private textureBindCount;
    private samplerParameterUploadCount;
    private samplerAnisotropyUploadCount;
    private vertexArrayCreateCount;
    private nativeInstancedSubmissions;
    private nextVertexFormatId;
    private releasedTextureHandles;
    private nativeEnvironmentBindings;
    private nativeShadowMapBindings;
    private lastError;
    private frameActive;
    private viewportWidth;
    private viewportHeight;
    private readonly maxVertexAttributes;
    private readonly anisotropicFilteringExtension;
    private readonly maxTextureAnisotropy;
    private readonly contextLostListener?;
    private readonly contextRestoredListener?;
    private readonly canvas?;
    static create(options: WebGL2DeviceOptions): WebGL2Device;
    private constructor();
    createBuffer(usage: BufferUsage, byteLength: number, initialData?: ArrayBufferView): RenderBuffer;
    updateBuffer(buffer: RenderBuffer, byteOffset: number, data: ArrayBufferView): void;
    readBuffer(buffer: RenderBuffer, byteOffset?: number, byteLength?: number): Uint8Array;
    createShaderProgram(sources: ShaderSources): RenderShaderProgram;
    createRenderTarget(descriptor: RenderTargetDescriptor): RenderTarget;
    setRenderTarget(target: RenderTarget | null): void;
    writeRenderTargetPixels(target: RenderTarget, pixels: Uint8Array): void;
    presentRenderTarget(source: RenderTarget): void;
    presentLdrPostprocess(source: RenderTarget, options: LdrPostprocessPresentationOptions): void;
    readPixels(x: number, y: number, width: number, height: number): Uint8Array;
    readFloatPixels(x: number, y: number, width: number, height: number): Float32Array;
    readDepthPixels(x: number, y: number, width: number, height: number): Float32Array;
    beginFrame(width: number, height: number): void;
    clear(color: readonly [number, number, number, number]): void;
    clearRenderTarget(color: readonly [number, number, number, number]): void;
    draw(command: DrawCommand): void;
    endFrame(): void;
    captureState(): ReadonlyMap<string, string | number | boolean | null>;
    getDiagnostics(): RenderDeviceDiagnostics;
    dispose(): void;
    private copyDepthTextureToBytes;
    private drawRenderTargetToBackbuffer;
    private captureTextureUnit0;
    private restoreTextureUnit0;
    private prepareFullscreenPresentation;
    private restoreFullscreenPresentationState;
    private ensurePresentationVertexArray;
    private ensureDepthReadbackProgram;
    private ensurePresentationProgram;
    private ensureLdrPostprocessProgram;
    private compileShader;
    private reflectProgram;
    private uploadUniforms;
    private getUniformLocation;
    private uploadTextureUniform;
    private activateTextureUnit;
    private bindTextureForUnit;
    private setTextureParameterIfNeeded;
    private applySamplerAnisotropy;
    private getSamplerHandle;
    private samplerKey;
    private getFallbackTextureHandle;
    private getFallbackCubeTextureHandle;
    private getTextureHandle;
    private uploadCubeTexture;
    private uploadRgba8FallbackTexture;
    private cubeFaceTarget;
    private rgba8TextureInternalFormat;
    private textureUploadFormat;
    private resolveRenderTargetFormat;
    private releaseDisposedTextureHandles;
    private resolveCompressedTextureFormat;
    private magFilter;
    private minFilter;
    private addressMode;
    private bindVertexFormat;
    private bindVertexArrayForCommand;
    private bindNoVertexArray;
    private vertexArrayCacheKey;
    private vertexFormatId;
    private bindInstanceAttributes;
    private resolveAttributeLocation;
    private applyDefaultAttributes;
    private disableUnboundVertexAttributes;
    private primitive;
    private applyRenderState;
    private requireBuffer;
    private stencilCompare;
    private stencilOperation;
    private requireShader;
    private assertAlive;
    private assertFrame;
    private readError;
}
//# sourceMappingURL=WebGL2Device.d.ts.map