/** * @import { BindGroupFormat, BindTextureFormat } from './bind-group-format.js' * @import { GraphicsDevice } from './graphics-device.js' * @import { UniformBufferFormat } from './uniform-buffer-format.js' * @import { VertexFormat } from './vertex-format.js' */ /** * Options to drive shader processing to add support for bind groups and uniform buffers. * * @ignore */ export class ShaderProcessorOptions { /** * Constructs shader processing options, used to process the shader for uniform buffer support. * * @param {UniformBufferFormat} [viewUniformFormat] - Format of the view uniform buffer, the * first binding of the view bind group. * @param {VertexFormat} [vertexFormat] - Format of the vertex buffer. * @param {Set|null} [viewTextures] - The names of the textures which are part of the * view bind group, following the uniform buffer. On WebGPU each shader gets a view bind group * format of exactly the view textures it declares. Only used with a view uniform format, and * must be a function of it, as only the format is part of the processing key. */ constructor(viewUniformFormat?: UniformBufferFormat, vertexFormat?: VertexFormat, viewTextures?: Set | null); /** @type {UniformBufferFormat[]} */ uniformFormats: UniformBufferFormat[]; /** @type {BindGroupFormat[]} */ bindGroupFormats: BindGroupFormat[]; /** @type {VertexFormat[]} */ vertexFormat: VertexFormat[]; /** * The names of the textures the renderer supplies per pass in the view bind group, or null when * the view bind group holds only the view uniform buffer. * * @type {Set|null} */ viewTextures: Set | null; /** * Get the bind group index for the uniform name. * * @param {string} name - The name of the uniform. * @returns {boolean} - Returns true if the uniform exists, false otherwise. */ hasUniform(name: string): boolean; /** * Get the index of the bind group whose uniform buffer contains the uniform. * * @param {string} name - The name of the uniform. * @returns {number} - The bind group index, or -1 if no uniform buffer contains the uniform. */ getUniformBindGroup(name: string): number; /** * Get the bind group texture slot for the texture uniform name. * * @param {string} name - The name of the texture uniform. * @returns {boolean} - Returns true if the texture uniform exists, false otherwise. */ hasTexture(name: string): boolean; /** * Get the format of the texture, if one of the supplied bind groups contains it. * * @param {string} name - The name of the texture. * @returns {BindTextureFormat|null} - The format of the texture, or null if no supplied bind * group contains it. */ getTexture(name: string): BindTextureFormat | null; /** * Debug check of a uniform no supplied format claims, which so falls to the per-draw mesh * uniform buffer. A light uniform belongs in the view uniform buffer whenever a view format is * supplied, so one landing here means the lighting chunks declare something the format does * not carry, and it is uploaded per draw again. * * @param {string} name - The name of the uniform. */ debugCheckMeshUniform(name: string): void; getVertexElement(semantic: any): any; /** * Generate unique key representing the processing options. * * @param {GraphicsDevice} device - The device. * @returns {string} - Returns the key. */ generateKey(device: GraphicsDevice): string; } import type { UniformBufferFormat } from './uniform-buffer-format.js'; import type { BindGroupFormat } from './bind-group-format.js'; import type { VertexFormat } from './vertex-format.js'; import type { BindTextureFormat } from './bind-group-format.js'; import type { GraphicsDevice } from './graphics-device.js';