/** * WebGPU render pipeline setup */ import { WebGPUDevice } from './device.js'; import { type LightingEnvironment } from './environment.js'; export declare class RenderPipeline { private device; private webgpuDevice; private pipeline; private instancedPipeline; private instancedTransparentPipeline; private makeInstancedTransparentPipeline; private makeQuantizedPipelineAsync; private quantizedPipelines; private instancedTransparentPipelineTried; private selectionPipeline; private transparentPipeline; private overlayPipeline; private texturedPipeline; private texturedBindGroupLayout; private depthTexture; private depthTextureView; private depthOnlyTextureView; private stencilTextureView; private objectIdTexture; private objectIdTextureView; private depthFormat; private colorFormat; private objectIdFormat; private multisampleTexture; private multisampleTextureView; private sampleCount; private uniformBuffer; private bindGroup; private bindGroupLayout; private environmentBuffer; private environmentBindGroup; private environmentBindGroupLayout; private environmentScratch; private currentWidth; private currentHeight; constructor(device: WebGPUDevice, width?: number, height?: number); /** * Update uniform buffer with camera matrices, PBR material, section plane, and selection state */ updateUniforms(viewProj: Float32Array, model: Float32Array, color?: [number, number, number, number], material?: { metallic?: number; roughness?: number; }, sectionPlane?: { normal: [number, number, number]; distance: number; enabled: boolean; flipped?: boolean; }, isSelected?: boolean, clipBox?: { min: [number, number, number]; max: [number, number, number]; enabled: boolean; }): void; /** * Write a raw 56-float (224-byte) uniform block into the SHARED uniform * buffer, whose bind group is `getBindGroup()`. Used by the GPU-instancing * pass, which reuses the frame's viewProj + section + flags from the * renderer's prebuilt template (model + baseColor are unused — vs_instanced * takes the transform + colour per-occurrence from the instance buffer). */ /** * Create-and-VALIDATE the quantized pipeline variants. Uses * createRenderPipelineAsync so WebGPU's asynchronous validation completes * before anything is cached — a sync createRenderPipeline can hand back a * pipeline whose validation later fails on the device, and caching that * would make every quantized draw error. This is the ONLY creator; the * sync getter below reads the cache. Returns whether all variants exist. */ ensureQuantizedPipelines(): Promise; /** Cache-only reader for the quantized variants (see ensureQuantizedPipelines). */ getQuantizedPipelineVariant(kind: 'opaque' | 'transparent' | 'overlay'): GPURenderPipeline | null; writeRawUniforms(data: Float32Array, extraFlagsX?: number): void; /** * Write the global lighting environment uniform buffer. Cheap (80 bytes); * called once per frame with the resolved `RenderOptions.environment`. */ updateEnvironment(env?: LightingEnvironment): void; /** Lighting-environment bind group — set at group(1) once per render pass. */ getEnvironmentBindGroup(): GPUBindGroup; /** * Check if resize is needed */ needsResize(width: number, height: number): boolean; /** * Resize depth texture */ resize(width: number, height: number): void; getPipeline(): GPURenderPipeline; /** GPU-instancing pipeline (template vertex buffer at slot 0 + per-instance buffer at slot 1). */ getInstancedPipeline(): GPURenderPipeline; getInstancedTransparentPipeline(): GPURenderPipeline | null; getSelectionPipeline(): GPURenderPipeline; getTransparentPipeline(): GPURenderPipeline; getOverlayPipeline(): GPURenderPipeline; /** Textured-mesh pipeline (#961). */ getTexturedPipeline(): GPURenderPipeline; /** * Create a bind group for a textured mesh (#961): the mesh's own uniform * buffer at binding 0, plus its albedo texture view + sampler at 1 & 2. */ createTexturedBindGroup(uniformBuffer: GPUBuffer, textureView: GPUTextureView, sampler: GPUSampler): GPUBindGroup; getDepthTextureView(): GPUTextureView; /** Depth-only view (for sampling as texture_depth_* in shaders). */ getDepthOnlyTextureView(): GPUTextureView; /** Stencil-only view (for sampling stencil in the cap fill pass). */ getStencilTextureView(): GPUTextureView; getDepthFormat(): GPUTextureFormat; getObjectIdTextureView(): GPUTextureView; /** * Get multisample texture view (for MSAA rendering) */ getMultisampleTextureView(): GPUTextureView | null; /** * Get sample count */ getSampleCount(): number; getBindGroup(): GPUBindGroup; getBindGroupLayout(): GPUBindGroupLayout; getUniformBufferSize(): number; private destroyed; /** * Destroy all GPU resources held by this pipeline. * After calling this method the pipeline is no longer usable. * Safe to call multiple times. */ destroy(): void; } //# sourceMappingURL=pipeline.d.ts.map