Table of Contents

Class CommandList

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Represents a list of graphics commands for playback, which can include resource binding, primitive-based rendering, etc.

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

Fields

MaxRenderTargetCount

The maximum number of Render Targets that can be bound simultaneously by Stride.

public const int MaxRenderTargetCount = 8

Field Value

int

MaxViewportAndScissorRectangleCount

The maximum number of Viewports or Scissor Rectangles that can be set simultaneously by Stride.

public const int MaxViewportAndScissorRectangleCount = 16

Field Value

int

Properties

DepthStencilBuffer

Gets the Depth-Stencil Buffer (Z-Buffer) currently bound to the pipeline.

public Texture DepthStencilBuffer { get; }

Property Value

Texture

Remarks

RenderTarget

Gets the first Render Target currently bound to the pipeline.

public Texture RenderTarget { get; }

Property Value

Texture

Remarks

RenderTargetCount

Gets the number of Render Targets currently bound to the pipeline.

public int RenderTargetCount { get; }

Property Value

int

RenderTargets

Gets the set of Render Targets currently bound to the pipeline.

public ReadOnlySpan<Texture> RenderTargets { get; }

Property Value

ReadOnlySpan<Texture>

Remarks

Scissor

Gets the first scissor rectangle bound to the rasterizer stage of the pipeline.

public Rectangle Scissor { get; }

Property Value

Rectangle

Remarks

To set the scissor rectangles, use one of the SetScissorRectangle(in Rectangle) or SetScissorRectangles(params ReadOnlySpan<Rectangle>) methods.

ScissorCount

Gets the number of scissor rectangles currently bound to the rasterizer stage of the pipeline.

public int ScissorCount { get; }

Property Value

int

Scissors

Gets scissor rectangles currently bound to the rasterizer stage of the pipeline.

public ReadOnlySpan<Rectangle> Scissors { get; }

Property Value

ReadOnlySpan<Rectangle>

Remarks

To set the scissor rectangles, use one of the SetScissorRectangle(in Rectangle) or SetScissorRectangles(params ReadOnlySpan<Rectangle>) methods.

Viewport

Gets the first viewport bound to the rasterizer stage of the pipeline.

public Viewport Viewport { get; }

Property Value

Viewport

Remarks

ViewportCount

Gets the number of viewports currently bound to the rasterizer stage of the pipeline.

public int ViewportCount { get; }

Property Value

int

Viewports

Gets the viewports currently bound to the rasterizer stage of the pipeline.

public ReadOnlySpan<Viewport> Viewports { get; }

Property Value

ReadOnlySpan<Viewport>

Remarks

Methods

BeginProfile(Color4, string)

Marks the beginning of a profile section.

public void BeginProfile(Color4 profileColor, string name)

Parameters

profileColor Color4

A color that a profiling tool can use to display the event.

name string

A descriptive name for the profile section.

Remarks

Each call to BeginProfile(Color4, string) must be matched with a corresponding call to EndProfile(), which defines a region of code that can be identified with a name and possibly a color in a compatible profiling tool.

A pair of calls to BeginProfile(Color4, string) and EndProfile() can be nested inside a call to BeginProfile(Color4, string) and EndProfile() in an upper level in the call stack. This allows to form a hierarchy of profile sections.

Clear(Texture, Color4)

Clears the specified Render Target.

public void Clear(Texture renderTarget, Color4 color)

Parameters

renderTarget Texture

The Render Target to clear.

color Color4

The color to use to clear the Render Target.

Exceptions

ArgumentNullException

renderTarget is null.

Clear(Texture, DepthStencilClearOptions, float, byte)

Clears the specified Depth-Stencil Buffer.

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

Parameters

depthStencilBuffer Texture

The Depth-Stencil Buffer to clear.

options DepthStencilClearOptions

A combination of DepthStencilClearOptions flags identifying what parts of the Depth-Stencil Buffer to clear.

depth float

The depth value to use for clearing the Depth Buffer.

stencil byte

The stencil value to use for clearing the Stencil Buffer.

Exceptions

ArgumentNullException

depthStencilBuffer is null.

InvalidOperationException

Cannot clear a Stencil Buffer without a Stencil Buffer format.

ClearReadWrite(Buffer, Int4)

Clears a Read-Write Buffer.

public void ClearReadWrite(Buffer buffer, Int4 value)

Parameters

buffer Buffer

The Buffer to clear. It must have been created with read-write / unordered access flags.

value Int4

The value to use to clear the Buffer.

Exceptions

