import { type BufferUsage, type DrawCommand, type RenderBuffer, type RenderDevice, type RenderDeviceDiagnostics, type RenderDeviceInfo, type RenderShaderProgram, type RenderTarget, type RenderTargetDescriptor, type ShaderSources } from "./RenderDevice";
export interface WebGPULike {
    requestAdapter(): Promise<WebGPUAdapterLike | null>;
    getPreferredCanvasFormat?(): string;
}
export interface WebGPUAdapterLike {
    requestDevice(): Promise<WebGPUDeviceLike>;
    readonly name?: string;
    readonly info?: {
        readonly vendor?: string;
        readonly architecture?: string;
        readonly device?: string;
        readonly description?: string;
    };
}
export interface WebGPUDeviceLike {
    readonly queue: WebGPUQueueLike;
    readonly lost?: Promise<WebGPUDeviceLostInfoLike>;
    createBuffer(descriptor: WebGPUBufferDescriptorLike): WebGPUBufferLike;
    createShaderModule?(descriptor: {
        readonly label?: string;
        readonly code: string;
    }): unknown;
    createRenderPipeline?(descriptor: WebGPURenderPipelineDescriptorLike): WebGPURenderPipelineLike;
    createBindGroup?(descriptor: WebGPUBindGroupDescriptorLike): WebGPUBindGroupLike;
    createTexture?(descriptor: WebGPUTextureDescriptorLike): WebGPUTextureLike;
    createSampler?(descriptor?: WebGPUSamplerDescriptorLike): WebGPUSamplerLike;
    createCommandEncoder?(descriptor?: {
        readonly label?: string;
    }): WebGPUCommandEncoderLike;
    destroy?(): void;
}
export interface WebGPUDeviceLostInfoLike {
    readonly reason?: string;
    readonly message?: string;
}
export interface WebGPUQueueLike {
    writeBuffer(buffer: WebGPUBufferLike, offset: number, data: ArrayBuffer | ArrayBufferView, dataOffset?: number, size?: number): void;
    writeTexture?(destination: WebGPUImageCopyTextureLike, data: ArrayBuffer | ArrayBufferView, dataLayout: WebGPUImageDataLayoutLike, size: WebGPUExtent3DLike): void;
    copyExternalImageToTexture?(source: WebGPUImageCopyExternalImageLike, destination: WebGPUImageCopyTextureLike, size: WebGPUExtent3DLike): void;
    submit(commands: readonly unknown[]): void;
}
export interface WebGPUBufferDescriptorLike {
    readonly label?: string;
    readonly size: number;
    readonly usage: number;
    readonly mappedAtCreation?: boolean;
}
export interface WebGPUBufferLike {
    mapAsync?(mode: number): Promise<void>;
    getMappedRange?(): ArrayBuffer;
    unmap?(): void;
    destroy(): void;
}
export interface WebGPUTextureDescriptorLike {
    readonly label?: string;
    readonly size: readonly [number, number, number?] | {
        readonly width: number;
        readonly height: number;
        readonly depthOrArrayLayers?: number;
    };
    readonly format: string;
    readonly usage: number;
    readonly mipLevelCount?: number;
}
export interface WebGPUTextureLike {
    createView(): unknown;
    destroy(): void;
}
export interface WebGPUSamplerDescriptorLike {
    readonly minFilter?: "nearest" | "linear";
    readonly magFilter?: "nearest" | "linear";
    readonly mipmapFilter?: "nearest" | "linear";
    readonly addressModeU?: "clamp-to-edge" | "repeat" | "mirror-repeat";
    readonly addressModeV?: "clamp-to-edge" | "repeat" | "mirror-repeat";
    readonly maxAnisotropy?: number;
}
export interface WebGPUSamplerLike {
}
export interface WebGPUCanvasContextLike {
    configure(configuration: WebGPUCanvasConfigurationLike): void;
    getCurrentTexture(): WebGPUTextureLike;
    unconfigure?(): void;
}
export interface WebGPUCanvasConfigurationLike {
    readonly device: WebGPUDeviceLike;
    readonly format: string;
    readonly alphaMode?: "opaque" | "premultiplied";
}
export interface WebGPURenderPipelineDescriptorLike {
    readonly label?: string;
    readonly layout: "auto";
    readonly vertex: {
        readonly module: unknown;
        readonly entryPoint: string;
        readonly buffers?: readonly WebGPUVertexBufferLayoutLike[];
    };
    readonly fragment?: {
        readonly module: unknown;
        readonly entryPoint: string;
        readonly targets: readonly [{
            readonly format: string;
        }];
    };
    readonly primitive: {
        readonly topology: "triangle-list" | "line-list" | "point-list";
    };
    readonly depthStencil?: {
        readonly format: string;
        readonly depthWriteEnabled: boolean;
        readonly depthCompare: "less-equal" | "always";
    };
}
export interface WebGPUVertexBufferLayoutLike {
    readonly arrayStride: number;
    readonly attributes: readonly WebGPUVertexAttributeLike[];
}
export interface WebGPUVertexAttributeLike {
    readonly shaderLocation: number;
    readonly offset: number;
    readonly format: "float32" | "float32x2" | "float32x3" | "float32x4";
}
export interface WebGPUBindGroupDescriptorLike {
    readonly label?: string;
    readonly layout: unknown;
    readonly entries: readonly WebGPUBindGroupEntryLike[];
}
export interface WebGPUBindGroupEntryLike {
    readonly binding: number;
    readonly resource: unknown;
}
export interface WebGPUBindGroupLike {
}
export interface WebGPURenderPipelineLike {
    getBindGroupLayout?(index: number): unknown;
}
export interface WebGPUCommandEncoderLike {
    beginRenderPass(descriptor: WebGPURenderPassDescriptorLike): WebGPURenderPassEncoderLike;
    copyTextureToBuffer?(source: WebGPUImageCopyTextureLike, destination: WebGPUImageCopyBufferLike, size: WebGPUExtent3DLike): void;
    finish(): unknown;
}
export interface WebGPUImageCopyTextureLike {
    readonly texture: WebGPUTextureLike;
    readonly mipLevel?: number;
    readonly origin?: {
        readonly x?: number;
        readonly y?: number;
        readonly z?: number;
    };
}
export interface WebGPUImageCopyExternalImageLike {
    readonly source: TexImageSource;
    readonly origin?: {
        readonly x?: number;
        readonly y?: number;
    };
    readonly flipY?: boolean;
}
export interface WebGPUImageCopyBufferLike {
    readonly buffer: WebGPUBufferLike;
    readonly bytesPerRow: number;
    readonly rowsPerImage?: number;
}
export interface WebGPUImageDataLayoutLike {
    readonly offset?: number;
    readonly bytesPerRow: number;
    readonly rowsPerImage?: number;
}
export type WebGPUExtent3DLike = readonly [number, number, number?] | {
    readonly width: number;
    readonly height: number;
    readonly depthOrArrayLayers?: number;
};
export interface WebGPURenderPassDescriptorLike {
    readonly label?: string;
    readonly colorAttachments: readonly [
        {
            readonly view: unknown;
            readonly clearValue?: readonly [number, number, number, number];
            readonly loadOp: "clear" | "load";
            readonly storeOp: "store";
        }
    ];
    readonly depthStencilAttachment?: {
        readonly view: unknown;
        readonly depthClearValue?: number;
        readonly depthLoadOp: "clear" | "load";
        readonly depthStoreOp: "store";
    };
}
export interface WebGPURenderPassEncoderLike {
    setPipeline(pipeline: WebGPURenderPipelineLike): void;
    setVertexBuffer(slot: number, buffer: WebGPUBufferLike): void;
    setBindGroup?(index: number, bindGroup: WebGPUBindGroupLike): void;
    setIndexBuffer?(buffer: WebGPUBufferLike, indexFormat: "uint16" | "uint32"): void;
    draw(vertexCount: number, instanceCount?: number, firstVertex?: number): void;
    drawIndexed?(indexCount: number, instanceCount?: number, firstIndex?: number): void;
    end(): void;
}
export interface WebGPUDeviceOptions {
    readonly gpu?: WebGPULike;
    readonly adapter?: WebGPUAdapterLike;
    readonly device?: WebGPUDeviceLike;
    readonly canvas?: HTMLCanvasElement | OffscreenCanvas;
    readonly presentationFormat?: string;
}
export declare class WebGPUDevice implements RenderDevice {
    private readonly adapter;
    private readonly device;
    private readonly canvasContext;
    private readonly presentationFormat;
    readonly kind = "webgpu";
    readonly info: RenderDeviceInfo;
    disposed: boolean;
    contextLost: boolean;
    private nextId;
    private frameActive;
    private drawCalls;
    private viewportWidth;
    private viewportHeight;
    private clearColor;
    private lastError;
    private nativeSubmissions;
    private nativeTextureBindings;
    private nativeGeneratedBasicSubmissions;
    private nativeGeneratedTextureSubmissions;
    private nativePassthroughSubmissions;
    private nativePbrSubmissions;
    private nativeInstancedSubmissions;
    private nativeSkinnedSubmissions;
    private nativeMorphSubmissions;
    private nativeEnvironmentBindings;
    private nativeShadowMapBindings;
    private canvasSubmissions;
    private readonly buffers;
    private readonly shaders;
    private readonly renderTargets;
    private readonly nativeSampledTextures;
    private activeRenderTarget;
    private backbufferPixels;
    private backbufferWidth;
    private backbufferHeight;
    private canvasDepthTexture;
    private canvasDepthView;
    private canvasDepthWidth;
    private canvasDepthHeight;
    static create(options?: WebGPUDeviceOptions): Promise<WebGPUDevice>;
    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;
    readPixels(x: number, y: number, width: number, height: number): Uint8Array;
    readPixelsAsync(x: number, y: number, width: number, height: number): Promise<Uint8Array>;
    readFloatPixelsAsync(x: number, y: number, width: number, height: number): Promise<Float32Array>;
    readFloatPixels(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 assertAlive;
    private assertFrame;
    private observeDeviceLost;
    private requireBuffer;
    private requireShader;
    private requireRenderTarget;
    private rasterizeDraw;
    private submitNativeRenderPass;
    private flushNativeRenderTargetClear;
    private createNativeSampledTextureBinding;
    private createNativePbrTextureBindings;
    private createNativeFallbackSampledTextureBinding;
    private createNativeDrawUniformBuffer;
    private currentCanvasView;
    private ensureCanvasDepthAttachment;
    private clearActiveRenderTarget;
    private indicesFor;
}
//# sourceMappingURL=WebGPUDevice.d.ts.map