Table of Contents

Class CommandList

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Performs resource bindings and primitive-based rendering. See the GraphicsDevice class to learn more about the class.

public class CommandList : GraphicsResourceBase, IDisposable, IComponent, IReferencable, ICollectorHolder
Inheritance
CommandList
Implements
Inherited Members
Extension Methods

Properties

DepthStencilBuffer

Gets the depth stencil buffer currently sets on this instance.

public Texture DepthStencilBuffer { get; }

Property Value

Texture

The depth stencil buffer currently sets on this instance.

RenderTarget

Gets the render target buffer currently sets on this instance.

public Texture RenderTarget { get; }

Property Value

Texture

The render target buffer currently sets on this instance.

RenderTargetCount

public int RenderTargetCount { get; }

Property Value

int

RenderTargets

public Texture[] RenderTargets { get; }

Property Value

Texture[]

Scissor

Gets the first scissor.

public Rectangle Scissor { get; }

Property Value

Rectangle

The first scissor.

Viewport

Gets the first viewport.

public Viewport Viewport { get; }

Property Value

Viewport

The first viewport.

ViewportCount

public int ViewportCount { get; }

Property Value

int

Viewports

public Viewport[] Viewports { get; }

Property Value

Viewport[]

Methods

BeginProfile(Color4, string)

Begins debug event.

public void BeginProfile(Color4 profileColor, string name)

Parameters

profileColor Color4

Color of the profile.

name string

The name.

Clear(Texture, Color4)

Clears the specified render target. See Textures+and+render+targets to learn how to use it.

public void Clear(Texture renderTarget, Color4 color)

Parameters

renderTarget Texture

The render target.

color Color4

The color.

Exceptions

ArgumentNullException

renderTarget

Clear(Texture, DepthStencilClearOptions, float, byte)

Clears the specified depth stencil buffer. See Textures+and+render+targets to learn how to use it.

public void Clear(Texture depthStencilBuffer, DepthStencilClearOptions options, float depth = 1, byte stencil = 0)

Parameters

depthStencilBuffer Texture

The depth stencil buffer.

options DepthStencilClearOptions

The options.

depth float

The depth.

stencil byte

The stencil.

Exceptions

InvalidOperationException

ClearReadWrite(Buffer, Int4)

Clears a read-write Buffer. This buffer must have been created with read-write/unordered access.

public void ClearReadWrite(Buffer buffer, Int4 value)

Parameters

buffer Buffer

The buffer.

value Int4

The value.

Exceptions

ArgumentNullException

buffer

ArgumentException

Expecting buffer supporting UAV;buffer

ClearReadWrite(Buffer, UInt4)

Clears a read-write Buffer. This buffer must have been created with read-write/unordered access.

public void ClearReadWrite(Buffer buffer, UInt4 value)

Parameters

buffer Buffer

The buffer.

value UInt4

The value.

Exceptions

ArgumentNullException

buffer

ArgumentException

Expecting buffer supporting UAV;buffer

ClearReadWrite(Buffer, Vector4)

Clears a read-write Buffer. This buffer must have been created with read-write/unordered access.

public void ClearReadWrite(Buffer buffer, Vector4 value)

Parameters

buffer Buffer

The buffer.

value Vector4

The value.

Exceptions

ArgumentNullException

buffer

ArgumentException

Expecting buffer supporting UAV;buffer

ClearReadWrite(Texture, Int4)

Clears a read-write Texture. This texture must have been created with read-write/unordered access.

public void ClearReadWrite(Texture texture, Int4 value)

Parameters

texture Texture

The texture.

value Int4

The value.

Exceptions

ArgumentNullException

texture

ArgumentException

Expecting texture supporting UAV;texture

ClearReadWrite(Texture, UInt4)

Clears a read-write Texture. This texture must have been created with read-write/unordered access.

public void ClearReadWrite(Texture texture, UInt4 value)

Parameters

texture Texture

The texture.

value UInt4

The value.

Exceptions

ArgumentNullException

texture

ArgumentException

