WithBinding
Extends
Section titled “Extends”Extended by
Section titled “Extended by”Methods
Section titled “Methods”createComputePipeline()
Section titled “createComputePipeline()”createComputePipeline<
ComputeIn>(descriptor):TgpuComputePipeline
Type Parameters
Section titled “Type Parameters”• ComputeIn extends IORecord<AnyComputeBuiltin>
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”Descriptor<ComputeIn>
Returns
Section titled “Returns”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:253
createGuardedComputePipeline()
Section titled “createGuardedComputePipeline()”createGuardedComputePipeline<
TArgs>(callback):TgpuGuardedComputePipeline<TArgs>
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.
Type Parameters
Section titled “Type Parameters”• TArgs extends number[]
Parameters
Section titled “Parameters”callback
Section titled “callback”(…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.
Returns
Section titled “Returns”TgpuGuardedComputePipeline<TArgs>
Examples
Section titled “Examples”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 threadsfooPipeline.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 threadDefined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:417
createRenderPipeline()
Section titled “createRenderPipeline()”Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut,TFragmentOut>(descriptor):TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Type Parameters
Section titled “Type Parameters”• TVertexIn extends In = Record<string, any>
• TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
• TVertexOut = unknown
• TFragmentOut = unknown
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”DescriptorBase & object
Returns
Section titled “Returns”TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:257
Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut>(descriptor):TgpuRenderPipeline<Void>
Type Parameters
Section titled “Type Parameters”• TVertexIn extends In = Record<string, any>
• TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
• TVertexOut extends Out = Out
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”DescriptorBase & object
Returns
Section titled “Returns”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:286
Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut,TFragmentOut>(descriptor):TgpuRenderPipeline<Void> |TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Type Parameters
Section titled “Type Parameters”• TVertexIn extends In = Record<string, any>
• TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
• TVertexOut extends Out = Out
• TFragmentOut = unknown
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”DescriptorBase & {attribs: TAttribs;fragment: TgpuFragmentFn<VertexOutToVarying<OmitBuiltins<TVertexOut>> & Record<string, AnyFragmentInputBuiltin>, Assume<TFragmentOut, Out>> | (input) => AutoFragmentOut<Assume<TFragmentOut, v4f | AnyAutoCustoms>>;targets: FragmentOutToTargets<NoInfer<TFragmentOut>>;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>>; }
Returns
Section titled “Returns”TgpuRenderPipeline<Void> | TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:315
pipe()
Section titled “pipe()”pipe(
transform):WithBinding
Parameters
Section titled “Parameters”transform
Section titled “transform”(cfg) => Configurable
Returns
Section titled “Returns”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:429
with()
Section titled “with()”Call Signature
Section titled “Call Signature”with<
T>(slot,value):WithBinding
Type Parameters
Section titled “Type Parameters”• T
Parameters
Section titled “Parameters”TgpuSlot<T>
Eventual<T>
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:197
Call Signature
Section titled “Call Signature”with<
T>(accessor,value):WithBinding
Type Parameters
Section titled “Type Parameters”• T extends BaseData
Parameters
Section titled “Parameters”accessor
Section titled “accessor”TgpuAccessor<T>
In<NoInfer<T>>
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:198
Call Signature
Section titled “Call Signature”with<
T>(accessor,value):WithBinding
Type Parameters
Section titled “Type Parameters”• T extends BaseData
Parameters
Section titled “Parameters”accessor
Section titled “accessor”In<NoInfer<T>>
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:199
withCompute()
Section titled “withCompute()”withCompute<
ComputeIn>(entryFn):WithCompute
Type Parameters
Section titled “Type Parameters”• ComputeIn extends IORecord<AnyComputeBuiltin>
Parameters
Section titled “Parameters”entryFn
Section titled “entryFn”TgpuComputeFn<ComputeIn>
Returns
Section titled “Returns”Defined in
Section titled “Defined in”packages/typegpu/src/core/root/rootTypes.ts:249
withVertex()
Section titled “withVertex()”withVertex<
VertexIn,VertexOut>(entryFn, …args):WithVertex<VertexOut>
Type Parameters
Section titled “Type Parameters”• VertexIn extends In
• VertexOut extends Out
Parameters
Section titled “Parameters”entryFn
Section titled “entryFn”TgpuVertexFn<VertexIn, VertexOut>
…OptionalArgs<LayoutToAllowedAttribs<OmitBuiltins<VertexIn>>>
Returns
Section titled “Returns”WithVertex<VertexOut>