Skip to content

WithBinding

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

createComputePipeline<ComputeIn>(descriptor): TgpuComputePipeline

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

ComputeIn extends IORecord<AnyComputeBuiltin>

Descriptor<ComputeIn>

TgpuComputePipeline


createGuardedComputePipeline<TArgs>(callback): TgpuGuardedComputePipeline<TArgs>

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

Creates a compute pipeline that executes the given callback in an exact number of threads. This is different from withCompute(...).createPipeline() in that it does a bounds check on the thread id, where as regular pipelines do not and work in units of workgroups.

TArgs extends number[]

(…args) => void

A function converted to WGSL and executed on the GPU. It can accept up to 3 parameters (x, y, z) which correspond to the global invocation ID of the executing thread.

TgpuGuardedComputePipeline<TArgs>

If no parameters are provided, the callback will be executed once, in a single thread.

const fooPipeline = root
.createGuardedComputePipeline(() => {
'use gpu';
console.log('Hello, GPU!');
});
fooPipeline.dispatchThreads();
// [GPU] Hello, GPU!

One parameter means n-threads will be executed in parallel.

const fooPipeline = root
.createGuardedComputePipeline((x) => {
'use gpu';
if (x % 16 === 0) {
// Logging every 16th thread
console.log('I am the', x, 'thread');
}
});
// executing 512 threads
fooPipeline.dispatchThreads(512);
// [GPU] I am the 256 thread
// [GPU] I am the 272 thread
// ... (30 hidden logs)
// [GPU] I am the 16 thread
// [GPU] I am the 240 thread

createRenderPipeline<TVertexIn, TAttribs, TVertexOut, TFragmentOut>(descriptor): TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>

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

TVertexIn extends In = Record<string, any>

TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>

TVertexOut = unknown

TFragmentOut = unknown

DescriptorBase & object

TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>

createRenderPipeline<TVertexIn, TAttribs, TVertexOut>(descriptor): TgpuRenderPipeline<Void>

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

TVertexIn extends In = Record<string, any>

TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>

TVertexOut extends Out = Out

DescriptorBase & object

TgpuRenderPipeline<Void>

createRenderPipeline<TVertexIn, TAttribs, TVertexOut, TFragmentOut>(descriptor): TgpuRenderPipeline<Void> | TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>

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

TVertexIn extends In = Record<string, any>

TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>

TVertexOut extends Out = Out

TFragmentOut = unknown

DescriptorBase & { attribs?: TAttribs; fragment: TgpuFragmentFn<VertexOutToVarying<OmitBuiltins<TVertexOut>> & Record<string, AnyFragmentInputBuiltin>, Assume<TFragmentOut, Out>> | (input) => AutoFragmentOut<Assume<TFragmentOut, v4f | AnyAutoCustoms>>; targets?: FragmentOutToTargets<NoInfer>; vertex: TgpuVertexFn<TVertexIn, Assume<TVertexOut, Out>> | (input) => AutoVertexOut<Assume<TVertexOut, AnyAutoCustoms>>; } | { attribs?: TAttribs; fragment?: TgpuFragmentFn<VertexOutToVarying<OmitBuiltins<TVertexOut>> & Record<string, AnyFragmentInputBuiltin>, Record<string, never>> | (input) => undefined; targets?: undefined; vertex: TgpuVertexFn<TVertexIn, Assume<TVertexOut, Out>> | (input) => AutoVertexOut<Assume<TVertexOut, AnyAutoCustoms>>; }

TgpuRenderPipeline<Void> | TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>


pipe(transform): WithBinding

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

(cfg) => Configurable

WithBinding


with<T>(slot, value): WithBinding

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

T

TgpuSlot<T>

Eventual<T>

WithBinding

Withable.with

with<T>(accessor, value): WithBinding

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

T extends BaseData

TgpuAccessor<T>

In<NoInfer>

WithBinding

Withable.with

with<T>(accessor, value): WithBinding

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

T extends BaseData

TgpuMutableAccessor<T>

In<NoInfer>

WithBinding

Withable.with


withCompute<ComputeIn>(entryFn): WithCompute

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

ComputeIn extends IORecord<AnyComputeBuiltin>

TgpuComputeFn<ComputeIn>

WithCompute


withVertex<VertexIn, VertexOut>(entryFn, …args): WithVertex<VertexOut>

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

VertexIn extends In

VertexOut extends Out

TgpuVertexFn<VertexIn, VertexOut>

OptionalArgs<LayoutToAllowedAttribs<OmitBuiltins<VertexIn>>>

WithVertex<VertexOut>