CommandBuffer

value class CommandBuffer(source)

One frame's recorded GPU work. Acquire with GpuDevice.acquireCommandBuffer and finish with submit.

Functions

Link copied to clipboard

Waits for the next swapchain texture of window and returns it, or null when the window cannot be drawn to right now, such as while it is minimized. The texture is valid until this command buffer is submitted.

Link copied to clipboard

Begins a copy pass for uploads.

Link copied to clipboard

Begins a render pass that clears target to clearColor and keeps whatever is drawn into it.

Link copied to clipboard

Copies floats into vertex uniform slot for the draws that follow. Sizes are limited by the backend; a 4x4 matrix is always fine.

Link copied to clipboard
fun CommandBuffer.recordCaptureOrNull(device: GpuDevice, window: Window, texture: GpuTexture, width: Int, height: Int, format: TextureFormat): FrameCapture?

Records a read-back of texture into this command buffer if window has captures queued with Window.capture, and returns it, or returns null and records nothing when none is queued. Takes the queued captures off window either way.

Link copied to clipboard
fun submit()

Sends the recorded work to the GPU. The buffer must not be used afterwards.

Link copied to clipboard

Sends the recorded work to the GPU and returns a fence that signals when it has finished. Release the fence with GpuDevice.release(fence) after waiting on it.

Link copied to clipboard
open override fun toString(): String