WgslGenerator
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:214
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WgslGenerator():
WgslGenerator
Returns
Section titled “Returns”WgslGenerator
Methods
Section titled “Methods”declareGlobalConst()
Section titled “declareGlobalConst()”declareGlobalConst(
options):ResolvedSnippet
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:865
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”ResolvedSnippet
Implementation of
Section titled “Implementation of”ShaderGenerator.declareGlobalConst
declareGlobalVar()
Section titled “declareGlobalVar()”declareGlobalVar(
options):ResolvedSnippet
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:874
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”ResolvedSnippet
Implementation of
Section titled “Implementation of”ShaderGenerator.declareGlobalVar
functionDefinition()
Section titled “functionDefinition()”functionDefinition(
options):string
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:900
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”ShaderGenerator.functionDefinition
initGenerator()
Section titled “initGenerator()”initGenerator(
ctx):void
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:219
Parameters
Section titled “Parameters”GenerationCtx
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”ShaderGenerator.initGenerator
numericLiteral()
Section titled “numericLiteral()”numericLiteral(
value,schema):ResolvedSnippet
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:969
Parameters
Section titled “Parameters”number
schema
Section titled “schema”Returns
Section titled “Returns”ResolvedSnippet
Implementation of
Section titled “Implementation of”ShaderGenerator.numericLiteral
refVariable()
Section titled “refVariable()”refVariable(
id,dataType):string
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:261
Parameters
Section titled “Parameters”string
dataType
Section titled “dataType”Returns
Section titled “Returns”string
typeAnnotation()
Section titled “typeAnnotation()”typeAnnotation(
data):string
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:955
Generates a WGSL type string for the given data type, and adds necessary
definitions to the shader preamble. This shouldn’t be called directly, only
through ctx.resolve to properly cache the result.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”ShaderGenerator.typeAnnotation
typeInstantiation()
Section titled “typeInstantiation()”typeInstantiation(
schema,args):ResolvedSnippet
Defined in: packages/typegpu/src/tgsl/wgslGenerator.ts:959
Parameters
Section titled “Parameters”schema
Section titled “schema”readonly Snippet[]
Returns
Section titled “Returns”ResolvedSnippet
Implementation of
Section titled “Implementation of”ShaderGenerator.typeInstantiation