Skip to content

Class VulkanCommandRecorder

Namespace: Apogee.Graphics.Vulkan
Assembly: Apogee.Graphics.dll

A Vulkan command buffer being recorded.

public sealed class VulkanCommandRecorder : CommandRecorder

Inheritance

object ← CommandRecorder ← VulkanCommandRecorder

Inherited Members

CommandRecorder.Device, CommandRecorder.Barriers(ReadOnlySpan<ImageBarrier>, ReadOnlySpan<BufferBarrier>), CommandRecorder.Barrier(in ImageBarrier), CommandRecorder.CopyBuffer(GpuBuffer, GpuBuffer, ulong, ulong, ulong), CommandRecorder.CopyBufferToImage(GpuBuffer, GpuImage, ReadOnlySpan<ImageRegion>), CommandRecorder.CopyImageToBuffer(GpuImage, GpuBuffer, ReadOnlySpan<ImageRegion>), CommandRecorder.WholeSize, CommandRecorder.FillBuffer(GpuBuffer, uint, ulong, ulong), CommandRecorder.ClearImage(GpuImage, Vector4, uint, uint, uint, uint), CommandRecorder.ClearDepthImage(GpuImage, float, uint, uint, uint, uint), CommandRecorder.BindPipeline(Pipeline), CommandRecorder.PushConstants<T>(in T), CommandRecorder.Dispatch(uint, uint, uint), CommandRecorder.DispatchIndirect(GpuBuffer, ulong), CommandRecorder.BeginRendering(uint, uint, ReadOnlySpan<ColorTarget>, DepthTarget?), CommandRecorder.EndRendering(), CommandRecorder.SetViewport(uint, uint), CommandRecorder.SetScissor(int, int, uint, uint), CommandRecorder.Draw(uint, uint, uint, uint), CommandRecorder.DrawIndexed(uint, uint, uint, int, uint), CommandRecorder.DrawIndexedIndirect(GpuBuffer, ulong, uint, uint), CommandRecorder.DrawIndexedIndirectCount(GpuBuffer, ulong, GpuBuffer, ulong, uint, uint), CommandRecorder.BindIndexBuffer(GpuBuffer, IndexFormat, ulong), CommandRecorder.Label(string, float, float, float), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Handle

public VkCommandBuffer Handle { get; }

Property Value

VkCommandBuffer

Methods

Barriers(ReadOnlySpan<ImageBarrier>, ReadOnlySpan<BufferBarrier>)

Records the barriers in one call; a state that only reads after a read needs none and is skipped by the caller (the render graph).

public override void Barriers(ReadOnlySpan<ImageBarrier> images, ReadOnlySpan<BufferBarrier> buffers = default)

Parameters

images ReadOnlySpan<ImageBarrier>

buffers ReadOnlySpan<BufferBarrier>

BeginLabel(string, float, float, float)

protected override void BeginLabel(string name, float r, float g, float b)

Parameters

name string

r float

g float

b float

BeginRendering(uint, uint, ReadOnlySpan<ColorTarget>, DepthTarget?)

Starts a dynamic-rendering pass over the whole of the given size. The viewport and scissor are set to it too.

public override void BeginRendering(uint width, uint height, ReadOnlySpan<ColorTarget> colors, DepthTarget? depth = null)

Parameters

width uint

height uint

colors ReadOnlySpan<ColorTarget>

depth DepthTarget?

BindIndexBuffer(GpuBuffer, IndexFormat, ulong)

public override void BindIndexBuffer(GpuBuffer buffer, IndexFormat format = IndexFormat.Index32, ulong offset = 0)

Parameters

buffer GpuBuffer

format IndexFormat

offset ulong

BindPipeline(Pipeline)

Binds the pipeline, and the bindless heap with it.

public override void BindPipeline(Pipeline pipeline)

Parameters

pipeline Pipeline

ClearDepthImage(GpuImage, float, uint, uint, uint, uint)

Sets mips and layers of a depth image to one value (the stencil, if there is one, to zero); the image must be in and not inside a rendering pass. Counts as in . Metal needs on the image.

public override void ClearDepthImage(GpuImage image, float depth = 0, uint baseMip = 0, uint mipCount = 4294967295, uint baseLayer = 0, uint layerCount = 4294967295)

Parameters

image GpuImage

depth float

baseMip uint

mipCount uint

baseLayer uint

layerCount uint

ClearImage(GpuImage, Vector4, uint, uint, uint, uint)

Sets mips and layers of a color image to one color (for float, normalized and sRGB formats); the image must be in and not inside a rendering pass. A count of means every remaining mip or layer. Metal has no such command and clears with a render pass, so there the image needs .

public override void ClearImage(GpuImage image, Vector4 color, uint baseMip = 0, uint mipCount = 4294967295, uint baseLayer = 0, uint layerCount = 4294967295)