Expecting texture supporting UAV;texture

ClearReadWrite(Texture, Vector4)

Clears a read-write Texture. This texture must have been created with read-write/unordered access.

public void ClearReadWrite(Texture texture, Vector4 value)

Parameters

texture Texture

The texture.

value Vector4

The value.

Exceptions

ArgumentNullException

texture

ArgumentException

Expecting texture supporting UAV;texture

ClearState()

Clears the state and restore the state of the device.

public void ClearState()

Close()

public CompiledCommandList Close()

Returns

CompiledCommandList

Copy(GraphicsResource, GraphicsResource)

Copy a texture. View is ignored and full underlying texture is copied.

public void Copy(GraphicsResource source, GraphicsResource destination)

Parameters

source GraphicsResource

The source texture.

destination GraphicsResource

The destination texture.

CopyCount(Buffer, Buffer, int)

public void CopyCount(Buffer sourceBuffer, Buffer destBuffer, int offsetInBytes)

Parameters

sourceBuffer Buffer
destBuffer Buffer
offsetInBytes int

CopyMultisample(Texture, int, Texture, int, PixelFormat)

public void CopyMultisample(Texture sourceMultisampleTexture, int sourceSubResource, Texture destTexture, int destSubResource, PixelFormat format = PixelFormat.None)

Parameters

sourceMultisampleTexture Texture
sourceSubResource int
destTexture Texture
destSubResource int
format PixelFormat

CopyRegion(GraphicsResource, int, ResourceRegion?, GraphicsResource, int, int, int, int)

public void CopyRegion(GraphicsResource source, int sourceSubresource, ResourceRegion? sourecRegion, GraphicsResource destination, int destinationSubResource, int dstX = 0, int dstY = 0, int dstZ = 0)

Parameters

source GraphicsResource
sourceSubresource int
sourecRegion ResourceRegion?
destination GraphicsResource
destinationSubResource int
dstX int
dstY int
dstZ int

Dispatch(Buffer, int)

Dispatches the specified indirect buffer.

public void Dispatch(Buffer indirectBuffer, int offsetInBytes)

Parameters

indirectBuffer Buffer

The indirect buffer.

offsetInBytes int

The offset information bytes.

Dispatch(int, int, int)

public void Dispatch(int threadCountX, int threadCountY, int threadCountZ)

Parameters

threadCountX int
threadCountY int
threadCountZ int

Draw(int, int)

Draw non-indexed, non-instanced primitives.

public void Draw(int vertexCount, int startVertexLocation = 0)

Parameters

vertexCount int

Number of vertices to draw.

startVertexLocation int

Index of the first vertex, which is usually an offset in a vertex buffer; it could also be used as the first vertex id generated for a shader parameter marked with the SV_TargetId system-value semantic.

DrawAuto()

Draw geometry of an unknown size.

public void DrawAuto()

DrawIndexed(int, int, int)

Draw indexed, non-instanced primitives.

public void DrawIndexed(int indexCount, int startIndexLocation = 0, int baseVertexLocation = 0)

Parameters

indexCount int

Number of indices to draw.

startIndexLocation int

The location of the first index read by the GPU from the index buffer.

baseVertexLocation int

A value added to each index before reading a vertex from the vertex buffer.

DrawIndexedInstanced(Buffer, int)

Draw indexed, instanced, GPU-generated primitives.

public void DrawIndexedInstanced(Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)

Parameters

argumentsBuffer Buffer

A buffer containing the GPU generated primitives.

alignedByteOffsetForArgs int

Offset in pBufferForArgs to the start of the GPU generated primitives.

DrawIndexedInstanced(int, int, int, int, int)

Draw indexed, instanced primitives.

public void DrawIndexedInstanced(int indexCountPerInstance, int instanceCount, int startIndexLocation = 0, int baseVertexLocation = 0, int startInstanceLocation = 0)

Parameters

indexCountPerInstance int

Number of indices read from the index buffer for each instance.

instanceCount int

Number of instances to draw.

startIndexLocation int