ArgumentNullException

buffer is null.

ArgumentException

buffer must support Unordered Access.

ClearReadWrite(Buffer, UInt4)

Clears a Read-Write Buffer.

public void ClearReadWrite(Buffer buffer, UInt4 value)

Parameters

buffer Buffer

The Buffer to clear. It must have been created with read-write / unordered access flags.

value UInt4

The value to use to clear the Buffer.

Exceptions

ArgumentNullException

buffer is null.

ArgumentException

buffer must support Unordered Access.

ClearReadWrite(Buffer, Vector4)

Clears a Read-Write Buffer.

public void ClearReadWrite(Buffer buffer, Vector4 value)

Parameters

buffer Buffer

The Buffer to clear. It must have been created with read-write / unordered access flags.

value Vector4

The value to use to clear the Buffer.

Exceptions

ArgumentNullException

buffer is null.

ArgumentException

buffer must support Unordered Access.

ClearReadWrite(Texture, Int4)

Clears a Read-Write Texture.

public void ClearReadWrite(Texture texture, Int4 value)

Parameters

texture Texture

The Texture to clear. It must have been created with read-write / unordered access flags.

value Int4

The value to use to clear the Texture.

Exceptions

ArgumentNullException

texture is null.

ArgumentException

texture must support Unordered Access.

ClearReadWrite(Texture, UInt4)

Clears a Read-Write Texture.

public void ClearReadWrite(Texture texture, UInt4 value)

Parameters

texture Texture

The Texture to clear. It must have been created with read-write / unordered access flags.

value UInt4

The value to use to clear the Texture.

Exceptions

ArgumentNullException

texture is null.

ArgumentException

texture must support Unordered Access.

ClearReadWrite(Texture, Vector4)

Clears a Read-Write Texture.

public void ClearReadWrite(Texture texture, Vector4 value)

Parameters

texture Texture

The Texture to clear. It must have been created with read-write / unordered access flags.

value Vector4

The value to use to clear the Texture.

Exceptions

ArgumentNullException

texture is null.

ArgumentException

texture must support Unordered Access.

ClearState()

Clears and restores the state of the Graphics Device.

public void ClearState()

Close()

Indicates that recording to the Command List has finished.

public CompiledCommandList Close()

Returns

CompiledCommandList

A CompiledCommandList representing the frozen list of recorded commands that can be executed at a later time.

Remarks

Compiled Command Lists are not supported for Direct3D 11. This method returns a default empty one.

Copy(GraphicsResource, GraphicsResource)

Copies the data from a Graphics Resource to another. Views are ignored and the full underlying data is copied.

public void Copy(GraphicsResource source, GraphicsResource destination)

Parameters

source GraphicsResource

The source Graphics Resource.

destination GraphicsResource

The destination Graphics Resource.

Exceptions

ArgumentNullException

source is null.

ArgumentNullException

destination is null.

CopyCount(Buffer, Buffer, int)

Copies data from a Buffer holding variable length data to another Buffer.

public void CopyCount(Buffer sourceBuffer, Buffer destinationBuffer, int destinationOffsetInBytes)

Parameters

sourceBuffer Buffer

A Structured Buffer created with either StructuredAppendBuffer or StructuredCounterBuffer. These types of resources have hidden counters tracking "how many" records have been written.

destinationBuffer Buffer

A Buffer resource to copy the data to. Any Buffer that other copy commands, such as Copy(GraphicsResource, GraphicsResource) or CopyRegion(GraphicsResource, int, ResourceRegion?, GraphicsResource, int, int, int, int), are able to write to.

destinationOffsetInBytes int

The offset in bytes from the start of destinationBuffer to write 32-bit uint structure (vertex) count from sourceBuffer. The offset must be aligned to 4 bytes.

Exceptions

ArgumentNullException

sourceBuffer is null.

ArgumentNullException

destinationBuffer is null.

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

Copies the data from a multi-sampled Texture (which is resolved) to another Texture.

public void CopyMultisample(Texture sourceMultiSampledTexture, int sourceSubResourceIndex, Texture destinationTexture, int destinationSubResourceIndex, PixelFormat format = PixelFormat.None)

Parameters

sourceMultiSampledTexture Texture

The source multi-sampled Texture.

sourceSubResourceIndex int

The sub-resource index of the source Texture.

destinationTexture Texture

The destination Texture.

destinationSubResourceIndex int

The sub-resource index of the destination Texture.

format PixelFormat

A PixelFormat that indicates how the multi-sampled Texture will be resolved to a single-sampled resource.

