Class CommandList
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
-
objectCommandList
- 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
MaxViewportAndScissorRectangleCount
The maximum number of Viewports or Scissor Rectangles that can be set simultaneously by Stride.
public const int MaxViewportAndScissorRectangleCount = 16
Field Value
Properties
DepthStencilBuffer
Gets the Depth-Stencil Buffer (Z-Buffer) currently bound to the pipeline.
public Texture DepthStencilBuffer { get; }
Property Value
Remarks
To set the Depth-Stencil Buffer, use one of the SetRenderTargetAndViewport(Texture, Texture), or SetRenderTargetsAndViewport(ReadOnlySpan<Texture>), or SetRenderTargets(ReadOnlySpan<Texture>) methods.
RenderTarget
Gets the first Render Target currently bound to the pipeline.
public Texture RenderTarget { get; }
Property Value
Remarks
To set Render Targets, use one of the SetRenderTargetAndViewport(Texture, Texture), or SetRenderTargetsAndViewport(ReadOnlySpan<Texture>), or SetRenderTargets(ReadOnlySpan<Texture>) methods.
RenderTargetCount
Gets the number of Render Targets currently bound to the pipeline.
public int RenderTargetCount { get; }
Property Value
RenderTargets
Gets the set of Render Targets currently bound to the pipeline.
public ReadOnlySpan<Texture> RenderTargets { get; }
Property Value
Remarks
To set Render Targets, use one of the SetRenderTargetAndViewport(Texture, Texture), or SetRenderTargetsAndViewport(ReadOnlySpan<Texture>), or SetRenderTargets(ReadOnlySpan<Texture>) methods.
Scissor
Gets the first scissor rectangle bound to the rasterizer stage of the pipeline.
public Rectangle Scissor { get; }
Property Value
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
Scissors
Gets scissor rectangles currently bound to the rasterizer stage of the pipeline.
public ReadOnlySpan<Rectangle> Scissors { get; }
Property Value
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
Remarks
To set the viewport, use one of the SetViewport(in Viewport) or SetViewports(params ReadOnlySpan<Viewport>) methods, or the SetRenderTargetAndViewport(Texture, Texture), or SetRenderTargetsAndViewport(ReadOnlySpan<Texture>) methods.
ViewportCount
Gets the number of viewports currently bound to the rasterizer stage of the pipeline.
public int ViewportCount { get; }
Property Value
Viewports
Gets the viewports currently bound to the rasterizer stage of the pipeline.
public ReadOnlySpan<Viewport> Viewports { get; }
Property Value
Remarks
To set the viewport, use one of the SetViewport(in Viewport) or SetViewports(params ReadOnlySpan<Viewport>) methods, or the SetRenderTargetAndViewport(Texture, Texture), or SetRenderTargetsAndViewport(ReadOnlySpan<Texture>) methods.
Methods
BeginProfile(Color4, string)
Marks the beginning of a profile section.
public void BeginProfile(Color4 profileColor, string name)
Parameters
profileColorColor4A color that a profiling tool can use to display the event.
namestringA 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
renderTargetTextureThe Render Target to clear.
colorColor4The color to use to clear the Render Target.
Exceptions
- ArgumentNullException
renderTargetis 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
depthStencilBufferTextureThe Depth-Stencil Buffer to clear.
optionsDepthStencilClearOptionsA combination of DepthStencilClearOptions flags identifying what parts of the Depth-Stencil Buffer to clear.
depthfloatThe depth value to use for clearing the Depth Buffer.
stencilbyteThe stencil value to use for clearing the Stencil Buffer.
Exceptions
- ArgumentNullException
depthStencilBufferis 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
bufferBufferThe Buffer to clear. It must have been created with read-write / unordered access flags.
valueInt4The value to use to clear the Buffer.
Exceptions
- ArgumentNullException
bufferis null.- ArgumentException
buffermust support Unordered Access.
ClearReadWrite(Buffer, UInt4)
Clears a Read-Write Buffer.
public void ClearReadWrite(Buffer buffer, UInt4 value)
Parameters
bufferBufferThe Buffer to clear. It must have been created with read-write / unordered access flags.
valueUInt4The value to use to clear the Buffer.
Exceptions
- ArgumentNullException
bufferis null.- ArgumentException
buffermust support Unordered Access.
ClearReadWrite(Buffer, Vector4)
Clears a Read-Write Buffer.
public void ClearReadWrite(Buffer buffer, Vector4 value)
Parameters
bufferBufferThe Buffer to clear. It must have been created with read-write / unordered access flags.
valueVector4The value to use to clear the Buffer.
Exceptions
- ArgumentNullException
bufferis null.- ArgumentException
buffermust support Unordered Access.
ClearReadWrite(Texture, Int4)
Clears a Read-Write Texture.
public void ClearReadWrite(Texture texture, Int4 value)
Parameters
textureTextureThe Texture to clear. It must have been created with read-write / unordered access flags.
valueInt4The value to use to clear the Texture.
Exceptions
- ArgumentNullException
textureis null.- ArgumentException
texturemust support Unordered Access.
ClearReadWrite(Texture, UInt4)
Clears a Read-Write Texture.
public void ClearReadWrite(Texture texture, UInt4 value)
Parameters
textureTextureThe Texture to clear. It must have been created with read-write / unordered access flags.
valueUInt4The value to use to clear the Texture.
Exceptions
- ArgumentNullException
textureis null.- ArgumentException
texturemust support Unordered Access.
ClearReadWrite(Texture, Vector4)
Clears a Read-Write Texture.
public void ClearReadWrite(Texture texture, Vector4 value)
Parameters
textureTextureThe Texture to clear. It must have been created with read-write / unordered access flags.
valueVector4The value to use to clear the Texture.
Exceptions
- ArgumentNullException
textureis null.- ArgumentException
texturemust 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
sourceGraphicsResourceThe source Graphics Resource.
destinationGraphicsResourceThe destination Graphics Resource.
Exceptions
- ArgumentNullException
sourceis null.- ArgumentNullException
destinationis 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
sourceBufferBufferA Structured Buffer created with either StructuredAppendBuffer or StructuredCounterBuffer. These types of resources have hidden counters tracking "how many" records have been written.
destinationBufferBufferA 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.
destinationOffsetInBytesintThe offset in bytes from the start of
destinationBufferto write 32-bit uint structure (vertex) count fromsourceBuffer. The offset must be aligned to 4 bytes.
Exceptions
- ArgumentNullException
sourceBufferis null.- ArgumentNullException
destinationBufferis 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
sourceMultiSampledTextureTextureThe source multi-sampled Texture.
sourceSubResourceIndexintThe sub-resource index of the source Texture.
destinationTextureTextureThe destination Texture.
destinationSubResourceIndexintThe sub-resource index of the destination Texture.
formatPixelFormatA 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:
| Scenario | Requirements |
|---|---|
| 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
For example, given the R16G16B16A16_Typeless format:
|
Exceptions
- ArgumentException
sourceMultiSampledTextureis not a multi-sampled Texture.- ArgumentNullException
sourceMultiSampledTextureis null.- ArgumentNullException
destinationTextureis 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
sourceGraphicsResourceThe source Graphics Resource to copy from.
sourceSubResourceIndexintThe index of the sub-resource of
sourceto copy from.sourceRegionResourceRegion?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.
destinationGraphicsResourceThe destination Graphics Resource to copy to.
destinationSubResourceIndexintThe index of the sub-resource of
destinationto copy to.dstXintThe X-coordinate of the upper left corner of the destination region.
dstYintThe Y-coordinate of the upper left corner of the destination region. For a 1D sub-resource, this must be zero.
dstZintThe 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:
- Must be different sub-resources (although they can be from the same Graphics Resource).
- Must be the same type.
- Must have compatible formats (identical or from the same type group). For example, a R32G32B32_Float Texture can be copied to a R32G32B32_UInt Texture since both of these formats are in the R32G32B32_Typeless group.
- May not be currently mapped with MapSubResource(GraphicsResource, int, MapMode, bool, int, int).
CopyRegion(GraphicsResource, int, ResourceRegion?, GraphicsResource, int, int, int, int) only supports copy; it doesn't support any stretch, color key, or blend.
Exceptions
- ArgumentNullException
sourceis null.- ArgumentNullException
destinationis 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
indirectBufferBufferA Buffer containing the dispatch parameters, structured as
(threadCountX, threadCountY, threadCountZ).offsetInBytesintThe byte offset within the
indirectBufferwhere the dispatch parameters are located.
Exceptions
- ArgumentNullException
indirectBufferis 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
threadCountXintNumber of thread groups in the X dimension.
threadCountYintNumber of thread groups in the Y dimension.
threadCountZintNumber 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
vertexCountintThe number of vertices to draw.
startVertexLocationintIndex 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_TargetIdsystem-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
indexCountintNumber of indices to draw.
startIndexLocationintThe location of the first index read by the GPU from the Index Buffer.
baseVertexLocationintA 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
argumentsBufferBufferA Buffer containing the draw parameters (index count, instance count, etc.).
alignedByteOffsetForArgsintByte offset within the
argumentsBufferwhere the draw arguments are located.
Exceptions
- ArgumentNullException
argumentsBufferis 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
indexCountPerInstanceintNumber of indices read from the Index Buffer for each instance.
instanceCountintNumber of instances to draw.
startIndexLocationintThe location of the first index read by the GPU from the Index Buffer.
baseVertexLocationintA value added to each index before reading a vertex from the Vertex Buffer.
startInstanceLocationintA 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
argumentsBufferBufferA Buffer containing the draw parameters (vertex count, instance count, etc.).
alignedByteOffsetForArgsintByte offset within the
argumentsBufferwhere the draw arguments are located.
Exceptions
- ArgumentNullException
argumentsBufferis 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
vertexCountPerInstanceintThe number of vertices to draw per instance.
instanceCountintThe number of instances to draw.
startVertexLocationintThe index of the first vertex in the Vertex Buffer.
startInstanceLocationintA 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
resourceGraphicsResourceThe Graphics Resource to map to CPU memory.
subResourceIndexintThe index of the sub-resource to get access to.
mapModeMapModeA value of MapMode indicating the way the Graphics Resource should be mapped to CPU memory.
doNotWaitboolA 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.
offsetInBytesintThe 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.
lengthInBytesintThe 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:
-
Ensure the
resourcewas created with the correct usage. For example, you should specify Dynamic if you plan to update its contents frequently. - This method can be called multiple times, and nested calls are supported.
- Use appropriate MapMode values when calling MapSubResource(GraphicsResource, int, MapMode, bool, int, int). For example, WriteDiscard indicates that the old data in the Buffer can be discarded.
Restrictions:
- The MappedResource returned by MapSubResource(GraphicsResource, int, MapMode, bool, int, int) is not guaranteed to be consistent across different calls. Applications should not rely on the address being the same unless MapSubResource(GraphicsResource, int, MapMode, bool, int, int) is persistently nested.
- MapSubResource(GraphicsResource, int, MapMode, bool, int, int) may invalidate the CPU cache to ensure that CPU reads reflect any modifications made by the GPU.
- If your graphics API supports them, use fences for synchronization to ensure proper coordination between the CPU and GPU.
- Ensure that the Buffer data is properly aligned to meet the requirements of your graphics API.
- Stick to simple usage models (e.g., Dynamic for upload, Default, Staging for readback) unless advanced models are necessary for your application.
For Textures:
Usage Instructions:
- Ensure to use the correct data format when writing data to the Texture.
- Textures can have multiple mipmap levels. You must specify which level you want to map with
subResourceIndex. - Use appropriate MapMode values when calling MapSubResource(GraphicsResource, int, MapMode, bool, int, int). For example, WriteDiscard is usually used to update dynamic Textures.
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
resourceis null.
New(GraphicsDevice)
Creates a new CommandList.
public static CommandList New(GraphicsDevice device)
Parameters
deviceGraphicsDeviceThe 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
immediatelyboolA 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
resourceGraphicsResourceThe Graphics Resource to transition to a different state.
newStateGraphicsResourceStateThe 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
blendFactorColor4A 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
indexintThe starting slot where the Descriptor Sets will be bound. This is not used in the Direct3D 11 implementation.
descriptorSetsDescriptorSet[]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
bufferBufferThe Index Buffer to set. It must have been created with IndexBuffer.
offsetintOffset (in bytes) from the start of the Index Buffer to the first index to use.
is32bitsboolA 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
pipelineStatePipelineStateThe 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
depthStencilViewTextureA view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.
renderTargetViewTextureA 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
depthStencilViewTextureA view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.
renderTargetViewTextureA 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
depthStencilViewTextureA view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.
renderTargetViewsReadOnlySpan<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
renderTargetViewscontains 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
renderTargetViewsReadOnlySpan<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
renderTargetViewscontains 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
depthStencilViewTextureA view of the Depth-Stencil Buffer to bind. Specify null to unbind the currently bound Depth-Stencil Buffer.
renderTargetViewsReadOnlySpan<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
renderTargetViewscontains 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
renderTargetViewsReadOnlySpan<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
renderTargetViewscontains 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
rectangleRectangleThe 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
scissorRectanglesReadOnlySpan<Rectangle>The set of scissor rectangles to bind.
Remarks
See Set the scissor in the manual for more information.
Exceptions
- ArgumentOutOfRangeException
scissorRectanglescontains too many scissor rectangles to set.
SetStencilReference(int)
Sets the reference value for Depth-Stencil tests.
public void SetStencilReference(int stencilReference)
Parameters
stencilReferenceintReference 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
buffersReadOnlySpan<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
indexintThe input slot for binding the Vertex Buffer; The maximum number of input slots available depends on platform and graphics profile, usually 16 or 32.
bufferBufferThe Vertex Buffer to set. It must have been created with VertexBuffer.
offsetintThe number of bytes between the first element of the Vertex Buffer and the first element that will be used.
strideintThe 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
viewportViewport
SetViewports(params ReadOnlySpan<Viewport>)
Binds an array of viewports to the rasterizer stage of the pipeline.
public void SetViewports(params ReadOnlySpan<Viewport> viewports)
Parameters
viewportsReadOnlySpan<Viewport>The viewports to set.
Exceptions
- ArgumentOutOfRangeException
viewportscontains 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
mappedResourceMappedResourceA 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)