Parameters

image GpuImage

color Vector4

baseMip uint

mipCount uint

baseLayer uint

layerCount uint

CopyBuffer(GpuBuffer, GpuBuffer, ulong, ulong, ulong)

public override void CopyBuffer(GpuBuffer source, GpuBuffer destination, ulong size, ulong sourceOffset = 0, ulong destinationOffset = 0)

Parameters

source GpuBuffer

destination GpuBuffer

size ulong

sourceOffset ulong

destinationOffset ulong

CopyBufferToImage(GpuBuffer, GpuImage, ReadOnlySpan<ImageRegion>)

Copies tightly packed texels from a buffer into subresources of an image that is in .

public override void CopyBufferToImage(GpuBuffer source, GpuImage destination, ReadOnlySpan<ImageRegion> regions)

Parameters

source GpuBuffer

destination GpuImage

regions ReadOnlySpan<ImageRegion>

CopyImageToBuffer(GpuImage, GpuBuffer, ReadOnlySpan<ImageRegion>)

Copies subresources of an image in into a buffer, tightly packed.

public override void CopyImageToBuffer(GpuImage source, GpuBuffer destination, ReadOnlySpan<ImageRegion> regions)

Parameters

source GpuImage

destination GpuBuffer

regions ReadOnlySpan<ImageRegion>

Dispatch(uint, uint, uint)

public override void Dispatch(uint groupsX, uint groupsY = 1, uint groupsZ = 1)

Parameters

groupsX uint

groupsY uint

groupsZ uint

DispatchIndirect(GpuBuffer, ulong)

Dispatches with the group counts in a buffer (a at offset, four-byte aligned) that is in : the output of a culling or compaction pass that decided how much work there is.

public override void DispatchIndirect(GpuBuffer arguments, ulong offset = 0)

Parameters

arguments GpuBuffer

offset ulong

Draw(uint, uint, uint, uint)

public override void Draw(uint vertexCount, uint instanceCount = 1, uint firstVertex = 0, uint firstInstance = 0)

Parameters

vertexCount uint

instanceCount uint

firstVertex uint

firstInstance uint

DrawIndexed(uint, uint, uint, int, uint)

public override void DrawIndexed(uint indexCount, uint instanceCount = 1, uint firstIndex = 0, int vertexOffset = 0, uint firstInstance = 0)

Parameters

indexCount uint

instanceCount uint

firstIndex uint

vertexOffset int

firstInstance uint

DrawIndexedIndirect(GpuBuffer, ulong, uint, uint)

Draws with the arguments in a buffer in : drawCount s, stride bytes apart, from offset. Commands with an instance count of 0 draw nothing, which is how a culling pass removes a draw. The first instance of a command is honoured.

public override void DrawIndexedIndirect(GpuBuffer commands, ulong offset, uint drawCount, uint stride = 20)

Parameters

commands GpuBuffer

offset ulong

drawCount uint

stride uint

DrawIndexedIndirectCount(GpuBuffer, ulong, GpuBuffer, ulong, uint, uint)

Like , with the number of draws in a buffer too (a uint at countOffset, written by the pass that filled the commands), capped at maxDrawCount. Needs ; without it, call with the maximum and zero the instance count of the unused commands.

public override void DrawIndexedIndirectCount(GpuBuffer commands, ulong offset, GpuBuffer count, ulong countOffset, uint maxDrawCount, uint stride = 20)

Parameters

commands GpuBuffer

offset ulong

count GpuBuffer

countOffset ulong

maxDrawCount uint

stride uint

EndRendering()

public override void EndRendering()

FillBuffer(GpuBuffer, uint, ulong, ulong)

Fills a range of a buffer that is in with a 32-bit pattern (zero by default: a counter or a histogram that is about to be written). The offset and the size are multiples of four; means the rest of the buffer. Metal fills bytes, so there the four bytes of value must be equal (0, 0xFFFFFFFF, 0x01010101, ...).

public override void FillBuffer(GpuBuffer buffer, uint value = 0, ulong offset = 0, ulong size = 18446744073709551615)

Parameters

buffer GpuBuffer

value uint

offset ulong

size ulong

PushBytes(ReadOnlySpan<byte>)

protected override void PushBytes(ReadOnlySpan<byte> data)

Parameters

data ReadOnlySpan<byte>

SetScissor(int, int, uint, uint)

Restricts drawing to a rectangle of the target, in pixels (the viewport is left as it is).

public override void SetScissor(int x, int y, uint width, uint height)

Parameters

x int

y int

width uint

height uint

SetViewport(uint, uint)

Sets viewport and scissor to the whole target. The viewport is not flipped: clip-space +Y is down in the image.

public override void SetViewport(uint width, uint height)

Parameters

width uint

height uint