Remarks

The sourceMultiSampledTexture and destinationTexture must have the same dimensions. In addition, they must have compatible formats. There are three scenarios for this:

ScenarioRequirements
Source and destination are prestructured and typed Both the source and destination must have identical formats and that format must be specified in the format parameter.
One resource is prestructured and typed and the other is prestructured and typeless The typed resource must have a format that is compatible with the typeless resource (i.e. the typed resource is R32_Float and the typeless resource is R32_Typeless). The format of the typed resource must be specified in the format parameter.
Source and destination are prestructured and typeless

Both the source and destination must have the same typeless format (i.e. both must have R32_Typeless), and the format parameter must specify a format that is compatible with the source and destination (i.e. if both are R32_Typeless then R32_Float could be specified in the format parameter).

For example, given the R16G16B16A16_Typeless format:

   <ul><li>The source (or destination) format could be <xref href="Stride.Graphics.PixelFormat.R16G16B16A16_UNorm" data-throw-if-not-resolved="false"></xref>.</li><li>The destination (or source) format could be <xref href="Stride.Graphics.PixelFormat.R16G16B16A16_Float" data-throw-if-not-resolved="false"></xref>.</li></ul>
 </p>

Exceptions

ArgumentException

sourceMultiSampledTexture is not a multi-sampled Texture.

ArgumentNullException

sourceMultiSampledTexture is null.

ArgumentNullException

destinationTexture is null.

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

Copies a region from a source Graphics Resource to a destination Graphics Resource.

public void CopyRegion(GraphicsResource source, int sourceSubResourceIndex, ResourceRegion? sourceRegion, GraphicsResource destination, int destinationSubResourceIndex, int dstX = 0, int dstY = 0, int dstZ = 0)

Parameters

source GraphicsResource

The source Graphics Resource to copy from.

sourceSubResourceIndex int

The index of the sub-resource of source to copy from.

sourceRegion ResourceRegion?

An optional ResourceRegion that defines the source sub-resource to copy from. Specify null the entire source sub-resource is copied.

An empty region makes this method to not perform a copy operation. It is considered empty if the top value is greater than or equal to the bottom value, or the left value is greater than or equal to the right value, or the front value is greater than or equal to the back value.

destination GraphicsResource

The destination Graphics Resource to copy to.

destinationSubResourceIndex int

The index of the sub-resource of destination to copy to.

dstX int

The X-coordinate of the upper left corner of the destination region.

dstY int

The Y-coordinate of the upper left corner of the destination region. For a 1D sub-resource, this must be zero.

dstZ int

The Z-coordinate of the upper left corner of the destination region. For a 1D or 2D sub-resource, this must be zero.

Remarks

The sourceRegion must be within the size of the source resource. The destination offsets, (dstX, dstY, and dstZ), allow the source region to be offset when writing into the destination resource; however, the dimensions of the source region and the offsets must be within the size of the resource.

If the resources are Buffers, all coordinates are in bytes; if the resources are Textures, all coordinates are in texels.

CopyRegion(GraphicsResource, int, ResourceRegion?, GraphicsResource, int, int, int, int) performs the copy on the GPU (similar to a memcpy by the CPU). As a consequence, the source and destination resources:

CopyRegion(GraphicsResource, int, ResourceRegion?, GraphicsResource, int, int, int, int) only supports copy; it doesn't support any stretch, color key, or blend.

Exceptions

ArgumentNullException

source is null.

ArgumentNullException

destination is null.

Dispatch(Buffer, int)

Dispatches a Compute Shader workload using an Indirect Buffer, allowing the thread group count to be determined at runtime.

public void Dispatch(Buffer indirectBuffer, int offsetInBytes)

Parameters

indirectBuffer Buffer

A Buffer containing the dispatch parameters, structured as (threadCountX, threadCountY, threadCountZ).

offsetInBytes int

The byte offset within the indirectBuffer where the dispatch parameters are located.

Exceptions

ArgumentNullException

indirectBuffer is null.

Dispatch(int, int, int)

Dispatches a Compute Shader workload with the specified number of thread groups in each dimension.

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

Parameters

threadCountX int

Number of thread groups in the X dimension.

threadCountY int

Number of thread groups in the Y dimension.

threadCountZ int

Number of thread groups in the Z dimension.

Draw(int, int)

Issues a non-indexed draw call, rendering a sequence of vertices directly from the bound Vertex Buffer.

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

Parameters

vertexCount int

The number of vertices to draw.

startVertexLocation int

