import { PlatformInfo } from "./platform-info.js"; import { ShaderModuleInstance } from "../shader-module/shader-module-instance.js"; import type { ShaderInjection } from "./shader-injections.js"; import type { ShaderModule } from "../shader-module/shader-module.js"; import { ShaderHook } from "./shader-hooks.js"; /** Define map */ export type ShaderDefine = string | number | boolean; export type HookFunction = { hook: string; header: string; footer: string; signature?: string; }; export type AssembleShaderOptions = { /** information about the platform (which shader language & version, extensions etc.) */ platformInfo: PlatformInfo; /** Inject shader id #defines */ id?: string; /** Single WGSL shader */ source?: string; /** Vertex shader */ vs?: string; /** Fragment shader */ fs?: string; /** Modules to be injected */ modules?: (ShaderModule | ShaderModuleInstance)[]; /** Defines to be injected */ defines?: Record; /** Hook functions */ hookFunctions?: (ShaderHook | string)[]; /** Code injections */ inject?: Record; /** Whether to inject prologue */ prologue?: boolean; /** logger object */ log?: any; }; type AssembleStageOptions = { /** Inject shader id #defines */ id?: string; /** Vertex shader */ source: string; stage: 'vertex' | 'fragment'; /** Modules to be injected */ modules: any[]; /** Defines to be injected */ defines?: Record; /** Hook functions */ hookFunctions?: (ShaderHook | string)[]; /** Code injections */ inject?: Record; /** Whether to inject prologue */ prologue?: boolean; /** logger object */ log?: any; }; /** * getUniforms function returned from the shader module system */ export type GetUniformsFunc = (opts: Record) => Record; /** * Inject a list of shader modules into a single shader source for WGSL */ export declare function assembleShaderWGSL(options: AssembleShaderOptions): { source: string; getUniforms: GetUniformsFunc; }; /** * Injects dependent shader module sources into pair of main vertex/fragment shader sources for WGSL */ export declare function assembleShaderPairWGSL(options: AssembleShaderOptions): { vs: string; fs: string; getUniforms: GetUniformsFunc; }; /** * Injects dependent shader module sources into pair of main vertex/fragment shader sources for GLSL */ export declare function assembleShaderPairGLSL(options: AssembleShaderOptions): { vs: string; fs: string; getUniforms: GetUniformsFunc; }; /** * Pulls together complete source code for either a vertex or a fragment shader * adding prologues, requested module chunks, and any final injections. * @param gl * @param options * @returns */ export declare function assembleWGSLShader(platformInfo: PlatformInfo, options: AssembleStageOptions): string; /** * Returns a combined `getUniforms` covering the options for all the modules, * the created function will pass on options to the inidividual `getUniforms` * function of each shader module and combine the results into one object that * can be passed to setUniforms. * @param modules * @returns */ export declare function assembleGetUniforms(modules: ShaderModuleInstance[]): (opts: Record) => Record; export {}; //# sourceMappingURL=assemble-shaders.d.ts.map