TgpuCommandEncoder
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:49
The TypeGPU equivalent of GPUCommandEncoder, for batching multiple passes (and draws within them) into a single submission.
Example
Section titled “Example”const encoder = root['~unstable'].createCommandEncoder();const pass = encoder.beginRenderPass({ colorAttachments: [{ view: msaaTexture, resolveTarget: context }],});scenePipeline.with(pass).draw(vertexCount);skyPipeline.with(pass).draw(3);pass.end();encoder.submit();For anything not covered by the typed surface (e.g. texture copies), grab
the raw encoder via root.unwrap(encoder).
Properties
Section titled “Properties”[$internal]
Section titled “[$internal]”
readonly[$internal]:CommandEncoderInternals
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:50
resourceType
Section titled “resourceType”
readonlyresourceType:"command-encoder"
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:51
Methods
Section titled “Methods”beginComputePass()
Section titled “beginComputePass()”beginComputePass(
descriptor?):TgpuComputePass
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:60
Begins recording a compute pass
Parameters
Section titled “Parameters”descriptor?
Section titled “descriptor?”Returns
Section titled “Returns”beginRenderPass()
Section titled “beginRenderPass()”beginRenderPass(
descriptor):TgpuRenderPass
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:57
Begins recording a render pass. Attachment views accept TypeGPU textures, texture views and canvas contexts, next to raw GPUTextureViews.
Parameters
Section titled “Parameters”descriptor
Section titled “descriptor”Returns
Section titled “Returns”finish()
Section titled “finish()”finish(
descriptor?):GPUCommandBuffer
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:69
Escape hatch: finishes the recording without submitting, for manual
multi-encoder batching via device.queue.submit([...]).
Parameters
Section titled “Parameters”descriptor?
Section titled “descriptor?”GPUCommandBufferDescriptor
Returns
Section titled “Returns”GPUCommandBuffer
submit()
Section titled “submit()”submit():
void
Defined in: packages/typegpu/src/core/commandEncoder/commandEncoder.ts:63
Finishes the recording and submits the resulting command buffer to the device queue
Returns
Section titled “Returns”void