Skip to content

ResolutionCtx

Defined in: packages/typegpu/src/types.ts:272

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.

[$internal]: object

Defined in: packages/typegpu/src/types.ts:273

itemStateStack: ItemStateStack


readonly enableExtensions: ("f16" | "clip_distances" | "primitive_index" | "dual_source_blending" | "subgroups")[] | undefined

Defined in: packages/typegpu/src/types.ts:278


readonly gen: ShaderGenerator

Defined in: packages/typegpu/src/types.ts:279


readonly mode: ExecState

Defined in: packages/typegpu/src/types.ts:277

get varyingLocations(): Record<string, number> | undefined

Defined in: packages/typegpu/src/types.ts:333

Record<string, number> | undefined

addDeclaration(declaration): void

Defined in: packages/typegpu/src/types.ts:281

string

void


allocateFixedEntry(layoutEntry, resource): object

Defined in: packages/typegpu/src/types.ts:294

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.

TgpuLayoutEntry

object

object

binding: number

group: string


allocateLayoutEntry(layout): string

Defined in: packages/typegpu/src/types.ts:288

Reserves a bind group number, and returns a placeholder that will be replaced with a concrete number at the end of the resolution process.

TgpuBindGroupLayout

string


isIdentifierTaken(name): boolean

Defined in: packages/typegpu/src/types.ts:357

string

boolean


makeUniqueIdentifier(primer, scope): string

Defined in: packages/typegpu/src/types.ts:355

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"

string

an identifier that is unique within the given scope


popMode(expected?): void

Defined in: packages/typegpu/src/types.ts:305

ExecMode

void


pushMode(state): void

Defined in: packages/typegpu/src/types.ts:304

ExecState

void


reserveIdentifier(name, scope): void

Defined in: packages/typegpu/src/types.ts:365

Makes sure the given identifier cannot be generated by makeUniqueIdentifier within the given scope.

string

The name to reserve

See makeUniqueIdentifier for a description of the scope parameter.

"block" | "global"

void


resolve(item, schema?): ResolvedSnippet

Defined in: packages/typegpu/src/types.ts:319

Returns the snippet representing item.

unknown

The value to resolve

Additional information about the item’s data type

BaseData | typeof UnknownData

ResolvedSnippet


resolveFunction(options): object

Defined in: packages/typegpu/src/types.ts:326

ResolveFunctionOptions

object

code: string

returnType: BaseData


resolveSnippet(snippet): ResolvedSnippet

Defined in: packages/typegpu/src/types.ts:324

Equivalent to snip(ctx.resolve(snippet.value, snippet.dataType).value, snippet.dataType, snippet.origin).

Snippet

ResolvedSnippet


unwrap<T>(eventual): T

Defined in: packages/typegpu/src/types.ts:311

Unwraps all layers of slot/lazy indirection and returns the concrete value if available.

T

Eventual<T>

T


withRenamed<T>(item, name, callback): T

Defined in: packages/typegpu/src/types.ts:343

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.

T

object

the item to rename

the temporary name to assign to the item (if missing, just returns callback())

string | undefined

() => T

T


withResetIndentLevel<T>(callback): T

Defined in: packages/typegpu/src/types.ts:282

T

() => T

T


withSlots<T>(pairs, callback): T

Defined in: packages/typegpu/src/types.ts:302

T

SlotValuePair[]

() => T

T


withVaryingLocations<T>(locations, callback): T

Defined in: packages/typegpu/src/types.ts:331

T

Record<string, number>

() => T

T