/** * A WebGPU helper class implementing texture mipmap generation. * * @ignore */ export class WebgpuMipmapRenderer { constructor(device: any); /** @type {WebgpuGraphicsDevice} */ device: WebgpuGraphicsDevice; /** * Cache of render pipelines keyed by the shader variant and the texture format. * * @type {Map} * @private */ private pipelineCache; /** * The shaders of the variants, keyed by the variant. All except the one for filterable 2D * textures are created on first use, as most applications do not need them. * * @type {Map} * @private */ private shaders; /** * The sampler filtering both the minified and the magnified texels, used for volume textures * and by the Gaussian filter, created on first use. * * @type {GPUSampler|null} * @private */ private linearSampler; minSampler: any; destroy(): void; /** * Returns the shader of the variant, creating it if needed. * * @param {string} variant - The variant, a key of shaderVariants. * @returns {Shader} The shader. * @private */ private getShader; /** * Returns the cached render pipeline for the variant and the texture format, creating it if * needed. * * @param {string} variant - The variant, a key of shaderVariants. * @param {GPUTextureFormat} format - The texture format. * @returns {GPURenderPipeline} The render pipeline. * @private */ private getPipeline; /** * Returns true if the texture format cannot be filtered on this device, in which case its * mipmaps are generated by filtering texels read without a sampler. * * @param {GPUTextureFormat} format - The texture format. * @returns {boolean} True if the format cannot be filtered. * @private */ private isUnfilterable; /** * Creates the bind group reading the source mip level, with a sampler unless the format * cannot be filtered. * * @param {GPURenderPipeline} pipeline - The render pipeline. * @param {GPUTextureView} srcView - The view of the source mip level. * @param {GPUSampler|null} sampler - The sampler, or null for a format which cannot be filtered. * @returns {GPUBindGroup} The bind group. * @private */ private createBindGroup; /** * Generates mipmaps for the specified WebGPU texture. * * @param {WebgpuTexture} webgpuTexture - The texture to generate mipmaps for. * @param {number} [layer] - The cubemap face or the array layer to generate the mipmaps for. * When not specified, the mipmaps are generated for all faces / layers. Ignored for volume * textures, as each of their mip levels is filtered from several depth slices. * @param {string} [filter] - The filter, {@link MIPMAPFILTER_BOX} or * {@link MIPMAPFILTER_GAUSSIAN}. The Gaussian filter applies to 2D textures of filterable * formats, others use the box filter. Defaults to {@link MIPMAPFILTER_BOX}. */ generate(webgpuTexture: WebgpuTexture, layer?: number, filter?: string): void; /** * Generates the mipmaps of a volume texture. Each depth slice of a mip level is rendered from * the previous mip level, sampled at the center of the slice, so the linear filtering averages * a 2x2x2 block of its texels - or for a format which cannot be filtered, the block is read * without a sampler and filtered in the shader. * * @param {WebgpuTexture} webgpuTexture - The volume texture to generate mipmaps for. * @private */ private generateVolume; } import type { WebgpuGraphicsDevice } from './webgpu-graphics-device.js'; import type { WebgpuTexture } from './webgpu-texture.js';