Index of the first vertex in the Vertex Buffer to begin rendering from; it could also be used as the first vertex id generated for a shader parameter marked with the SV_TargetId system-value semantic.

DrawAuto()

Issues a draw call for geometry of unknown size, typically used with Vertex or Index Buffers populated via Stream Output. The vertex count is inferred from the data written by the GPU.

public void DrawAuto()

DrawIndexed(int, int, int)

Issues an indexed non-instanced draw call using the currently bound Index Buffer.

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)

Issues an indexed instanced draw call using an Indirect Arguments Buffer, allowing parameters to be determined at runtime.

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

Parameters

argumentsBuffer Buffer

A Buffer containing the draw parameters (index count, instance count, etc.).

alignedByteOffsetForArgs int

Byte offset within the argumentsBuffer where the draw arguments are located.

Exceptions

ArgumentNullException

argumentsBuffer is null.

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

Issues an indexed instanced draw call, rendering multiple instances of indexed geometry.

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)

Issues a non-indexed instanced draw call using an Indirect Arguments Buffer, allowing parameters to be determined at runtime.

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

Parameters

argumentsBuffer Buffer

A Buffer containing the draw parameters (vertex count, instance count, etc.).

alignedByteOffsetForArgs int

Byte offset within the argumentsBuffer where the draw arguments are located.

Exceptions

ArgumentNullException

argumentsBuffer is null.

DrawInstanced(int, int, int, int)

Issues a non-indexed instanced draw call, rendering multiple instances of geometry using a Vertex Buffer.

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

Parameters

vertexCountPerInstance int

The number of vertices to draw per instance.

instanceCount int

The number of instances to draw.

startVertexLocation int

The index of the first vertex in the Vertex Buffer.

startInstanceLocation int

A value added to each index before reading per-instance data from a Vertex Buffer.

EndProfile()

Marks the end of a profile section previously started by a call to BeginProfile(Color4, string).

public void EndProfile()

Remarks

Each call to BeginProfile(Color4, string) must be matched with a corresponding call to EndProfile(), which defines a region of code that can be identified with a name and possibly a color in a compatible profiling tool.

A pair of calls to BeginProfile(Color4, string) and EndProfile() can be nested inside a call to BeginProfile(Color4, string) and EndProfile() in an upper level in the call stack. This allows to form a hierarchy of profile sections.

Flush()

Closes and executes the Command List.

public void Flush()

MapSubResource(GraphicsResource, int, MapMode, bool, int, int)

Maps a sub-resource of a Graphics Resource to be accessible from CPU memory, and in the process denies the GPU access to that sub-resource.

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

Parameters

resource GraphicsResource

The Graphics Resource to map to CPU memory.

subResourceIndex int

The index of the sub-resource to get access to.

mapMode MapMode

A value of MapMode indicating the way the Graphics Resource should be mapped to CPU memory.

doNotWait bool

A value indicating if this method will return immediately if the Graphics Resource is still being used by the GPU for writing true. The default value is false, which means the method will wait until the GPU is done.

offsetInBytes int

The offset in bytes from the beginning of the mapped memory of the sub-resource. Defaults to 0, which means it is mapped from the beginning.

lengthInBytes int

The length in bytes of the memory to map from the sub-resource. Defaults to 0, which means the entire sub-resource is mapped.

Returns

MappedResource

A MappedResource structure pointing to the GPU resource mapped for CPU access.

Remarks

For Buffers:

Usage Instructions:

Restrictions:

For Textures:

Usage Instructions:

Restrictions:

  • Not all PixelFormats are compatible with mapping operations.
  • Concurrent access to a Texture both from the CPU and the GPU may not be allowed and might require careful synchronization.
  • Ensure that the Texture data is properly aligned to meet the requirements of your graphics API and the Format.

For State Objects (like PipelineState, SamplerState, etc):

Restrictions:

  • State Objects are not usually mapped nor directly updated. They are created with specific configurations and are treated as immutable from now on. Instead, if you need changes, you can create a new State Object with the updated settings.

After updating the resource, call UnmapSubResource(MappedResource) to release the CPU pointer and allow the GPU to access the updated data.

Exceptions

ArgumentNullException

resource is null.

New(GraphicsDevice)

Creates a new CommandList.

public static CommandList New(GraphicsDevice device)

Parameters

device GraphicsDevice

The Graphics Device.

Returns

CommandList

The new instance of CommandList.

Exceptions

InvalidOperationException

Creation of additional Command Lists is not supported for Direct3D 11.

