TgpuRoot
Defined in: packages/typegpu/src/core/root/rootTypes.ts:411
Extends
Section titled “Extends”Unwrapper
Properties
Section titled “Properties”~unstable
Section titled “~unstable”~unstable:
Omit<ExperimentalTgpuRoot, keyofTgpuRoot>
Defined in: packages/typegpu/src/core/root/rootTypes.ts:590
device
Section titled “device”
readonlydevice:GPUDevice
Defined in: packages/typegpu/src/core/root/rootTypes.ts:415
The GPU device associated with this root.
Overrides
Section titled “Overrides”Unwrapper.device
Accessors
Section titled “Accessors”enabledFeatures
Section titled “enabledFeatures”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”ReadonlySet<GPUFeatureName>
A set of strings representing the enabled features.
Methods
Section titled “Methods”createBindGroup()
Section titled “createBindGroup()”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.
Type Parameters
Section titled “Type Parameters”• Entries extends Record<string, null | TgpuLayoutEntry> = Record<string, null | TgpuLayoutEntry>
Parameters
Section titled “Parameters”layout
Section titled “layout”TgpuBindGroupLayout<Entries>
Layout describing the bind group to be created.
entries
Section titled “entries”ExtractBindGroupInputFromLayout<Entries>
A record with values being the resources populating the bind group and keys being their associated names, matching the layout keys.
Returns
Section titled “Returns”TgpuBindGroup<Entries>
Remarks
Section titled “Remarks”Typed wrapper around a GPUBindGroup.
Example
Section titled “Example”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()
Section titled “createBuffer()”Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateBufferSchema<TData>
The type of data that this buffer will hold.
initial?
Section titled “initial?”Infer<NoInfer<TData>>
The initial value of the buffer. (optional)
Returns
Section titled “Returns”TgpuBuffer<TData>
Remarks
Section titled “Remarks”Typed wrapper around a GPUBuffer.
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateBufferSchema<TData>
The type of data that this buffer will hold.
gpuBuffer
Section titled “gpuBuffer”GPUBuffer
A vanilla WebGPU buffer.
Returns
Section titled “Returns”TgpuBuffer<TData>
Remarks
Section titled “Remarks”Typed wrapper around a GPUBuffer.
createMutable()
Section titled “createMutable()”Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateStorageSchema<TData>
The type of data that this buffer will hold.
initial?
Section titled “initial?”Infer<NoInfer<TData>>
The initial value of the buffer. (optional)
Returns
Section titled “Returns”TgpuMutable<TData>
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateStorageSchema<TData>
The type of data that this buffer will hold.
gpuBuffer
Section titled “gpuBuffer”GPUBuffer
A vanilla WebGPU buffer.
Returns
Section titled “Returns”TgpuMutable<TData>
createQuerySet()
Section titled “createQuerySet()”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.
Type Parameters
Section titled “Type Parameters”• T extends GPUQueryType
Parameters
Section titled “Parameters”T
The type of queries to collect (‘occlusion’ or ‘timestamp’).
number
The number of queries in the set.
rawQuerySet?
Section titled “rawQuerySet?”GPUQuerySet
An optional pre-existing GPUQuerySet to use instead of creating a new one.
Returns
Section titled “Returns”TgpuQuerySet<T>
Remarks
Section titled “Remarks”Typed wrapper around a GPUQuerySet.
createReadonly()
Section titled “createReadonly()”Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateStorageSchema<TData>
The type of data that this buffer will hold.
initial?
Section titled “initial?”Infer<NoInfer<TData>>
The initial value of the buffer. (optional)
Returns
Section titled “Returns”TgpuReadonly<TData>
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateStorageSchema<TData>
The type of data that this buffer will hold.
gpuBuffer
Section titled “gpuBuffer”GPUBuffer
A vanilla WebGPU buffer.
Returns
Section titled “Returns”TgpuReadonly<TData>
createUniform()
Section titled “createUniform()”Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateUniformSchema<TData>
The type of data that this buffer will hold.
initial?
Section titled “initial?”Infer<NoInfer<TData>>
The initial value of the buffer. (optional)
Returns
Section titled “Returns”TgpuUniform<TData>
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”• TData extends AnyWgslData
Parameters
Section titled “Parameters”typeSchema
Section titled “typeSchema”ValidateUniformSchema<TData>
The type of data that this buffer will hold.
gpuBuffer
Section titled “gpuBuffer”GPUBuffer
A vanilla WebGPU buffer.
Returns
Section titled “Returns”TgpuUniform<TData>
destroy()
Section titled “destroy()”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.
Returns
Section titled “Returns”void
unwrap()
Section titled “unwrap()”Call Signature
Section titled “Call Signature”unwrap(
resource):GPUComputePipeline
Defined in: packages/typegpu/src/unwrapper.ts:25
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUComputePipeline
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPURenderPipeline
Defined in: packages/typegpu/src/unwrapper.ts:26
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPURenderPipeline
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBindGroupLayout
Defined in: packages/typegpu/src/unwrapper.ts:27
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBindGroupLayout
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBindGroup
Defined in: packages/typegpu/src/unwrapper.ts:28
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBindGroup
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBuffer
Defined in: packages/typegpu/src/unwrapper.ts:29
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBuffer
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUTexture
Defined in: packages/typegpu/src/unwrapper.ts:30
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUTexture
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUTextureView
Defined in: packages/typegpu/src/unwrapper.ts:31
Parameters
Section titled “Parameters”resource
Section titled “resource”TgpuReadonlyTexture<StorageTextureDimension, TexelData> | TgpuWriteonlyTexture<StorageTextureDimension, TexelData> | TgpuMutableTexture<StorageTextureDimension, TexelData> | TgpuSampledTexture<GPUTextureViewDimension, ChannelData>
Returns
Section titled “Returns”GPUTextureView
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUVertexBufferLayout
Defined in: packages/typegpu/src/unwrapper.ts:38
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUVertexBufferLayout
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUSampler
Defined in: packages/typegpu/src/unwrapper.ts:39
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUSampler
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUSampler
Defined in: packages/typegpu/src/unwrapper.ts:40
Parameters
Section titled “Parameters”resource
Section titled “resource”TgpuComparisonSampler
Returns
Section titled “Returns”GPUSampler
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUQuerySet
Defined in: packages/typegpu/src/unwrapper.ts:41
Parameters
Section titled “Parameters”resource
Section titled “resource”TgpuQuerySet<GPUQueryType>
Returns
Section titled “Returns”GPUQuerySet
Inherited from
Section titled “Inherited from”Unwrapper.unwrap