Skip to main content

Type Alias: ShaderModule<PropsT, UniformsT, BindingsT>

ShaderModule<PropsT, UniformsT, BindingsT> = object

Defined in: api/shader-module/shader-module.ts:43

A shader module definition object

Note​

Needs to be initialized with initializeShaderModules

Note​

UniformsT & BindingsT are deduced from PropsT by default. If a custom type for UniformsT is used, BindingsT should be also be provided.

Type Parameters​

PropsT​

PropsT extends Record<string, any> = Record<string, any>

UniformsT​

UniformsT extends Record<string, ShaderModuleUniformValue> = PickUniforms<PropsT>

BindingsT​

BindingsT extends Record<string, Binding> = PickBindings<PropsT>

Properties​

bindingLayout?​

optional bindingLayout?: readonly ShaderModuleBindingLayout[]

Defined in: api/shader-module/shader-module.ts:55

Logical bind-group assignment for bindings declared by this module


bindings?​

optional bindings?: BindingsT

Defined in: api/shader-module/shader-module.ts:53

Used for type inference, not currently used for values


defaultUniforms?​

optional defaultUniforms?: Required<UniformsT>

Defined in: api/shader-module/shader-module.ts:78

Default uniform values


defines?​

optional defines?: Record<string, boolean | number>

Defined in: api/shader-module/shader-module.ts:87

Boolean or numeric preprocessor defines contributed by this shader module.


dependencies?​

optional dependencies?: ShaderModule<any, any>[]

Defined in: api/shader-module/shader-module.ts:88


deprecations?​

optional deprecations?: ShaderModuleDeprecation[]

Defined in: api/shader-module/shader-module.ts:90

Information on deprecated properties


firstBindingSlot?​

optional firstBindingSlot?: number

Defined in: api/shader-module/shader-module.ts:57

Preferred starting binding slot for this module's WGSL @binding(auto) declarations.


fs?​

optional fs?: string

Defined in: api/shader-module/shader-module.ts:69

GLSL fragment shader code


getUniforms?​

optional getUniforms?: (props, prevUniforms?) => Partial<UniformsT & BindingsT>

Defined in: api/shader-module/shader-module.ts:81

Function that maps props to uniforms & bindings

Parameters​

props​

Partial<PropsT>

prevUniforms?​

UniformsT

Returns​

Partial<UniformsT & BindingsT>


implements?​

optional implements?: string

Defined in: api/shader-module/shader-module.ts:62

Exclusive named shader interface provided by this module.


instance?​

optional instance?: object

Defined in: api/shader-module/shader-module.ts:93

The instance field contains information that is generated at run-time

normalizedInjections​

normalizedInjections: object

Empty compatibility value for consumers using older shadertools assembly.

normalizedInjections.fragment​

fragment: Record<string, ResolvedShaderInjection>

normalizedInjections.vertex​

vertex: Record<string, ResolvedShaderInjection>

parsedDeprecations​

parsedDeprecations: ShaderModuleDeprecation[]

propValidators?​

optional propValidators?: Record<string, PropValidator>


name​

name: string

Defined in: api/shader-module/shader-module.ts:59


props?​

optional props?: PropsT

Defined in: api/shader-module/shader-module.ts:49

Used for type inference not for values


propTypes?​

optional propTypes?: Record<keyof UniformsT, UniformInfo>

Defined in: api/shader-module/shader-module.ts:76

Uniform JS prop types


source?​

optional source?: string

Defined in: api/shader-module/shader-module.ts:67

WGSL code, or reusable code in sourceLanguage combined with the application source.


sourceLanguage?​

optional sourceLanguage?: string

Defined in: api/shader-module/shader-module.ts:65

Language of source when an application-owned transpiler is required.


uniforms?​

optional uniforms?: UniformsT

Defined in: api/shader-module/shader-module.ts:51

Used for type inference, not currently used for values


uniformTypes?​

optional uniformTypes?: Required<UniformTypes<UniformsT>>

Defined in: api/shader-module/shader-module.ts:74

Uniform shader types @note: Both order and types MUST match uniform block declarations in shader


vs?​

optional vs?: string

Defined in: api/shader-module/shader-module.ts:71

GLSL vertex shader code