The location of the first index read by the GPU from the index buffer.

baseVertexLocation int

A value added to each index before reading a vertex from the vertex buffer.

startInstanceLocation int

A value added to each index before reading per-instance data from a vertex buffer.

DrawInstanced(Buffer, int)

Draw instanced, GPU-generated primitives.

public void DrawInstanced(Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)

Parameters

argumentsBuffer Buffer

An arguments buffer

alignedByteOffsetForArgs int

Offset in pBufferForArgs to the start of the GPU generated primitives.

DrawInstanced(int, int, int, int)

Draw non-indexed, instanced primitives.

public void DrawInstanced(int vertexCountPerInstance, int instanceCount, int startVertexLocation = 0, int startInstanceLocation = 0)

Parameters

vertexCountPerInstance int

Number of vertices to draw.

instanceCount int

Number of instances to draw.

startVertexLocation int

Index of the first vertex.

startInstanceLocation int

A value added to each index before reading per-instance data from a vertex buffer.

EndProfile()

Ends debug event.

public void EndProfile()

Flush()

public void Flush()

MapSubresource(GraphicsResource, int, MapMode, bool, int, int)

Maps a subresource.

public MappedResource MapSubresource(GraphicsResource resource, int subResourceIndex, MapMode mapMode, bool doNotWait = false, int offsetInBytes = 0, int lengthInBytes = 0)

Parameters

resource GraphicsResource

The resource.

subResourceIndex int

Index of the sub resource.

mapMode MapMode

The map mode.

doNotWait bool

if set to true this method will return immediately if the resource is still being used by the GPU for writing. Default is false

offsetInBytes int

The offset information in bytes.

lengthInBytes int

The length information in bytes.

Returns

MappedResource

Pointer to the sub resource to map.

New(GraphicsDevice)

public static CommandList New(GraphicsDevice device)

Parameters

device GraphicsDevice

Returns

CommandList

OnDestroyed()

Called when graphics device has been detected to be internally destroyed.

protected override void OnDestroyed()

Reset()

public void Reset()

ResetTargets()

Unbinds all depth-stencil buffer and render targets from the output-merger stage.

public void ResetTargets()

ResourceBarrierTransition(GraphicsResource, GraphicsResourceState)

public void ResourceBarrierTransition(GraphicsResource resource, GraphicsResourceState newState)

Parameters

resource GraphicsResource
newState GraphicsResourceState

SetBlendFactor(Color4)

public void SetBlendFactor(Color4 blendFactor)

Parameters

blendFactor Color4

SetDescriptorSets(int, DescriptorSet[])

public void SetDescriptorSets(int index, DescriptorSet[] descriptorSets)

Parameters

index int
descriptorSets DescriptorSet[]

SetIndexBuffer(Buffer, int, bool)

public void SetIndexBuffer(Buffer buffer, int offset, bool is32bits)

Parameters

buffer Buffer
offset int
is32bits bool

SetPipelineState(PipelineState)

public void SetPipelineState(PipelineState pipelineState)

Parameters

pipelineState PipelineState

SetRenderTarget(Texture, Texture)

Binds a depth-stencil buffer and a single render target to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTarget(Texture depthStencilView, Texture renderTargetView)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetView Texture

A view of the render target to bind.

SetRenderTargetAndViewport(Texture, Texture)

Binds a depth-stencil buffer and a single render target to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargetAndViewport(Texture depthStencilView, Texture renderTargetView)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetView Texture

A view of the render target to bind.

SetRenderTargetAndViewport(Texture, Texture, Texture)

public void SetRenderTargetAndViewport(Texture depthStencilView, Texture renderTargetView, Texture secondRenderTarget)

Parameters

depthStencilView Texture
renderTargetView Texture
secondRenderTarget Texture

SetRenderTargets(Texture, Texture[])

Binds a depth-stencil buffer and a set of render targets to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargets(Texture depthStencilView, Texture[] renderTargetViews)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetViews Texture[]

A set of render target views to bind.

Exceptions

ArgumentNullException

renderTargetViews