OnDestroyed(bool)

Called when the GraphicsDevice has been detected to be internally destroyed, or when the Destroy() methad has been called. Raises the Destroyed event.

protected override void OnDestroyed(bool immediately = false)

Parameters

immediately bool

A value indicating whether the resource should be destroyed immediately (true), or if it can be deferred until it's safe to do so (false).

Remarks

This method releases the underlying native resources (Silk.NET.Direct3D11.ID3D11Resource and Silk.NET.Direct3D11.ID3D11DeviceChild).

Reset()

Resets a Command List back to its initial state as if a new Command List was just created.

public void Reset()

Remarks

Deferred execution of Command Lists is not supported for Direct3D 11. This method does nothing.

ResetTargets()

Unbinds all the Render Targets and the Depth-Stencil Buffer from the output-merger stage.

public void ResetTargets()

ResourceBarrierTransition(GraphicsResource, GraphicsResourceState)

Inserts a barrier that transitions a Graphics Resource to a new state, ensuring proper synchronization between different GPU operations accessing the resource.

public void ResourceBarrierTransition(GraphicsResource resource, GraphicsResourceState newState)

Parameters

resource GraphicsResource

The Graphics Resource to transition to a different state.

newState GraphicsResourceState

The new state of resource.

Remarks

The Direct3D 11 implementation does not have synchronization barriers for Graphics Resource transitions.

SetBlendFactor(Color4)

Sets the blend factors for blending each of the RGBA components.

public void SetBlendFactor(Color4 blendFactor)

Parameters

blendFactor Color4

A Color4 representing the blend factors for each RGBA component. The blend factors modulate values for the pixel Shader, Render Target, or both.

If you have configured the Blend-State object with BlendFactor or InverseBlendFactor, the blending stage uses the blend factors specified by blendFactor. Otherwise, the blend factors will not be taken into account for the blend stage.

See Also

SetDescriptorSets(int, DescriptorSet[])

Binds an array of Descriptor Sets at the specified index in the current pipeline's Root Signature, making shader resources available for rendering operations.

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

Parameters

index int

The starting slot where the Descriptor Sets will be bound. This is not used in the Direct3D 11 implementation.

descriptorSets DescriptorSet[]

An array of Descriptor Sets containing resource bindings (such as Textures, Samplers, and Constant Buffers) to be used by the currently active Pipeline State.

SetIndexBuffer(Buffer, int, bool)

Sets the Index Buffer for the input assembler stage of the pipeline.

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

Parameters

buffer Buffer

The Index Buffer to set. It must have been created with IndexBuffer.

offset int

Offset (in bytes) from the start of the Index Buffer to the first index to use.

is32bits bool

A value indicating if the Index Buffer elements are 32-bit indices (true), or 16-bit (false).

SetPipelineState(PipelineState)

Sets the configuration of the graphics pipeline which, among other things, control the shaders, input layout, render states, and output settings.

public void SetPipelineState(PipelineState pipelineState)

Parameters

pipelineState PipelineState

The Pipeline State object to set. Specify null to use the default one.

See Also

SetRenderTarget(Texture, Texture)

Binds a Depth-Stencil Buffer and a single Render Target to the output-merger stage.

public void SetRenderTarget(Texture depthStencilView, Texture renderTargetView)

Parameters

depthStencilView Texture

A view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.

renderTargetView Texture

A view of the Render Target to bind. Specify null to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

SetRenderTargetAndViewport(Texture, Texture)

Binds a Depth-Stencil Buffer and a single Render Target to the output-merger stage, setting also the viewport according to their dimensions.

public void SetRenderTargetAndViewport(Texture depthStencilView, Texture renderTargetView)

Parameters

depthStencilView Texture

A view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.

renderTargetView Texture

A view of the Render Target to bind. Specify null to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

SetRenderTargets(Texture, params ReadOnlySpan<Texture>)

Binds a Depth-Stencil Buffer and one or more Render Targets atomically to the output-merger stage.

public void SetRenderTargets(Texture depthStencilView, params ReadOnlySpan<Texture> renderTargetViews)

Parameters

depthStencilView Texture

A view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.

renderTargetViews ReadOnlySpan<Texture>

A set of Render Targets to bind. Specify an empty collection to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

Exceptions

ArgumentOutOfRangeException

renderTargetViews contains too many Render Targets to set.

SetRenderTargets(ReadOnlySpan<Texture>)

Binds one or more Render Targets atomically to the output-merger stage, and unbinds any Depth-Stencil Buffer.

