Class CommandList
- Namespace
- NeoVeldrid
- Assembly
- NeoVeldrid.dll
A device resource which allows the recording of graphics commands, which can later be executed by a GraphicsDevice. Before graphics commands can be issued, the Begin() method must be invoked. When the CommandList is ready to be executed, End() must be invoked, and then SubmitCommands(CommandList) should be used. NOTE: The use of CommandList is not thread-safe. Access to the CommandList must be externally synchronized. There are some limitations dictating proper usage and ordering of graphics commands. For example, a Framebuffer, Pipeline, vertex buffer, and index buffer must all be bound before a call to DrawIndexed(uint, uint, uint, int, uint) will succeed. These limitations are described in each function, where applicable. CommandList instances cannot be executed multiple times per-recording. When executed by a GraphicsDevice, they must be reset and commands must be issued again. See CommandListDescription.
public abstract class CommandList : DeviceResource, IDisposable
- Inheritance
-
CommandList
- Implements
- Inherited Members
Properties
IsDisposed
A bool indicating whether this instance has been disposed.
public abstract bool IsDisposed { get; }
Property Value
Name
A string identifying this instance. Can be used to differentiate between objects in graphics debuggers and other tools.
public abstract string Name { get; set; }
Property Value
Methods
Begin()
Puts this CommandList into the initial state. This function must be called before other graphics commands can be issued. Begin must only be called if it has not been previously called, if End() has been called, or if SubmitCommands(CommandList) has been called on this instance.
public abstract void Begin()
ClearColorTarget(uint, RgbaFloat)
Clears the color target at the given index of the active Framebuffer. The index given must be less than the number of color attachments in the active Framebuffer.
public void ClearColorTarget(uint index, RgbaFloat clearColor)
Parameters
ClearDepthStencil(float)
Clears the depth-stencil target of the active Framebuffer. The active Framebuffer must have a depth attachment. With this overload, the stencil buffer is cleared to 0.
public void ClearDepthStencil(float depth)
Parameters
depthfloatThe value to clear the depth buffer to.
ClearDepthStencil(float, byte)
Clears the depth-stencil target of the active Framebuffer. The active Framebuffer must have a depth attachment.
public void ClearDepthStencil(float depth, byte stencil)
Parameters
depthfloatThe value to clear the depth buffer to.
stencilbyteThe value to clear the stencil buffer to.
CopyBuffer(DeviceBuffer, uint, DeviceBuffer, uint, uint)
Copies a region from the source DeviceBuffer to another region in the destination DeviceBuffer.
public void CopyBuffer(DeviceBuffer source, uint sourceOffset, DeviceBuffer destination, uint destinationOffset, uint sizeInBytes)
Parameters
sourceDeviceBufferThe source DeviceBuffer from which data will be copied.
sourceOffsetuintAn offset into
sourceat which the copy region begins.destinationDeviceBufferThe destination DeviceBuffer into which data will be copied.
destinationOffsetuintAn offset into
destinationat which the data will be copied.sizeInBytesuintThe number of bytes to copy.
CopyTexture(Texture, Texture)
Copies all subresources from one Texture to another.
public void CopyTexture(Texture source, Texture destination)
Parameters
CopyTexture(Texture, Texture, uint, uint)
Copies one subresource from one Texture to another.
public void CopyTexture(Texture source, Texture destination, uint mipLevel, uint arrayLayer)
Parameters
sourceTextureThe source of Texture data.
destinationTextureThe destination of Texture data.
mipLeveluintThe mip level to copy.
arrayLayeruintThe array layer to copy.
CopyTexture(Texture, uint, uint, uint, uint, uint, Texture, uint, uint, uint, uint, uint, uint, uint, uint, uint)
Copies a region from one Texture into another.
public void CopyTexture(Texture source, uint srcX, uint srcY, uint srcZ, uint srcMipLevel, uint srcBaseArrayLayer, Texture destination, uint dstX, uint dstY, uint dstZ, uint dstMipLevel, uint dstBaseArrayLayer, uint width, uint height, uint depth, uint layerCount)
Parameters
sourceTextureThe source Texture from which data is copied.
srcXuintThe X coordinate of the source copy region.
srcYuintThe Y coordinate of the source copy region.
srcZuintThe Z coordinate of the source copy region.
srcMipLeveluintThe mip level to copy from the source Texture.
srcBaseArrayLayeruintThe starting array layer to copy from the source Texture.
destinationTextureThe destination Texture into which data is copied.
dstXuintThe X coordinate of the destination copy region.
dstYuintThe Y coordinate of the destination copy region.
dstZuintThe Z coordinate of the destination copy region.
dstMipLeveluintThe mip level to copy the data into.
dstBaseArrayLayeruintThe starting array layer to copy data into.
widthuintThe width in texels of the copy region.
heightuintThe height in texels of the copy region.
depthuintThe depth in texels of the copy region.
layerCountuintThe number of array layers to copy.
Dispatch(uint, uint, uint)
Dispatches a compute operation from the currently-bound compute state of this Pipeline.
public abstract void Dispatch(uint groupCountX, uint groupCountY, uint groupCountZ)
Parameters
groupCountXuintThe X dimension of the compute thread groups that are dispatched.
groupCountYuintThe Y dimension of the compute thread groups that are dispatched.
groupCountZuintThe Z dimension of the compute thread groups that are dispatched.
DispatchIndirect(DeviceBuffer, uint)
Issues an indirect compute dispatch command based on the information contained in the given indirect DeviceBuffer. The information stored in the indirect Buffer should conform to the structure of IndirectDispatchArguments.
public void DispatchIndirect(DeviceBuffer indirectBuffer, uint offset)
Parameters
indirectBufferDeviceBufferThe indirect Buffer to read from. Must have been created with the IndirectBuffer flag.
offsetuintAn offset, in bytes, from the start of the indirect buffer from which the draw commands will be read. This value must be a multiple of 4.
Dispose()
Frees unmanaged device resources controlled by this instance.
public abstract void Dispose()
Draw(uint)
Draws primitives from the currently-bound state in this CommandList. An index Buffer is not used.
public void Draw(uint vertexCount)
Parameters
vertexCountuintThe number of vertices.
Draw(uint, uint, uint, uint)
Draws primitives from the currently-bound state in this CommandList. An index Buffer is not used.
public void Draw(uint vertexCount, uint instanceCount, uint vertexStart, uint instanceStart)
Parameters
vertexCountuintThe number of vertices.
instanceCountuintThe number of instances.
vertexStartuintThe first vertex to use when drawing.
instanceStartuintThe starting instance value.
DrawIndexed(uint)
Draws indexed primitives from the currently-bound state in this CommandList.
public void DrawIndexed(uint indexCount)
Parameters
indexCountuintThe number of indices.
DrawIndexed(uint, uint, uint, int, uint)
Draws indexed primitives from the currently-bound state in this CommandList.
public void DrawIndexed(uint indexCount, uint instanceCount, uint indexStart, int vertexOffset, uint instanceStart)
Parameters
indexCountuintThe number of indices.
instanceCountuintThe number of instances.
indexStartuintThe number of indices to skip in the active index buffer.
vertexOffsetintThe base vertex value, which is added to each index value read from the index buffer.
instanceStartuintThe starting instance value.
DrawIndexedIndirect(DeviceBuffer, uint, uint, uint)
Issues indirect, indexed draw commands based on the information contained in the given indirect DeviceBuffer. The information stored in the indirect Buffer should conform to the structure of IndirectDrawIndexedArguments.
public void DrawIndexedIndirect(DeviceBuffer indirectBuffer, uint offset, uint drawCount, uint stride)
Parameters
indirectBufferDeviceBufferThe indirect Buffer to read from. Must have been created with the IndirectBuffer flag.
offsetuintAn offset, in bytes, from the start of the indirect buffer from which the draw commands will be read. This value must be a multiple of 4.
drawCountuintThe number of draw commands to read and issue from the indirect Buffer.
strideuintThe stride, in bytes, between consecutive draw commands in the indirect Buffer. This value must be a multiple of four, and must be larger than the size of IndirectDrawIndexedArguments.
DrawIndirect(DeviceBuffer, uint, uint, uint)
Issues indirect draw commands based on the information contained in the given indirect DeviceBuffer. The information stored in the indirect Buffer should conform to the structure of IndirectDrawArguments.
public void DrawIndirect(DeviceBuffer indirectBuffer, uint offset, uint drawCount, uint stride)
Parameters
indirectBufferDeviceBufferThe indirect Buffer to read from. Must have been created with the IndirectBuffer flag.
offsetuintAn offset, in bytes, from the start of the indirect buffer from which the draw commands will be read. This value must be a multiple of 4.
drawCountuintThe number of draw commands to read and issue from the indirect Buffer.
strideuintThe stride, in bytes, between consecutive draw commands in the indirect Buffer. This value must be a multiple of four, and must be larger than the size of IndirectDrawArguments.
End()
Completes this list of graphics commands, putting it into an executable state for a GraphicsDevice. This function must only be called after Begin() has been called. It is an error to call this function in succession, unless Begin() has been called in between invocations.
public abstract void End()
GenerateMipmaps(Texture)
Generates mipmaps for the given Texture. The largest mipmap is used to generate all of the lower mipmap levels contained in the Texture. The previous contents of all lower mipmap levels are overwritten by this operation. The target Texture must have been created with TextureUsage.GenerateMipmaps.
public void GenerateMipmaps(Texture texture)
Parameters
textureTextureThe Texture to generate mipmaps for. This Texture must have been created with TextureUsage.GenerateMipmaps.
InsertDebugMarker(string)
Inserts a debug marker into the CommandList at the current position. This is used by graphics debuggers to identify points of interest in a command stream.
public void InsertDebugMarker(string name)
Parameters
namestringThe name of the marker. This is an opaque identifier used for display by graphics debuggers.
PopDebugGroup()
Pops the current debug group. This method must only be called after PushDebugGroup(string) has been called on this instance.
public void PopDebugGroup()
PushDebugGroup(string)
Pushes a debug group at the current position in the CommandList. This allows subsequent commands to be categorized and filtered when viewed in external debugging tools. This method can be called multiple times in order to create nested debug groupings. Each call to PushDebugGroup must be followed by a matching call to PopDebugGroup().
public void PushDebugGroup(string name)
Parameters
namestringThe name of the group. This is an opaque identifier used for display by graphics debuggers.
ResolveTexture(Texture, Texture)
public void ResolveTexture(Texture source, Texture destination)
Parameters
sourceTextureThe source of the resolve operation. Must be a multisampled Texture (SampleCount > 1).
destinationTextureThe destination of the resolve operation. Must be a non-multisampled Texture (SampleCount == 1).
ResolveTextureCore(Texture, Texture)
protected abstract void ResolveTextureCore(Texture source, Texture destination)
Parameters
sourceTextureThe source of the resolve operation. Must be a multisampled Texture (SampleCount > 1).
destinationTextureThe destination of the resolve operation. Must be a non-multisampled Texture (SampleCount == 1).
SetComputeResourceSet(uint, ResourceSet)
Sets the active ResourceSet for the given index. This ResourceSet is only active for the compute Pipeline.
public void SetComputeResourceSet(uint slot, ResourceSet rs)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
SetComputeResourceSet(uint, ResourceSet, uint, ref uint)
Sets the active ResourceSet for the given index. This ResourceSet is only active for the compute Pipeline.
public void SetComputeResourceSet(uint slot, ResourceSet rs, uint dynamicOffsetsCount, ref uint dynamicOffsets)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
dynamicOffsetsCountuintThe number of dynamic offsets being used. This must be equal to the number of dynamic buffers (DynamicBinding) contained in the ResourceSet.
dynamicOffsetsuintA reference to the first of a series of offsets which will be applied to the dynamic buffers contained in the ResourceSet. These offsets are applied in the order that dynamic buffer elements appear in the ResourceSet. Each of these offsets must be a multiple of either UniformBufferMinOffsetAlignment or StructuredBufferMinOffsetAlignment, depending on the kind of resource.
SetComputeResourceSet(uint, ResourceSet, uint[])
Sets the active ResourceSet for the given index. This ResourceSet is only active for the compute Pipeline.
public void SetComputeResourceSet(uint slot, ResourceSet rs, uint[] dynamicOffsets)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
dynamicOffsetsuint[]An array containing the offsets to apply to the dynamic buffers contained in the ResourceSet. The number of elements in this array must be equal to the number of dynamic buffers (DynamicBinding) contained in the ResourceSet. These offsets are applied in the order that dynamic buffer elements appear in the ResourceSet.
SetFramebuffer(Framebuffer)
Sets the active Framebuffer which will be rendered to. When drawing, the active Framebuffer must be compatible with the active Pipeline. A compatible Pipeline has the same number of output attachments with matching formats.
public void SetFramebuffer(Framebuffer fb)
Parameters
fbFramebufferThe new Framebuffer.
SetFullScissorRect(uint)
Sets the active scissor rectangle at the given index to cover the active Framebuffer.
public void SetFullScissorRect(uint index)
Parameters
indexuintThe color target index.
SetFullScissorRects()
Sets all active scissor rectangles to cover the active Framebuffer.
public void SetFullScissorRects()
SetFullViewport(uint)
Sets the active viewport at the given index to cover the entire active Framebuffer.
public void SetFullViewport(uint index)
Parameters
indexuintThe color target index.
SetFullViewports()
Sets all active viewports to cover the entire active Framebuffer.
public void SetFullViewports()
SetGraphicsResourceSet(uint, ResourceSet)
Sets the active ResourceSet for the given index. This ResourceSet is only active for the graphics Pipeline.
public void SetGraphicsResourceSet(uint slot, ResourceSet rs)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
SetGraphicsResourceSet(uint, ResourceSet, uint, ref uint)
Sets the active ResourceSet for the given index. This ResourceSet is only active for the graphics Pipeline.
public void SetGraphicsResourceSet(uint slot, ResourceSet rs, uint dynamicOffsetsCount, ref uint dynamicOffsets)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
dynamicOffsetsCountuintThe number of dynamic offsets being used. This must be equal to the number of dynamic buffers (DynamicBinding) contained in the ResourceSet.
dynamicOffsetsuintA reference to the first of a series of offsets which will be applied to the dynamic buffers contained in the ResourceSet. These offsets are applied in the order that dynamic buffer elements appear in the ResourceSet. Each of these offsets must be a multiple of either UniformBufferMinOffsetAlignment or StructuredBufferMinOffsetAlignment, depending on the kind of resource.
SetGraphicsResourceSet(uint, ResourceSet, uint[])
Sets the active ResourceSet for the given index. This ResourceSet is only active for the graphics Pipeline.
public void SetGraphicsResourceSet(uint slot, ResourceSet rs, uint[] dynamicOffsets)
Parameters
slotuintThe resource slot.
rsResourceSetThe new ResourceSet.
dynamicOffsetsuint[]An array containing the offsets to apply to the dynamic buffers contained in the ResourceSet. The number of elements in this array must be equal to the number of dynamic buffers (DynamicBinding) contained in the ResourceSet. These offsets are applied in the order that dynamic buffer elements appear in the ResourceSet. Each of these offsets must be a multiple of either UniformBufferMinOffsetAlignment or StructuredBufferMinOffsetAlignment, depending on the kind of resource.
SetIndexBuffer(DeviceBuffer, IndexFormat)
Sets the active DeviceBuffer. When drawing, an DeviceBuffer must be bound.
public void SetIndexBuffer(DeviceBuffer buffer, IndexFormat format)
Parameters
bufferDeviceBufferThe new DeviceBuffer.
formatIndexFormatThe format of data in the DeviceBuffer.
SetIndexBuffer(DeviceBuffer, IndexFormat, uint)
Sets the active DeviceBuffer. When drawing, an DeviceBuffer must be bound.
public void SetIndexBuffer(DeviceBuffer buffer, IndexFormat format, uint offset)
Parameters
bufferDeviceBufferThe new DeviceBuffer.
formatIndexFormatThe format of data in the DeviceBuffer.
offsetuintThe offset from the start of the buffer, in bytes, from which data will start to be read.
SetPipeline(Pipeline)
Sets the active Pipeline used for rendering. When drawing, the active Pipeline must be compatible with the bound Framebuffer, ResourceSet, and DeviceBuffer objects. When a new Pipeline is set, the previously-bound ResourceSets on this CommandList become invalidated and must be re-bound.
public void SetPipeline(Pipeline pipeline)
Parameters
SetScissorRect(uint, uint, uint, uint, uint)
Sets the active scissor rectangle at the given index. The index given must be less than the number of color attachments in the active Framebuffer.
public abstract void SetScissorRect(uint index, uint x, uint y, uint width, uint height)
Parameters
indexuintThe color target index.
xuintThe X value of the scissor rectangle.
yuintThe Y value of the scissor rectangle.
widthuintThe width of the scissor rectangle.
heightuintThe height of the scissor rectangle.
SetVertexBuffer(uint, DeviceBuffer)
Sets the active DeviceBuffer for the given index. When drawing, the bound DeviceBuffer objects must be compatible with the bound Pipeline. The given buffer must be non-null. It is not necessary to un-bind vertex buffers for Pipelines which will not use them. All extra vertex buffers are simply ignored.
public void SetVertexBuffer(uint index, DeviceBuffer buffer)
Parameters
indexuintThe buffer slot.
bufferDeviceBufferThe new DeviceBuffer.
SetVertexBuffer(uint, DeviceBuffer, uint)
Sets the active DeviceBuffer for the given index. When drawing, the bound DeviceBuffer objects must be compatible with the bound Pipeline. The given buffer must be non-null. It is not necessary to un-bind vertex buffers for Pipelines which will not use them. All extra vertex buffers are simply ignored.
public void SetVertexBuffer(uint index, DeviceBuffer buffer, uint offset)
Parameters
indexuintThe buffer slot.
bufferDeviceBufferThe new DeviceBuffer.
offsetuintThe offset from the start of the buffer, in bytes, from which data will start to be read.
SetViewport(uint, Viewport)
Sets the active Viewport at the given index. The index given must be less than the number of color attachments in the active Framebuffer.
public void SetViewport(uint index, Viewport viewport)
Parameters
SetViewport(uint, ref Viewport)
Sets the active Viewport at the given index. The index given must be less than the number of color attachments in the active Framebuffer.
public abstract void SetViewport(uint index, ref Viewport viewport)
Parameters
UpdateBuffer(DeviceBuffer, uint, nint, uint)
Updates a DeviceBuffer region with new data.
public void UpdateBuffer(DeviceBuffer buffer, uint bufferOffsetInBytes, nint source, uint sizeInBytes)
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourcenintA pointer to the start of the data to upload.
sizeInBytesuintThe total size of the uploaded data, in bytes.
UpdateBuffer<T>(DeviceBuffer, uint, ReadOnlySpan<T>)
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ReadOnlySpan<T> source) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceReadOnlySpan<T>An readonly span containing the data to upload.
Type Parameters
TThe type of data to upload.
UpdateBuffer<T>(DeviceBuffer, uint, Span<T>)
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, Span<T> source) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceSpan<T>An span containing the data to upload.
Type Parameters
TThe type of data to upload.
UpdateBuffer<T>(DeviceBuffer, uint, T)
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T source) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer storage, at which new data will be uploaded.
sourceTThe value to upload.
Type Parameters
TThe type of data to upload.
UpdateBuffer<T>(DeviceBuffer, uint, ref T)
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceTA reference to the single value to upload.
Type Parameters
TThe type of data to upload.
UpdateBuffer<T>(DeviceBuffer, uint, ref T, uint)
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, ref T source, uint sizeInBytes) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceTA reference to the first of a series of values to upload.
sizeInBytesuintThe total size of the uploaded data, in bytes.
Type Parameters
TThe type of data to upload.
UpdateBuffer<T>(DeviceBuffer, uint, T[])
Updates a DeviceBuffer region with new data.
This function must be used with a blittable value type T.
public void UpdateBuffer<T>(DeviceBuffer buffer, uint bufferOffsetInBytes, T[] source) where T : unmanaged
Parameters
bufferDeviceBufferThe resource to update.
bufferOffsetInBytesuintAn offset, in bytes, from the beginning of the DeviceBuffer's storage, at which new data will be uploaded.
sourceT[]An array containing the data to upload.
Type Parameters
TThe type of data to upload.