ResolutionCtx
Defined in: packages/typegpu/src/types.ts:270
Passed into each resolvable item. All items in a tree share a resolution ctx, but there can be layers added and removed from the item stack when going down and up the tree.
Properties
Section titled “Properties”[$internal]
Section titled “[$internal]”[$internal]:
object
Defined in: packages/typegpu/src/types.ts:271
itemStateStack
Section titled “itemStateStack”itemStateStack:
ItemStateStack
enableExtensions
Section titled “enableExtensions”
readonlyenableExtensions: ("f16"|"clip_distances"|"primitive_index"|"dual_source_blending"|"subgroups")[] |undefined
Defined in: packages/typegpu/src/types.ts:276
readonlygen:ShaderGenerator
Defined in: packages/typegpu/src/types.ts:277
readonlymode:ExecState
Defined in: packages/typegpu/src/types.ts:275
Accessors
Section titled “Accessors”varyingLocations
Section titled “varyingLocations”Get Signature
Section titled “Get Signature”get varyingLocations():
Record<string,number> |undefined
Defined in: packages/typegpu/src/types.ts:331
Returns
Section titled “Returns”Record<string, number> | undefined
Methods
Section titled “Methods”addDeclaration()
Section titled “addDeclaration()”addDeclaration(
declaration):void
Defined in: packages/typegpu/src/types.ts:279
Parameters
Section titled “Parameters”declaration
Section titled “declaration”string
Returns
Section titled “Returns”void
allocateFixedEntry()
Section titled “allocateFixedEntry()”allocateFixedEntry(
layoutEntry,resource):object
Defined in: packages/typegpu/src/types.ts:292
Reserves a spot in the catch-all bind group, without the indirection of a bind-group. This means the resource is ‘fixed’, and cannot be swapped between code execution.
Parameters
Section titled “Parameters”layoutEntry
Section titled “layoutEntry”resource
Section titled “resource”object
Returns
Section titled “Returns”object
binding
Section titled “binding”binding:
number
group:
string
allocateLayoutEntry()
Section titled “allocateLayoutEntry()”allocateLayoutEntry(
layout):string
Defined in: packages/typegpu/src/types.ts:286
Reserves a bind group number, and returns a placeholder that will be replaced with a concrete number at the end of the resolution process.
Parameters
Section titled “Parameters”layout
Section titled “layout”Returns
Section titled “Returns”string
fnToWgsl()
Section titled “fnToWgsl()”fnToWgsl(
options):object
Defined in: packages/typegpu/src/types.ts:324
Parameters
Section titled “Parameters”options
Section titled “options”FnToWgslOptions
Returns
Section titled “Returns”object
code:
string
returnType
Section titled “returnType”returnType:
BaseData
isIdentifierTaken()
Section titled “isIdentifierTaken()”isIdentifierTaken(
name):boolean
Defined in: packages/typegpu/src/types.ts:355
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
makeUniqueIdentifier()
Section titled “makeUniqueIdentifier()”makeUniqueIdentifier(
primer,scope):string
Defined in: packages/typegpu/src/types.ts:353
Parameters
Section titled “Parameters”primer
Section titled “primer”The basis for the unique identifier. Depending on the strategy, or the names already taken, this may be modified to ensure uniqueness.
string | undefined
The scope in which to generate the identifier. ‘global’ means the identifier is meant to be unique across the entire program, while ‘block’ means it cannot shadow any existing identifiers visible from within the current block. After the block is popped, any identifiers defined within it are no longer visible.
"block" | "global"
Returns
Section titled “Returns”string
an identifier that is unique within the given scope
popMode()
Section titled “popMode()”popMode(
expected?):void
Defined in: packages/typegpu/src/types.ts:303
Parameters
Section titled “Parameters”expected?
Section titled “expected?”ExecMode
Returns
Section titled “Returns”void
pushMode()
Section titled “pushMode()”pushMode(
state):void
Defined in: packages/typegpu/src/types.ts:302
Parameters
Section titled “Parameters”ExecState
Returns
Section titled “Returns”void
reserveIdentifier()
Section titled “reserveIdentifier()”reserveIdentifier(
name,scope):void
Defined in: packages/typegpu/src/types.ts:363
Makes sure the given identifier cannot be generated by makeUniqueIdentifier within the given scope.
Parameters
Section titled “Parameters”string
The name to reserve
See makeUniqueIdentifier for a description of the scope parameter.
"block" | "global"
Returns
Section titled “Returns”void
resolve()
Section titled “resolve()”resolve(
item,schema?):ResolvedSnippet
Defined in: packages/typegpu/src/types.ts:317
Returns the snippet representing item.
Parameters
Section titled “Parameters”unknown
The value to resolve
schema?
Section titled “schema?”Additional information about the item’s data type
BaseData | typeof UnknownData
Returns
Section titled “Returns”ResolvedSnippet
resolveSnippet()
Section titled “resolveSnippet()”resolveSnippet(
snippet):ResolvedSnippet
Defined in: packages/typegpu/src/types.ts:322
Equivalent to snip(ctx.resolve(snippet.value, snippet.dataType).value, snippet.dataType, snippet.origin).
Parameters
Section titled “Parameters”snippet
Section titled “snippet”Returns
Section titled “Returns”ResolvedSnippet
unwrap()
Section titled “unwrap()”unwrap<
T>(eventual):T
Defined in: packages/typegpu/src/types.ts:309
Unwraps all layers of slot/lazy indirection and returns the concrete value if available.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”eventual
Section titled “eventual”Eventual<T>
Returns
Section titled “Returns”T
Throws
Section titled “Throws”withRenamed()
Section titled “withRenamed()”withRenamed<
T>(item,name,callback):T
Defined in: packages/typegpu/src/types.ts:341
Temporarily renames the item. Useful for resolutions with slots, since functions with different slots should have different names, and all hold the same inner function that is being resolved multiple times.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”object
the item to rename
the temporary name to assign to the item (if missing, just returns callback())
string | undefined
callback
Section titled “callback”() => T
Returns
Section titled “Returns”T
withResetIndentLevel()
Section titled “withResetIndentLevel()”withResetIndentLevel<
T>(callback):T
Defined in: packages/typegpu/src/types.ts:280
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”callback
Section titled “callback”() => T
Returns
Section titled “Returns”T
withSlots()
Section titled “withSlots()”withSlots<
T>(pairs,callback):T
Defined in: packages/typegpu/src/types.ts:300
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”SlotValuePair[]
callback
Section titled “callback”() => T
Returns
Section titled “Returns”T
withVaryingLocations()
Section titled “withVaryingLocations()”withVaryingLocations<
T>(locations,callback):T
Defined in: packages/typegpu/src/types.ts:329
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”locations
Section titled “locations”Record<string, number>
callback
Section titled “callback”() => T
Returns
Section titled “Returns”T