TgpuRoot
Extends
Section titled “Extends”Unwrapper
Properties
Section titled “Properties”[$internal]
Section titled “[$internal]”[$internal]:
object
logOptions
Section titled “logOptions”logOptions:
LogGeneratorOptions
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:575
~unstable
Section titled “~unstable”~unstable:
Omit<ExperimentalTgpuRoot, keyofTgpuRoot>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:757
device
Section titled “device”
readonlydevice:GPUDevice
The GPU device associated with this root.
Overrides
Section titled “Overrides”Unwrapper.device
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:582
Accessors
Section titled “Accessors”enabledFeatures
Section titled “enabledFeatures”Get Signature
Section titled “Get Signature”get enabledFeatures():
ReadonlySet<GPUFeatureName>
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.
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:748
Methods
Section titled “Methods”createBindGroup()
Section titled “createBindGroup()”createBindGroup<
Entries>(layout,entries):TgpuBindGroup<Entries>
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,});Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:734
createBuffer()
Section titled “createBuffer()”Call Signature
Section titled “Call Signature”createBuffer<
TData>(typeSchema,initial?):TgpuBuffer<TData>
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.
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:593
Call Signature
Section titled “Call Signature”createBuffer<
TData>(typeSchema,gpuBuffer):TgpuBuffer<TData>
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.
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:608
createMutable()
Section titled “createMutable()”Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:648
Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:662
createQuerySet()
Section titled “createQuerySet()”createQuerySet<
T>(type,count,rawQuerySet?):TgpuQuerySet<T>
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.
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:704
createReadonly()
Section titled “createReadonly()”Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:675
Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:689
createUniform()
Section titled “createUniform()”Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:621
Call Signature
Section titled “Call Signature”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.
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>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:635
destroy()
Section titled “destroy()”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.
Returns
Section titled “Returns”void
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:755
unwrap()
Section titled “unwrap()”Call Signature
Section titled “Call Signature”unwrap(
resource):GPUComputePipeline
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUComputePipeline
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:19
Call Signature
Section titled “Call Signature”unwrap(
resource):GPURenderPipeline
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPURenderPipeline
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:20
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBindGroupLayout
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBindGroupLayout
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:21
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBindGroup
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBindGroup
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:22
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUBuffer
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUBuffer
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:23
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUTextureView
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUTextureView
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:24
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUVertexBufferLayout
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUVertexBufferLayout
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:25
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUSampler
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUSampler
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:26
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUSampler
Parameters
Section titled “Parameters”resource
Section titled “resource”Returns
Section titled “Returns”GPUSampler
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:27
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUQuerySet
Parameters
Section titled “Parameters”resource
Section titled “resource”TgpuQuerySet<GPUQueryType>
Returns
Section titled “Returns”GPUQuerySet
Inherited from
Section titled “Inherited from”Unwrapper.unwrap
Defined in
Section titled “Defined in”packages/typegpu/src/unwrapper.ts:28
Call Signature
Section titled “Call Signature”unwrap(
resource):GPUTexture
Parameters
Section titled “Parameters”resource
Section titled “resource”TgpuTexture<any>
Returns
Section titled “Returns”GPUTexture
Inherited from
Section titled “Inherited from”Unwrapper.unwrap