WithBinding
Defined in: packages/typegpu/src/core/root/rootTypes.ts:254
Extends
Section titled “Extends”Withable<WithBinding>
Extended by
Section titled “Extended by”Methods
Section titled “Methods”createComputePipeline()
Section titled “createComputePipeline()”createComputePipeline<
ComputeIn>(descriptor):TgpuComputePipeline
Defined in: packages/typegpu/src/core/root/rootTypes.ts:260
Type Parameters
Section titled “Type Parameters”ComputeIn
Section titled “ComputeIn”ComputeIn extends IORecord<AnyComputeBuiltin>
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”Descriptor<ComputeIn>
Returns
Section titled “Returns”createGuardedComputePipeline()
Section titled “createGuardedComputePipeline()”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.
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 threadcreateRenderPipeline()
Section titled “createRenderPipeline()”Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut,TFragmentOut>(descriptor):TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Defined in: packages/typegpu/src/core/root/rootTypes.ts:264
Type Parameters
Section titled “Type Parameters”TVertexIn
Section titled “TVertexIn”TVertexIn extends In = Record<string, any>
TAttribs
Section titled “TAttribs”TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
TVertexOut
Section titled “TVertexOut”TVertexOut = unknown
TFragmentOut
Section titled “TFragmentOut”TFragmentOut = unknown
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”DescriptorBase & object
Returns
Section titled “Returns”TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut>(descriptor):TgpuRenderPipeline<Void>
Defined in: packages/typegpu/src/core/root/rootTypes.ts:293
Type Parameters
Section titled “Type Parameters”TVertexIn
Section titled “TVertexIn”TVertexIn extends In = Record<string, any>
TAttribs
Section titled “TAttribs”TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
TVertexOut
Section titled “TVertexOut”Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”DescriptorBase & object
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”createRenderPipeline<
TVertexIn,TAttribs,TVertexOut,TFragmentOut>(descriptor):TgpuRenderPipeline<Void> |TgpuRenderPipeline<NormalizeOutput<TFragmentOut>>
Defined in: packages/typegpu/src/core/root/rootTypes.ts:322
Type Parameters
Section titled “Type Parameters”TVertexIn
Section titled “TVertexIn”TVertexIn extends In = Record<string, any>
TAttribs
Section titled “TAttribs”TAttribs extends object = LayoutToAllowedAttribs<TVertexIn>
TVertexOut
Section titled “TVertexOut”TFragmentOut
Section titled “TFragmentOut”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>; 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>>
pipe()
Section titled “pipe()”pipe(
transform):WithBinding
Defined in: packages/typegpu/src/core/root/rootTypes.ts:436
Parameters
Section titled “Parameters”transform
Section titled “transform”(cfg) => Configurable
Returns
Section titled “Returns”WithBinding
with()
Section titled “with()”Call Signature
Section titled “Call Signature”with<
T>(slot,value):WithBinding
Defined in: packages/typegpu/src/core/root/rootTypes.ts:204
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”TgpuSlot<T>
Eventual<T>
Returns
Section titled “Returns”WithBinding
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”with<
T>(accessor,value):WithBinding
Defined in: packages/typegpu/src/core/root/rootTypes.ts:205
Type Parameters
Section titled “Type Parameters”T extends BaseData
Parameters
Section titled “Parameters”accessor
Section titled “accessor”TgpuAccessor<T>
In<NoInfer>
Returns
Section titled “Returns”WithBinding
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”with<
T>(accessor,value):WithBinding
Defined in: packages/typegpu/src/core/root/rootTypes.ts:206
Type Parameters
Section titled “Type Parameters”T extends BaseData
Parameters
Section titled “Parameters”accessor
Section titled “accessor”In<NoInfer>
Returns
Section titled “Returns”WithBinding
Inherited from
Section titled “Inherited from”withCompute()
Section titled “withCompute()”withCompute<
ComputeIn>(entryFn):WithCompute
Defined in: packages/typegpu/src/core/root/rootTypes.ts:256
Type Parameters
Section titled “Type Parameters”ComputeIn
Section titled “ComputeIn”ComputeIn extends IORecord<AnyComputeBuiltin>
Parameters
Section titled “Parameters”entryFn
Section titled “entryFn”TgpuComputeFn<ComputeIn>
Returns
Section titled “Returns”withVertex()
Section titled “withVertex()”withVertex<
VertexIn,VertexOut>(entryFn, …args):WithVertex<VertexOut>
Defined in: packages/typegpu/src/core/root/rootTypes.ts:431
Type Parameters
Section titled “Type Parameters”VertexIn
Section titled “VertexIn”VertexIn extends In
VertexOut
Section titled “VertexOut”VertexOut extends Out
Parameters
Section titled “Parameters”entryFn
Section titled “entryFn”TgpuVertexFn<VertexIn, VertexOut>
…OptionalArgs<LayoutToAllowedAttribs<OmitBuiltins<VertexIn>>>
Returns
Section titled “Returns”WithVertex<VertexOut>