SetRenderTargets(Texture, int, Texture[])

Binds a depth-stencil buffer and a set of render targets to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargets(Texture depthStencilView, int renderTargetViewCount, Texture[] renderTargetViews)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetViewCount int

The number of render target in renderTargetViews.

renderTargetViews Texture[]

A set of render target views to bind.

Exceptions

ArgumentNullException

renderTargetViews

SetRenderTargets(Texture[])

Bind one or more render targets atomically and the depth-stencil buffer to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargets(Texture[] renderTargetViews)

Parameters

renderTargetViews Texture[]

A set of render target views to bind.

SetRenderTargetsAndViewport(Texture, Texture[])

Binds a depth-stencil buffer and a set of render targets to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargetsAndViewport(Texture depthStencilView, Texture[] renderTargetViews)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetViews Texture[]

A set of render target views to bind.

Exceptions

ArgumentNullException

renderTargetViews

SetRenderTargetsAndViewport(Texture, int, Texture[])

Binds a depth-stencil buffer and a set of render targets to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargetsAndViewport(Texture depthStencilView, int renderTargetViewCount, Texture[] renderTargetViews)

Parameters

depthStencilView Texture

A view of the depth-stencil buffer to bind.

renderTargetViewCount int

The number of render target in renderTargetViews.

renderTargetViews Texture[]

A set of render target views to bind.

Exceptions

ArgumentNullException

renderTargetViews

SetRenderTargetsAndViewport(Texture[])

Bind one or more render targets atomically and the depth-stencil buffer to the output-merger stage. See Textures+and+render+targets to learn how to use it.

public void SetRenderTargetsAndViewport(Texture[] renderTargetViews)

Parameters

renderTargetViews Texture[]

A set of render target views to bind.

SetScissorRectangle(Rectangle)

Binds a single scissor rectangle to the rasterizer stage. See Render+states to learn how to use it.

public void SetScissorRectangle(Rectangle rectangle)

Parameters

rectangle Rectangle

The scissor rectangle.

SetScissorRectangles(Rectangle[])

Binds a set of scissor rectangles to the rasterizer stage. See Render+states to learn how to use it.

public void SetScissorRectangles(Rectangle[] scissorRectangles)

Parameters

scissorRectangles Rectangle[]

The set of scissor rectangles to bind.

SetScissorRectangles(int, Rectangle[])

Binds a set of scissor rectangles to the rasterizer stage. See Render+states to learn how to use it.

public void SetScissorRectangles(int scissorCount, Rectangle[] scissorRectangles)

Parameters

scissorCount int

The number of scissor rectangles to bind.

scissorRectangles Rectangle[]

The set of scissor rectangles to bind.

SetStencilReference(int)

public void SetStencilReference(int stencilReference)

Parameters

stencilReference int

SetStreamTargets(params Buffer[])

Sets the stream targets.

public void SetStreamTargets(params Buffer[] buffers)

Parameters

buffers Buffer[]

The buffers.

SetVertexBuffer(int, Buffer, int, int)

public void SetVertexBuffer(int index, Buffer buffer, int offset, int stride)

Parameters

index int
buffer Buffer
offset int
stride int

SetViewport(Viewport)

Sets a viewport.

public void SetViewport(Viewport value)

Parameters

value Viewport

SetViewports(Viewport[])

Sets the viewports.

public void SetViewports(Viewport[] values)

Parameters

values Viewport[]

SetViewports(int, Viewport[])

Sets the viewports.

public void SetViewports(int viewportCount, Viewport[] values)

Parameters

viewportCount int
values Viewport[]

UnmapSubresource(MappedResource)

public void UnmapSubresource(MappedResource unmapped)

Parameters

unmapped MappedResource

UnsetRenderTargets()

Unsets the render targets.

public void UnsetRenderTargets()

WriteTimestamp(QueryPool, int)

Submits a GPU timestamp query.

public void WriteTimestamp(QueryPool queryPool, int index)

Parameters

queryPool QueryPool

The QueryPool owning the query.

index int

The query index.