Skip to content

TgpuRoot

  • Unwrapper

[$internal]: object

logOptions: LogGeneratorOptions

packages/typegpu/src/core/root/rootTypes.ts:584


~unstable: Omit<ExperimentalTgpuRoot, keyof TgpuRoot>

packages/typegpu/src/core/root/rootTypes.ts:766


readonly device: GPUDevice

The GPU device associated with this root.

Unwrapper.device

packages/typegpu/src/core/root/rootTypes.ts:591

get enabledFeatures(): ReadonlySet<GPUFeatureName>

Retrieves a read-only list of all enabled features of the GPU device.

ReadonlySet<GPUFeatureName>

A set of strings representing the enabled features.

packages/typegpu/src/core/root/rootTypes.ts:757

createBindGroup<Entries>(layout, entries): TgpuBindGroup<Entries>

Creates a group of resources that can be bound to a shader based on a specified layout.

Entries extends Record<string, null | TgpuLayoutEntry> = Record<string, null | TgpuLayoutEntry>

TgpuBindGroupLayout<Entries>

Layout describing the bind group to be created.

ExtractBindGroupInputFromLayout<Entries>

A record with values being the resources populating the bind group and keys being their associated names, matching the layout keys.

TgpuBindGroup<Entries>

Typed wrapper around a GPUBindGroup.

const fooLayout = tgpu.bindGroupLayout({
foo: { uniform: d.vec3f },
bar: { texture: 'float' },
});
const fooBuffer = ...;
const barTexture = ...;
const fooBindGroup = root.createBindGroup(fooLayout, {
foo: fooBuffer,
bar: barTexture,
});

packages/typegpu/src/core/root/rootTypes.ts:743


createBuffer<TData>(typeSchema, initial?): TgpuBuffer<TData>

Allocates memory on the GPU, allows passing data between host and shader.

TData extends AnyData

ValidateBufferSchema<TData>

The type of data that this buffer will hold.

Infer<NoInfer<TData>>

The initial value of the buffer. (optional)

TgpuBuffer<TData>

Typed wrapper around a GPUBuffer.

packages/typegpu/src/core/root/rootTypes.ts:602

createBuffer<TData>(typeSchema, gpuBuffer): TgpuBuffer<TData>

Allocates memory on the GPU, allows passing data between host and shader.

TData extends AnyData

ValidateBufferSchema<TData>

The type of data that this buffer will hold.

GPUBuffer

A vanilla WebGPU buffer.

TgpuBuffer<TData>

Typed wrapper around a GPUBuffer.

packages/typegpu/src/core/root/rootTypes.ts:617


createMutable<TData>(typeSchema, initial?): TgpuMutable<TData>

Allocates memory on the GPU, allows passing data between host and shader. Can be mutated in-place on the GPU. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateStorageSchema<TData>

The type of data that this buffer will hold.

Infer<NoInfer<TData>>

The initial value of the buffer. (optional)

TgpuMutable<TData>

packages/typegpu/src/core/root/rootTypes.ts:657

createMutable<TData>(typeSchema, gpuBuffer): TgpuMutable<TData>

Allocates memory on the GPU, allows passing data between host and shader. Can be mutated in-place on the GPU. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateStorageSchema<TData>

The type of data that this buffer will hold.

GPUBuffer

A vanilla WebGPU buffer.

TgpuMutable<TData>

packages/typegpu/src/core/root/rootTypes.ts:671


createQuerySet<T>(type, count, rawQuerySet?): TgpuQuerySet<T>

Creates a query set for collecting timestamps or occlusion queries.

T extends GPUQueryType

T

The type of queries to collect (‘occlusion’ or ‘timestamp’).

number

The number of queries in the set.

GPUQuerySet

An optional pre-existing GPUQuerySet to use instead of creating a new one.

TgpuQuerySet<T>

Typed wrapper around a GPUQuerySet.

packages/typegpu/src/core/root/rootTypes.ts:713


createReadonly<TData>(typeSchema, initial?): TgpuReadonly<TData>

Allocates memory on the GPU, allows passing data between host and shader. Read-only on the GPU, optimized for large data. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateStorageSchema<TData>

The type of data that this buffer will hold.

Infer<NoInfer<TData>>

The initial value of the buffer. (optional)

TgpuReadonly<TData>

packages/typegpu/src/core/root/rootTypes.ts:684

createReadonly<TData>(typeSchema, gpuBuffer): TgpuReadonly<TData>

Allocates memory on the GPU, allows passing data between host and shader. Read-only on the GPU, optimized for large data. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateStorageSchema<TData>

The type of data that this buffer will hold.

GPUBuffer

A vanilla WebGPU buffer.

TgpuReadonly<TData>

packages/typegpu/src/core/root/rootTypes.ts:698


createUniform<TData>(typeSchema, initial?): TgpuUniform<TData>

Allocates memory on the GPU, allows passing data between host and shader. Read-only on the GPU, optimized for small data. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateUniformSchema<TData>

The type of data that this buffer will hold.

Infer<NoInfer<TData>>

The initial value of the buffer. (optional)

TgpuUniform<TData>

packages/typegpu/src/core/root/rootTypes.ts:630

createUniform<TData>(typeSchema, gpuBuffer): TgpuUniform<TData>

Allocates memory on the GPU, allows passing data between host and shader. Read-only on the GPU, optimized for small data. For a general-purpose buffer, use TgpuRoot.createBuffer.

TData extends AnyWgslData

ValidateUniformSchema<TData>

The type of data that this buffer will hold.

GPUBuffer

A vanilla WebGPU buffer.

TgpuUniform<TData>

packages/typegpu/src/core/root/rootTypes.ts:644


destroy(): void

Destroys all underlying resources (i.e. buffers…) created through this root object. If the object is created via tgpu.init instead of tgpu.initFromDevice, then the inner GPU device is destroyed as well.

void

packages/typegpu/src/core/root/rootTypes.ts:764


unwrap(resource): GPUComputePipeline

TgpuComputePipeline

GPUComputePipeline

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:19

unwrap(resource): GPURenderPipeline

TgpuRenderPipeline

GPURenderPipeline

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:20

unwrap(resource): GPUBindGroupLayout

TgpuBindGroupLayout

GPUBindGroupLayout

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:21

unwrap(resource): GPUBindGroup

TgpuBindGroup

GPUBindGroup

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:22

unwrap(resource): GPUBuffer

TgpuBuffer<AnyData>

GPUBuffer

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:23

unwrap(resource): GPUTextureView

TgpuTextureView

GPUTextureView

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:24

unwrap(resource): GPUVertexBufferLayout

TgpuVertexLayout

GPUVertexBufferLayout

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:25

unwrap(resource): GPUSampler

TgpuSampler

GPUSampler

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:26

unwrap(resource): GPUSampler

TgpuComparisonSampler

GPUSampler

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:27

unwrap(resource): GPUQuerySet

TgpuQuerySet<GPUQueryType>

GPUQuerySet

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:28

unwrap(resource): GPUTexture

TgpuTexture<any>

GPUTexture

Unwrapper.unwrap

packages/typegpu/src/unwrapper.ts:30