Skip to content

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.

[$internal]: object

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

itemStateStack: ItemStateStack


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

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


readonly gen: ShaderGenerator

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


readonly mode: ExecState

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

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

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

Record<string, number> | undefined

addDeclaration(declaration): void

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

string

void


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.

TgpuLayoutEntry

object

object

binding: number

group: string


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.

TgpuBindGroupLayout

string


fnToWgsl(options): object

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

FnToWgslOptions

object

code: string

returnType: BaseData


isIdentifierTaken(name): boolean

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

string

boolean


makeUniqueIdentifier(primer, scope): string

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

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:303

ExecMode

void


pushMode(state): void

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

ExecState

void


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.

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:317

Returns the snippet representing item.

unknown

The value to resolve

Additional information about the item’s data type

BaseData | typeof UnknownData

ResolvedSnippet


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).

Snippet

ResolvedSnippet


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.

T

Eventual<T>

T


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.

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:280

T

() => T

T


withSlots<T>(pairs, callback): T

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

T

SlotValuePair[]

() => T

T


withVaryingLocations<T>(locations, callback): T

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

T

Record<string, number>

() => T

T