public void SetRenderTargets(ReadOnlySpan<Texture> renderTargetViews)

Parameters

renderTargetViews ReadOnlySpan<Texture>

A set of Render Targets to bind. Specify an empty collection to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

Exceptions

ArgumentOutOfRangeException

renderTargetViews contains too many Render Targets to set.

SetRenderTargetsAndViewport(Texture, params ReadOnlySpan<Texture>)

Binds a Depth-Stencil Buffer and one or more Render Targets atomically to the output-merger stage, setting also the viewport according to their dimensions.

public void SetRenderTargetsAndViewport(Texture depthStencilView, params ReadOnlySpan<Texture> renderTargetViews)

Parameters

depthStencilView Texture

A view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.

renderTargetViews ReadOnlySpan<Texture>

A set of Render Targets to bind. Specify an empty collection to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

Exceptions

ArgumentOutOfRangeException

renderTargetViews contains too many Render Targets to set.

SetRenderTargetsAndViewport(ReadOnlySpan<Texture>)

Binds one or more Render Targets atomically to the output-merger stage, setting also the viewport according to their dimensions. Also unbinds the current Depth-Stencil Buffer.

public void SetRenderTargetsAndViewport(ReadOnlySpan<Texture> renderTargetViews)

Parameters

renderTargetViews ReadOnlySpan<Texture>

A set of Render Targets to bind. Specify an empty collection to unbind the currently bound Render Targets.

Remarks

See Use a Render Target in the manual for more information.

Exceptions

ArgumentOutOfRangeException

renderTargetViews contains too many Render Targets to set.

SetScissorRectangle(in Rectangle)

Binds a single scissor rectangle to the rasterizer stage.

public void SetScissorRectangle(in Rectangle rectangle)

Parameters

rectangle Rectangle

The scissor rectangle to set.

Remarks

See Set the scissor in the manual for more information.

SetScissorRectangles(params ReadOnlySpan<Rectangle>)

Binds a set of scissor rectangles to the rasterizer stage.

public void SetScissorRectangles(params ReadOnlySpan<Rectangle> scissorRectangles)

Parameters

scissorRectangles ReadOnlySpan<Rectangle>

The set of scissor rectangles to bind.

Remarks

See Set the scissor in the manual for more information.

Exceptions

ArgumentOutOfRangeException

scissorRectangles contains too many scissor rectangles to set.

SetStencilReference(int)

Sets the reference value for Depth-Stencil tests.

public void SetStencilReference(int stencilReference)

Parameters

stencilReference int

Reference value to perform against when doing a Depth-Stencil test.

See Also

SetStreamTargets(params ReadOnlySpan<Buffer>)

Sets the stream output Buffers.

public void SetStreamTargets(params ReadOnlySpan<Buffer> buffers)

Parameters

buffers ReadOnlySpan<Buffer>

The Buffers to set for stream output. Specify null or an empty array to unset any bound output Buffer.

SetVertexBuffer(int, Buffer, int, int)

Sets a Vertex Buffer for the input assembler stage of the pipeline.

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

Parameters

index int

The input slot for binding the Vertex Buffer; The maximum number of input slots available depends on platform and graphics profile, usually 16 or 32.

buffer Buffer

The Vertex Buffer to set. It must have been created with VertexBuffer.

offset int

The number of bytes between the first element of the Vertex Buffer and the first element that will be used.

stride int

The size (in bytes) of the elements that are to be used from the Vertex Buffer.

SetViewport(in Viewport)

Binds a single viewport to the rasterizer stage of the pipeline.

public void SetViewport(in Viewport viewport)

Parameters

viewport Viewport

SetViewports(params ReadOnlySpan<Viewport>)

Binds an array of viewports to the rasterizer stage of the pipeline.

public void SetViewports(params ReadOnlySpan<Viewport> viewports)

Parameters

viewports ReadOnlySpan<Viewport>

The viewports to set.

Exceptions

ArgumentOutOfRangeException

viewports contains too many viewports to set.

UnmapSubResource(MappedResource)

Unmaps a sub-resource of a Graphics Resource, which was previously mapped to CPU memory with MapSubResource(GraphicsResource, int, MapMode, bool, int, int), and in the process re-enables the GPU access to that sub-resource.

public void UnmapSubResource(MappedResource mappedResource)

Parameters

mappedResource MappedResource

A MappedResource structure identifying the sub-resource to unmap.

UnsetRenderTargets()

Unsets the Render Targets currently bound to the pipeline.

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 index of the Query to write.