TgpuRenderPipeline
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:166
Extends
Section titled “Extends”TgpuNamable.SelfResolvable.Timeable
Type Parameters
Section titled “Type Parameters”Targets
Section titled “Targets”Targets = never
Properties
Section titled “Properties”[$internal]
Section titled “[$internal]”
readonly[$internal]:RenderPipelineInternals
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:168
Overrides
Section titled “Overrides”SelfResolvable.[$internal]
[$soul]
Section titled “[$soul]”
readonly[$soul]:TgpuRenderPipelineSoul
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:169
hasIndexBuffer
Section titled “hasIndexBuffer”
readonlyhasIndexBuffer:boolean
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:171
resourceType
Section titled “resourceType”
readonlyresourceType:"render-pipeline"
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:170
Methods
Section titled “Methods”[$resolve]()
Section titled “[$resolve]()”[$resolve](
ctx):ResolvedSnippet
Defined in: packages/typegpu/src/types.ts:426
Parameters
Section titled “Parameters”ResolutionCtx
Returns
Section titled “Returns”ResolvedSnippet
Inherited from
Section titled “Inherited from”SelfResolvable.[$resolve]
$name()
Section titled “$name()”$name(
label):this
Defined in: packages/typegpu/src/shared/meta.ts:44
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”TgpuNamable.$name
draw()
Section titled “draw()”draw(
vertexCount,instanceCount?,firstVertex?,firstInstance?):void
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:231
Parameters
Section titled “Parameters”vertexCount
Section titled “vertexCount”number
instanceCount?
Section titled “instanceCount?”number
firstVertex?
Section titled “firstVertex?”number
firstInstance?
Section titled “firstInstance?”number
Returns
Section titled “Returns”void
drawIndexedIndirect()
Section titled “drawIndexedIndirect()”drawIndexedIndirect(
indirectBuffer,indirectOffset?):void
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:271
Draws indexed primitives using parameters read from a buffer.
The buffer must contain 5 consecutive 32-bit integer values (indexCount u32, instanceCount u32, firstIndex u32, baseVertex i32, firstInstance u32).
To get the correct offset within complex data structures, use d.memoryLayoutOf(...).
Parameters
Section titled “Parameters”indirectBuffer
Section titled “indirectBuffer”Buffer marked with ‘indirect’ usage containing draw parameters or raw GPUBuffer
GPUBuffer | TgpuBuffer<BaseData> & IndirectFlag
indirectOffset?
Section titled “indirectOffset?”PrimitiveOffsetInfo pointing to the first draw parameter. If not provided, starts at offset 0. To obtain safe offsets, use d.memoryLayoutOf(...).
number | PrimitiveOffsetInfo
Returns
Section titled “Returns”void
drawIndirect()
Section titled “drawIndirect()”drawIndirect(
indirectBuffer,indirectOffset?):void
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:258
Draws primitives using parameters read from a buffer.
The buffer must contain 4 consecutive u32 values (vertexCount, instanceCount, firstVertex, firstInstance).
To get the correct offset within complex data structures, use d.memoryLayoutOf(...).
Parameters
Section titled “Parameters”indirectBuffer
Section titled “indirectBuffer”Buffer marked with ‘indirect’ usage containing draw parameters or raw GPUBuffer
GPUBuffer | TgpuBuffer<BaseData> & IndirectFlag
indirectOffset?
Section titled “indirectOffset?”PrimitiveOffsetInfo pointing to the first draw parameter. If not provided, starts at offset 0. To obtain safe offsets, use d.memoryLayoutOf(...).
number | PrimitiveOffsetInfo
Returns
Section titled “Returns”void
initAsync()
Section titled “initAsync()”initAsync():
Promise<void>
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:242
Immediately resolves the pipeline, then awaits device.createRenderPipelineAsync().
NOTE: it is not necessary to initialize pipelines manually.
Returns
Section titled “Returns”Promise<void>
initSync()
Section titled “initSync()”initSync():
void
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:248
Immediately resolves the pipeline and creates WebGPU resources. NOTE: it is not necessary to initialize pipelines manually.
Returns
Section titled “Returns”void
toString()
Section titled “toString()”toString():
string
Defined in: packages/typegpu/src/types.ts:427
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”SelfResolvable.toString
with()
Section titled “with()”Call Signature
Section titled “Call Signature”with<
TData>(vertexLayout,buffer):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:173
Type Parameters
Section titled “Type Parameters”TData extends WgslArray<BaseData> | Disarray<BaseData>
Parameters
Section titled “Parameters”vertexLayout
Section titled “vertexLayout”TgpuVertexLayout<TData>
buffer
Section titled “buffer”GPUBuffer | TgpuBuffer<TData> & VertexFlag
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with<
Entries>(bindGroupLayout,bindGroup):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:181
Type Parameters
Section titled “Type Parameters”Entries
Section titled “Entries”Entries extends Record<string, TgpuLayoutEntry | null>
Parameters
Section titled “Parameters”bindGroupLayout
Section titled “bindGroupLayout”TgpuBindGroupLayout<Entries>
bindGroup
Section titled “bindGroup”TgpuBindGroup<Entries>
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
bindGroupLayout,bindGroup):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:185
Parameters
Section titled “Parameters”bindGroupLayout
Section titled “bindGroupLayout”bindGroup
Section titled “bindGroup”GPUBindGroup
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
bindGroup):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:186
Parameters
Section titled “Parameters”bindGroup
Section titled “bindGroup”Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
pass):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:191
Directs subsequent draw calls into the given render pass or render bundle encoder, letting multiple pipelines share one pass (and one submission).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
encoder):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:196
Directs subsequent draw calls into the given command encoder. Each draw records its own render pass; the caller owns the submission.
Parameters
Section titled “Parameters”encoder
Section titled “encoder”Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
encoder):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:197
Parameters
Section titled “Parameters”encoder
Section titled “encoder”GPUCommandEncoder
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
pass):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:198
Parameters
Section titled “Parameters”GPURenderPassEncoder
Returns
Section titled “Returns”this
Call Signature
Section titled “Call Signature”with(
bundleEncoder):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:199
Parameters
Section titled “Parameters”bundleEncoder
Section titled “bundleEncoder”GPURenderBundleEncoder
Returns
Section titled “Returns”this
withColorAttachment()
Section titled “withColorAttachment()”withColorAttachment(
attachment):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:213
Attaches texture views to the pipeline’s targets (outputs).
Parameters
Section titled “Parameters”attachment
Section titled “attachment”FragmentOutToColorAttachment<Targets>
The object should match the shape returned by the fragment shader, with values matching the ColorAttachment type.
Returns
Section titled “Returns”this
Example
Section titled “Example”// Draw 3 vertices onto the context's canvaspipeline .withColorAttachment({ view: context }) .draw(3)withDepthStencilAttachment()
Section titled “withDepthStencilAttachment()”withDepthStencilAttachment(
attachment):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:215
Parameters
Section titled “Parameters”attachment
Section titled “attachment”Returns
Section titled “Returns”this
withIndexBuffer()
Section titled “withIndexBuffer()”Call Signature
Section titled “Call Signature”withIndexBuffer(
buffer,offsetElements?,sizeElements?):TgpuRenderPipeline<Targets> &HasIndexBuffer
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:219
Parameters
Section titled “Parameters”buffer
Section titled “buffer”TgpuBuffer<BaseData> & IndexFlag
offsetElements?
Section titled “offsetElements?”number
sizeElements?
Section titled “sizeElements?”number
Returns
Section titled “Returns”TgpuRenderPipeline<Targets> & HasIndexBuffer
Call Signature
Section titled “Call Signature”withIndexBuffer(
buffer,indexFormat,offsetBytes?,sizeBytes?):TgpuRenderPipeline<Targets> &HasIndexBuffer
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:224
Parameters
Section titled “Parameters”buffer
Section titled “buffer”GPUBuffer
indexFormat
Section titled “indexFormat”GPUIndexFormat
offsetBytes?
Section titled “offsetBytes?”number
sizeBytes?
Section titled “sizeBytes?”number
Returns
Section titled “Returns”TgpuRenderPipeline<Targets> & HasIndexBuffer
withPerformanceCallback()
Section titled “withPerformanceCallback()”withPerformanceCallback(
callback):this
Defined in: packages/typegpu/src/core/pipeline/timeable.ts:13
Attaches a callback reporting the GPU-side start and end timestamps of the pipeline’s pass. Repeated executions within one command encoder write to the same query set indices, so the callback fires once, with the timestamps of the last execution.
Parameters
Section titled “Parameters”callback
Section titled “callback”(start, end) => void | Promise<void>
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Timeable.withPerformanceCallback
withStencilReference()
Section titled “withStencilReference()”withStencilReference(
reference):this
Defined in: packages/typegpu/src/core/pipeline/renderPipeline.ts:217
Parameters
Section titled “Parameters”reference
Section titled “reference”number
Returns
Section titled “Returns”this
withTimestampWrites()
Section titled “withTimestampWrites()”withTimestampWrites(
options):this
Defined in: packages/typegpu/src/core/pipeline/timeable.ts:15
Parameters
Section titled “Parameters”options
Section titled “options”beginningOfPassWriteIndex?
Section titled “beginningOfPassWriteIndex?”number
endOfPassWriteIndex?
Section titled “endOfPassWriteIndex?”number
querySet
Section titled “querySet”GPUQuerySet | TgpuQuerySet<"timestamp">
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”Timeable.withTimestampWrites