Skip to content

TgpuRoot

Defined in: packages/typegpu/src/core/root/rootTypes.ts:411

  • Unwrapper

~unstable: Omit<ExperimentalTgpuRoot, keyof TgpuRoot>

Defined in: packages/typegpu/src/core/root/rootTypes.ts:590


readonly device: GPUDevice

Defined in: packages/typegpu/src/core/root/rootTypes.ts:415

The GPU device associated with this root.

Unwrapper.device

get enabledFeatures(): ReadonlySet<GPUFeatureName>

Defined in: packages/typegpu/src/core/root/rootTypes.ts:581

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

ReadonlySet<GPUFeatureName>

A set of strings representing the enabled features.

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:567

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,
});

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:426

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.

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:441

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.


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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:481

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>

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:495

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>


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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:537

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.


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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:508

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>

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:522

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>


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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:454

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>

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

Defined in: packages/typegpu/src/core/root/rootTypes.ts:468

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>


destroy(): void

Defined in: packages/typegpu/src/core/root/rootTypes.ts:588

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


unwrap(resource): GPUComputePipeline

Defined in: packages/typegpu/src/unwrapper.ts:25

TgpuComputePipeline

GPUComputePipeline

Unwrapper.unwrap

unwrap(resource): GPURenderPipeline

Defined in: packages/typegpu/src/unwrapper.ts:26

TgpuRenderPipeline

GPURenderPipeline

Unwrapper.unwrap

unwrap(resource): GPUBindGroupLayout

Defined in: packages/typegpu/src/unwrapper.ts:27

TgpuBindGroupLayout

GPUBindGroupLayout

Unwrapper.unwrap

unwrap(resource): GPUBindGroup

Defined in: packages/typegpu/src/unwrapper.ts:28

TgpuBindGroup

GPUBindGroup

Unwrapper.unwrap

unwrap(resource): GPUBuffer

Defined in: packages/typegpu/src/unwrapper.ts:29

TgpuBuffer<AnyData>

GPUBuffer

Unwrapper.unwrap

unwrap(resource): GPUTexture

Defined in: packages/typegpu/src/unwrapper.ts:30

TgpuTexture

GPUTexture

Unwrapper.unwrap

unwrap(resource): GPUTextureView

Defined in: packages/typegpu/src/unwrapper.ts:31

TgpuReadonlyTexture<StorageTextureDimension, TexelData> | TgpuWriteonlyTexture<StorageTextureDimension, TexelData> | TgpuMutableTexture<StorageTextureDimension, TexelData> | TgpuSampledTexture<GPUTextureViewDimension, ChannelData>

GPUTextureView

Unwrapper.unwrap

unwrap(resource): GPUVertexBufferLayout

Defined in: packages/typegpu/src/unwrapper.ts:38

TgpuVertexLayout

GPUVertexBufferLayout

Unwrapper.unwrap

unwrap(resource): GPUSampler

Defined in: packages/typegpu/src/unwrapper.ts:39

TgpuSampler

GPUSampler

Unwrapper.unwrap

unwrap(resource): GPUSampler

Defined in: packages/typegpu/src/unwrapper.ts:40

TgpuComparisonSampler

GPUSampler

Unwrapper.unwrap

unwrap(resource): GPUQuerySet

Defined in: packages/typegpu/src/unwrapper.ts:41

TgpuQuerySet<GPUQueryType>

GPUQuerySet

Unwrapper.unwrap