// Copyright (c) 2010-2014 SharpDX - Alexandre Mutel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Runtime.InteropServices; namespace SharpDX.Direct3D12 { public partial class GraphicsCommandList { /// ///

Clears the depth-stencil resource.

///
///

Describes the CPU descriptor handle that represents the start of the heap for the depth stencil to be cleared.

///

A combination of values that are combined by using a bitwise OR operation. The resulting value identifies the type of data to clear (depth buffer, stencil buffer, or both).

///

A value to clear the depth buffer with. This value will be clamped between 0 and 1.

///

A value to clear the stencil buffer with.

///

The number of rectangles in the array that the pRects parameter specifies.

///

An array of D3D12_RECT structures for the rectangles in the resource view to clear. If null, ClearDepthStencilView clears the entire resource view.

/// /// dn903840 /// void ID3D12GraphicsCommandList::ClearDepthStencilView([In] D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView,[In] D3D12_CLEAR_FLAGS ClearFlags,[In] float Depth,[In] unsigned char Stencil,[In] unsigned int NumRects,[In, Buffer] const RECT* pRects) /// ID3D12GraphicsCommandList::ClearDepthStencilView public void ClearDepthStencilView(SharpDX.Direct3D12.CpuDescriptorHandle depthStencilView, SharpDX.Direct3D12.ClearFlags clearFlags, float depth, byte stencil) { ClearDepthStencilView(depthStencilView, clearFlags, depth, stencil, 0, null); } /// ///

Sets all the elements in a render target to one value.

///
///

Specifies a structure that describes the CPU descriptor handle that represents the start of the heap for the render target to be cleared.

///

A 4-component array that represents the color to fill the render target with.

///

The number of rectangles in the array that the pRects parameter specifies.

///

An array of D3D12_RECT structures for the rectangles in the resource view to clear. If null, ClearRenderTargetView clears the entire resource view.

/// /// dn903842 /// void ID3D12GraphicsCommandList::ClearRenderTargetView([In] D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView,[In] const SHARPDX_COLOR4* ColorRGBA,[In] unsigned int NumRects,[In, Buffer] const RECT* pRects) /// ID3D12GraphicsCommandList::ClearRenderTargetView public void ClearRenderTargetView(CpuDescriptorHandle renderTargetView, Mathematics.Interop.RawColor4 colorRGBA) { ClearRenderTargetView(renderTargetView, colorRGBA, 0, null); } /// ///

Notifies the driver that it needs to synchronize multiple accesses to resources.

///
///

The number of submitted barrier descriptions.

///

Pointer to an array of barrier descriptions.

/// ///

There are three types of barrier descriptions:

  • - Transition barriers indicate that a set of subresources transition between different usages. The caller must specify the before and after usages of the subresources. The D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES flag is used to transition all subresources in a resource at the same time.
  • - Aliasing barriers indicate a transition between usages of two different resources which have mappings into the same heap. The application can specify both the before and the after resource. Note that one or both resources can be null (indicating that any tiled resource could cause aliasing).
  • - Unordered access view barriers indicate all UAV accesses (read or writes) to a particular resource must complete before any future UAV accesses (read or write) can begin. The specified resource cannot be null. It is not necessary to insert a UAV barrier between two draw or dispatch calls which only read a UAV. Additionally, it is not necessary to insert a UAV barrier between two draw or dispatch calls which write to the same UAV if the application knows that it is safe to execute the UAV accesses in any order. The resource can be null (indicating that any UAV access could require the barrier).

When is passed an array of resource barrier descriptions, the API behaves as if it was called N times (1 for each array element), in the specified order.

For descriptions of the usage states a subresource can be in, see the enumeration and the Using Resource Barriers to Synchronize Resource States in Direct3D 12 section.

A subresource can be in any state when is called.

When a back buffer is presented, it must be in the state. If Present is called on a resource which is not in the PRESENT state, a debug layer warning will be emitted.

The resource usage bits are group into two categories, read-only and read/write.

The following usage bits are read-only:

The following usage bits are read/write:

  • D3D12_RESOURCE_STATE_GENERATE_MIPS

At most one write bit can be set. If any write bit is set, then no read bit may be set. If no write bit is set, then any number of read bits may be set.

At any given time, a subresource is in exactly one state (determined by a set of flags). The application must ensure that the states are matched when making a sequence of ResourceBarrier calls. In other words, the before and after states in consecutive calls to ResourceBarrier must agree.

To transition all subresources within a resource, the application can set the subresource index to D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, which implies that all subresources are changed.

For improved performance, applications should use split barriers (refer to Synchronization and Multi-Engine). Applications should also batch multiple transitions into a single call whenever possible.

///
/// /// dn903898 /// void ID3D12GraphicsCommandList::ResourceBarrier([In] unsigned int NumBarriers,[In, Buffer] const void* pBarriers) /// ID3D12GraphicsCommandList::ResourceBarrier public void ResourceBarrierTransition(Resource resource, ResourceStates stateBefore, ResourceStates stateAfter) { ResourceBarrierTransition(resource, -1, stateBefore, stateAfter); } /// ///

Notifies the driver that it needs to synchronize multiple accesses to resources.

///
///

The number of submitted barrier descriptions.

///

Pointer to an array of barrier descriptions.

/// ///

There are three types of barrier descriptions:

  • - Transition barriers indicate that a set of subresources transition between different usages. The caller must specify the before and after usages of the subresources. The D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES flag is used to transition all subresources in a resource at the same time.
  • - Aliasing barriers indicate a transition between usages of two different resources which have mappings into the same heap. The application can specify both the before and the after resource. Note that one or both resources can be null (indicating that any tiled resource could cause aliasing).
  • - Unordered access view barriers indicate all UAV accesses (read or writes) to a particular resource must complete before any future UAV accesses (read or write) can begin. The specified resource cannot be null. It is not necessary to insert a UAV barrier between two draw or dispatch calls which only read a UAV. Additionally, it is not necessary to insert a UAV barrier between two draw or dispatch calls which write to the same UAV if the application knows that it is safe to execute the UAV accesses in any order. The resource can be null (indicating that any UAV access could require the barrier).

When is passed an array of resource barrier descriptions, the API behaves as if it was called N times (1 for each array element), in the specified order.

For descriptions of the usage states a subresource can be in, see the enumeration and the Using Resource Barriers to Synchronize Resource States in Direct3D 12 section.

A subresource can be in any state when is called.

When a back buffer is presented, it must be in the state. If Present is called on a resource which is not in the PRESENT state, a debug layer warning will be emitted.

The resource usage bits are group into two categories, read-only and read/write.

The following usage bits are read-only:

The following usage bits are read/write:

  • D3D12_RESOURCE_STATE_GENERATE_MIPS

At most one write bit can be set. If any write bit is set, then no read bit may be set. If no write bit is set, then any number of read bits may be set.

At any given time, a subresource is in exactly one state (determined by a set of flags). The application must ensure that the states are matched when making a sequence of ResourceBarrier calls. In other words, the before and after states in consecutive calls to ResourceBarrier must agree.

To transition all subresources within a resource, the application can set the subresource index to D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, which implies that all subresources are changed.

For improved performance, applications should use split barriers (refer to Synchronization and Multi-Engine). Applications should also batch multiple transitions into a single call whenever possible.

///
/// /// dn903898 /// void ID3D12GraphicsCommandList::ResourceBarrier([In] unsigned int NumBarriers,[In, Buffer] const void* pBarriers) /// ID3D12GraphicsCommandList::ResourceBarrier public unsafe void ResourceBarrierTransition(Resource resource, int subresource, ResourceStates stateBefore, ResourceStates stateAfter) { var barrier = new ResourceBarrier(new ResourceTransitionBarrier(resource, subresource, stateBefore, stateAfter)); ResourceBarrier(1, new IntPtr(&barrier)); } /// ///

Notifies the driver that it needs to synchronize multiple accesses to resources.

///
///

The number of submitted barrier descriptions.

///

Pointer to an array of barrier descriptions.

/// ///

There are three types of barrier descriptions:

  • - Transition barriers indicate that a set of subresources transition between different usages. The caller must specify the before and after usages of the subresources. The D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES flag is used to transition all subresources in a resource at the same time.
  • - Aliasing barriers indicate a transition between usages of two different resources which have mappings into the same heap. The application can specify both the before and the after resource. Note that one or both resources can be null (indicating that any tiled resource could cause aliasing).
  • - Unordered access view barriers indicate all UAV accesses (read or writes) to a particular resource must complete before any future UAV accesses (read or write) can begin. The specified resource cannot be null. It is not necessary to insert a UAV barrier between two draw or dispatch calls which only read a UAV. Additionally, it is not necessary to insert a UAV barrier between two draw or dispatch calls which write to the same UAV if the application knows that it is safe to execute the UAV accesses in any order. The resource can be null (indicating that any UAV access could require the barrier).

When is passed an array of resource barrier descriptions, the API behaves as if it was called N times (1 for each array element), in the specified order.

For descriptions of the usage states a subresource can be in, see the enumeration and the Using Resource Barriers to Synchronize Resource States in Direct3D 12 section.

A subresource can be in any state when is called.

When a back buffer is presented, it must be in the state. If Present is called on a resource which is not in the PRESENT state, a debug layer warning will be emitted.

The resource usage bits are group into two categories, read-only and read/write.

The following usage bits are read-only:

The following usage bits are read/write:

  • D3D12_RESOURCE_STATE_GENERATE_MIPS

At most one write bit can be set. If any write bit is set, then no read bit may be set. If no write bit is set, then any number of read bits may be set.

At any given time, a subresource is in exactly one state (determined by a set of flags). The application must ensure that the states are matched when making a sequence of ResourceBarrier calls. In other words, the before and after states in consecutive calls to ResourceBarrier must agree.

To transition all subresources within a resource, the application can set the subresource index to D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, which implies that all subresources are changed.

For improved performance, applications should use split barriers (refer to Synchronization and Multi-Engine). Applications should also batch multiple transitions into a single call whenever possible.

///
/// /// dn903898 /// void ID3D12GraphicsCommandList::ResourceBarrier([In] unsigned int NumBarriers,[In, Buffer] const void* pBarriers) /// ID3D12GraphicsCommandList::ResourceBarrier public unsafe void ResourceBarrierAliasing(Resource resourceBefore, Resource resourceAfter) { var barrier = new ResourceBarrier(new ResourceAliasingBarrier(resourceBefore, resourceAfter)); ResourceBarrier(1, new IntPtr(&barrier)); } /// ///

Notifies the driver that it needs to synchronize multiple accesses to resources.

///
///

The number of submitted barrier descriptions.

///

Pointer to an array of barrier descriptions.

/// ///

There are three types of barrier descriptions:

  • - Transition barriers indicate that a set of subresources transition between different usages. The caller must specify the before and after usages of the subresources. The D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES flag is used to transition all subresources in a resource at the same time.
  • - Aliasing barriers indicate a transition between usages of two different resources which have mappings into the same heap. The application can specify both the before and the after resource. Note that one or both resources can be null (indicating that any tiled resource could cause aliasing).
  • - Unordered access view barriers indicate all UAV accesses (read or writes) to a particular resource must complete before any future UAV accesses (read or write) can begin. The specified resource cannot be null. It is not necessary to insert a UAV barrier between two draw or dispatch calls which only read a UAV. Additionally, it is not necessary to insert a UAV barrier between two draw or dispatch calls which write to the same UAV if the application knows that it is safe to execute the UAV accesses in any order. The resource can be null (indicating that any UAV access could require the barrier).

When is passed an array of resource barrier descriptions, the API behaves as if it was called N times (1 for each array element), in the specified order.

For descriptions of the usage states a subresource can be in, see the enumeration and the Using Resource Barriers to Synchronize Resource States in Direct3D 12 section.

A subresource can be in any state when is called.

When a back buffer is presented, it must be in the state. If Present is called on a resource which is not in the PRESENT state, a debug layer warning will be emitted.

The resource usage bits are group into two categories, read-only and read/write.

The following usage bits are read-only:

The following usage bits are read/write:

  • D3D12_RESOURCE_STATE_GENERATE_MIPS

At most one write bit can be set. If any write bit is set, then no read bit may be set. If no write bit is set, then any number of read bits may be set.

At any given time, a subresource is in exactly one state (determined by a set of flags). The application must ensure that the states are matched when making a sequence of ResourceBarrier calls. In other words, the before and after states in consecutive calls to ResourceBarrier must agree.

To transition all subresources within a resource, the application can set the subresource index to D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, which implies that all subresources are changed.

For improved performance, applications should use split barriers (refer to Synchronization and Multi-Engine). Applications should also batch multiple transitions into a single call whenever possible.

///
/// /// dn903898 /// void ID3D12GraphicsCommandList::ResourceBarrier([In] unsigned int NumBarriers,[In, Buffer] const void* pBarriers) /// ID3D12GraphicsCommandList::ResourceBarrier public unsafe void ResourceBarrier(SharpDX.Direct3D12.ResourceBarrier barrier) { ResourceBarrier(1, new IntPtr(&barrier)); } /// ///

Notifies the driver that it needs to synchronize multiple accesses to resources.

///
///

The number of submitted barrier descriptions.

///

Pointer to an array of barrier descriptions.

/// ///

There are three types of barrier descriptions:

  • - Transition barriers indicate that a set of subresources transition between different usages. The caller must specify the before and after usages of the subresources. The D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES flag is used to transition all subresources in a resource at the same time.
  • - Aliasing barriers indicate a transition between usages of two different resources which have mappings into the same heap. The application can specify both the before and the after resource. Note that one or both resources can be null (indicating that any tiled resource could cause aliasing).
  • - Unordered access view barriers indicate all UAV accesses (read or writes) to a particular resource must complete before any future UAV accesses (read or write) can begin. The specified resource cannot be null. It is not necessary to insert a UAV barrier between two draw or dispatch calls which only read a UAV. Additionally, it is not necessary to insert a UAV barrier between two draw or dispatch calls which write to the same UAV if the application knows that it is safe to execute the UAV accesses in any order. The resource can be null (indicating that any UAV access could require the barrier).

When is passed an array of resource barrier descriptions, the API behaves as if it was called N times (1 for each array element), in the specified order.

For descriptions of the usage states a subresource can be in, see the enumeration and the Using Resource Barriers to Synchronize Resource States in Direct3D 12 section.

A subresource can be in any state when is called.

When a back buffer is presented, it must be in the state. If Present is called on a resource which is not in the PRESENT state, a debug layer warning will be emitted.

The resource usage bits are group into two categories, read-only and read/write.

The following usage bits are read-only:

The following usage bits are read/write:

  • D3D12_RESOURCE_STATE_GENERATE_MIPS

At most one write bit can be set. If any write bit is set, then no read bit may be set. If no write bit is set, then any number of read bits may be set.

At any given time, a subresource is in exactly one state (determined by a set of flags). The application must ensure that the states are matched when making a sequence of ResourceBarrier calls. In other words, the before and after states in consecutive calls to ResourceBarrier must agree.

To transition all subresources within a resource, the application can set the subresource index to D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, which implies that all subresources are changed.

For improved performance, applications should use split barriers (refer to Synchronization and Multi-Engine). Applications should also batch multiple transitions into a single call whenever possible.

///
/// /// dn903898 /// void ID3D12GraphicsCommandList::ResourceBarrier([In] unsigned int NumBarriers,[In, Buffer] const void* pBarriers) /// ID3D12GraphicsCommandList::ResourceBarrier public unsafe void ResourceBarrier(params SharpDX.Direct3D12.ResourceBarrier[] barriers) { if (barriers == null) throw new ArgumentNullException("barriers"); fixed (void* pBarriers = barriers) ResourceBarrier(barriers.Length, new IntPtr(pBarriers)); } /// ///

Changes the currently bound descriptor heaps that are associated with a command list.

///
///

A reference to an array of objects for the heaps to set on the command list.

/// ///

SetDescriptorHeaps can be called on a bundle, but the bundle descriptor heaps must match the calling command list descriptor heap. For more information on bundle restrictions, refer to Creating and Recording Command Lists and Bundles.

///
/// /// Dn903908 /// void ID3D12GraphicsCommandList::SetDescriptorHeaps([In] unsigned int NumDescriptorHeaps,[In, Buffer] const ID3D12DescriptorHeap** ppDescriptorHeaps) /// ID3D12GraphicsCommandList::SetDescriptorHeaps public void SetDescriptorHeaps(params SharpDX.Direct3D12.DescriptorHeap[] descriptorHeaps) { SetDescriptorHeaps(descriptorHeaps.Length, descriptorHeaps); } /// ///

Sets CPU descriptor handles for the render targets and depth stencil.

///
///

The number of entries in the pRenderTargetDescriptors array.

///

Specifies an array of structures that describe the CPU descriptor handles that represents the start of the heap of render target descriptors.

///

True means the handle passed in is the reference to a contiguous range of NumRenderTargetDescriptors descriptors. This case is useful if the set of descriptors to bind already happens to be contiguous in memory (so all that?s needed is a handle to the first one). For example, if NumRenderTargetDescriptors is 3 then the memory layout is taken as follows:

In this case the driver dereferences the handle and then increments the memory being pointed to.

False means that the handle is the first of an array of NumRenderTargetDescriptors handles. The false case allows an application to bind a set of descriptors from different locations at once. Again assuming that NumRenderTargetDescriptors is 3, the memory layout is taken as follows:

In this case the driver dereferences three handles that are expected to be adjacent to each other in memory.

///

A reference to a structure that describes the CPU descriptor handle that represents the start of the heap that holds the depth stencil descriptor.

/// /// dn986884 /// void ID3D12GraphicsCommandList::OMSetRenderTargets([In] unsigned int NumRenderTargetDescriptors,[In, Optional] const void* pRenderTargetDescriptors,[In] BOOL RTsSingleHandleToDescriptorRange,[In, Optional] const D3D12_CPU_DESCRIPTOR_HANDLE* pDepthStencilDescriptor) /// ID3D12GraphicsCommandList::OMSetRenderTargets public unsafe void SetRenderTargets(int numRenderTargetDescriptors, CpuDescriptorHandle renderTargetDescriptors, SharpDX.Direct3D12.CpuDescriptorHandle? depthStencilDescriptorRef) { SetRenderTargets(numRenderTargetDescriptors, new IntPtr(&renderTargetDescriptors), true, depthStencilDescriptorRef); } /// ///

Sets CPU descriptor handles for the render targets and depth stencil.

///
///

The number of entries in the pRenderTargetDescriptors array.

///

Specifies an array of structures that describe the CPU descriptor handles that represents the start of the heap of render target descriptors.

///

True means the handle passed in is the reference to a contiguous range of NumRenderTargetDescriptors descriptors. This case is useful if the set of descriptors to bind already happens to be contiguous in memory (so all that?s needed is a handle to the first one). For example, if NumRenderTargetDescriptors is 3 then the memory layout is taken as follows:

In this case the driver dereferences the handle and then increments the memory being pointed to.

False means that the handle is the first of an array of NumRenderTargetDescriptors handles. The false case allows an application to bind a set of descriptors from different locations at once. Again assuming that NumRenderTargetDescriptors is 3, the memory layout is taken as follows:

In this case the driver dereferences three handles that are expected to be adjacent to each other in memory.

///

A reference to a structure that describes the CPU descriptor handle that represents the start of the heap that holds the depth stencil descriptor.

/// /// dn986884 /// void ID3D12GraphicsCommandList::OMSetRenderTargets([In] unsigned int NumRenderTargetDescriptors,[In, Optional] const void* pRenderTargetDescriptors,[In] BOOL RTsSingleHandleToDescriptorRange,[In, Optional] const D3D12_CPU_DESCRIPTOR_HANDLE* pDepthStencilDescriptor) /// ID3D12GraphicsCommandList::OMSetRenderTargets public unsafe void SetRenderTargets(CpuDescriptorHandle[] renderTargetDescriptors, SharpDX.Direct3D12.CpuDescriptorHandle? depthStencilDescriptorRef) { fixed (void* pRT = renderTargetDescriptors) SetRenderTargets(renderTargetDescriptors != null ? renderTargetDescriptors.Length : 0, new IntPtr(pRT), false, depthStencilDescriptorRef); } /// ///

Sets CPU descriptor handles for the render targets and depth stencil.

///
///

The number of entries in the pRenderTargetDescriptors array.

///

Specifies an array of structures that describe the CPU descriptor handles that represents the start of the heap of render target descriptors.

///

True means the handle passed in is the reference to a contiguous range of NumRenderTargetDescriptors descriptors. This case is useful if the set of descriptors to bind already happens to be contiguous in memory (so all that?s needed is a handle to the first one). For example, if NumRenderTargetDescriptors is 3 then the memory layout is taken as follows:

In this case the driver dereferences the handle and then increments the memory being pointed to.

False means that the handle is the first of an array of NumRenderTargetDescriptors handles. The false case allows an application to bind a set of descriptors from different locations at once. Again assuming that NumRenderTargetDescriptors is 3, the memory layout is taken as follows:

In this case the driver dereferences three handles that are expected to be adjacent to each other in memory.

///

A reference to a structure that describes the CPU descriptor handle that represents the start of the heap that holds the depth stencil descriptor.

/// /// dn986884 /// void ID3D12GraphicsCommandList::OMSetRenderTargets([In] unsigned int NumRenderTargetDescriptors,[In, Optional] const void* pRenderTargetDescriptors,[In] BOOL RTsSingleHandleToDescriptorRange,[In, Optional] const D3D12_CPU_DESCRIPTOR_HANDLE* pDepthStencilDescriptor) /// ID3D12GraphicsCommandList::OMSetRenderTargets public unsafe void SetRenderTargets(CpuDescriptorHandle? renderTargetDescriptor, SharpDX.Direct3D12.CpuDescriptorHandle? depthStencilDescriptorRef) { var renderTargetDesc = new CpuDescriptorHandle(); if (renderTargetDescriptor.HasValue) { renderTargetDesc = renderTargetDescriptor.Value; } SetRenderTargets(renderTargetDesc.Ptr != PointerSize.Zero ? 1 : 0, renderTargetDescriptor.HasValue ? new IntPtr(&renderTargetDesc) : IntPtr.Zero, false, depthStencilDescriptorRef); } /// ///

Sets a CPU descriptor handle for the vertex buffers.

///
///

Index into the device's zero-based array to begin setting vertex buffers.

///

Specifies the vertex buffer views in an array of structures.

///

The number of views in the pViews array.

/// dn986883 /// void ID3D12GraphicsCommandList::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumViews,[In] const void* pViews) /// ID3D12GraphicsCommandList::IASetVertexBuffers public void SetVertexBuffers(int startSlot, SharpDX.Direct3D12.VertexBufferView[] vertexBufferViews, int numBuffers) { unsafe { fixed (void* descPtr = vertexBufferViews) SetVertexBuffers(startSlot, numBuffers, new IntPtr(descPtr)); } } /// ///

Sets a CPU descriptor handle for the vertex buffers.

///
///

Index into the device's zero-based array to begin setting vertex buffers.

///

Specifies the vertex buffer views in an array of structures.

/// dn986883 /// void ID3D12GraphicsCommandList::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumViews,[In] const void* pViews) /// ID3D12GraphicsCommandList::IASetVertexBuffers public void SetVertexBuffers(int startSlot, params SharpDX.Direct3D12.VertexBufferView[] vertexBufferViews) { SetVertexBuffers(startSlot, vertexBufferViews, vertexBufferViews.Length); } /// ///

Sets a CPU descriptor handle for the vertex buffers.

///
///

Index into the device's zero-based array to begin setting vertex buffers.

///

Specifies the vertex buffer view of structures.

/// dn986883 /// void ID3D12GraphicsCommandList::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumViews,[In] const void* pViews) /// ID3D12GraphicsCommandList::IASetVertexBuffers public void SetVertexBuffer(int startSlot, SharpDX.Direct3D12.VertexBufferView vertexBufferView) { unsafe { SetVertexBuffers(startSlot, 1, (IntPtr)(&vertexBufferView)); } } /// ///

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

///
///

Number of viewports to bind. The range of valid values is (0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE).

/// ///

All viewports must be set atomically as one operation. Any viewports not defined by the call are disabled.

Which viewport to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader; if a geometry shader does not specify the semantic, Direct3D will use the first viewport in the array.

Note Even though you specify float values to the members of the structure for the pViewports array in a call to RSSetViewports for feature levels 9_x, RSSetViewports uses DWORDs internally. Because of this behavior, when you use a negative top left corner for the viewport, the call to RSSetViewports for feature levels 9_x fails. This failure occurs because RSSetViewports for 9_x casts the floating point values into unsigned integers without validation, which results in integer overflow. ///
/// dn903900 /// void ID3D12GraphicsCommandList::RSSetViewports([In] unsigned int NumViewports,[In, Buffer] const D3D12_VIEWPORT* pViewports) /// ID3D12GraphicsCommandList::RSSetViewports public void SetViewports(params SharpDX.Mathematics.Interop.RawViewportF[] viewports) { if (viewports == null) throw new ArgumentNullException("viewports"); unsafe { fixed (void* pViewPorts = viewports) SetViewports(viewports.Length, (IntPtr)pViewPorts); } } /// ///

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

///
///

Number of viewports to bind. The range of valid values is (0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE).

/// ///

All viewports must be set atomically as one operation. Any viewports not defined by the call are disabled.

Which viewport to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader; if a geometry shader does not specify the semantic, Direct3D will use the first viewport in the array.

Note Even though you specify float values to the members of the structure for the pViewports array in a call to RSSetViewports for feature levels 9_x, RSSetViewports uses DWORDs internally. Because of this behavior, when you use a negative top left corner for the viewport, the call to RSSetViewports for feature levels 9_x fails. This failure occurs because RSSetViewports for 9_x casts the floating point values into unsigned integers without validation, which results in integer overflow. ///
/// dn903900 /// void ID3D12GraphicsCommandList::RSSetViewports([In] unsigned int NumViewports,[In, Buffer] const D3D12_VIEWPORT* pViewports) /// ID3D12GraphicsCommandList::RSSetViewports public unsafe void SetViewport(SharpDX.Mathematics.Interop.RawViewportF viewport) { SetViewports(1, new IntPtr(&viewport)); } /// /// Binds an array of scissor rectangles to the rasterizer stage. /// /// No documentation. /// dn903899 /// void ID3D12GraphicsCommandList::RSSetScissorRects([In] unsigned int NumRects,[In, Buffer] const RECT* pRects) /// ID3D12GraphicsCommandList::RSSetScissorRects public void SetScissorRectangles(params SharpDX.Mathematics.Interop.RawRectangle[] rectangles) { if (rectangles == null) throw new ArgumentNullException("rectangles"); SetScissorRectangles(rectangles.Length, rectangles); } /// /// Binds an array of scissor rectangles to the rasterizer stage. /// /// No documentation. /// dn903899 /// void ID3D12GraphicsCommandList::RSSetScissorRects([In] unsigned int NumRects,[In, Buffer] const RECT* pRects) /// ID3D12GraphicsCommandList::RSSetScissorRects public unsafe void SetScissorRectangles(SharpDX.Mathematics.Interop.RawRectangle rectangle) { SetScissorRectangles(1, new IntPtr(&rectangle)); } /// ///

For internal use only.

///
///

Internal.

/// /// dn986879 /// void ID3D12GraphicsCommandList::BeginEvent([In] unsigned int Metadata,[In, Buffer, Optional] const void* pData,[In] unsigned int Size) /// ID3D12GraphicsCommandList::BeginEvent public void BeginEvent(string name) { if (name == null) throw new ArgumentNullException(nameof(name)); IntPtr hMessage = IntPtr.Zero; try { hMessage = Marshal.StringToHGlobalUni(name); BeginEvent(1, hMessage, name.Length); } finally { if (hMessage != IntPtr.Zero) { Marshal.FreeHGlobal(hMessage); hMessage = IntPtr.Zero; } } } /// ///

For internal use only.

///
///

Internal.

/// /// dn986885 /// void ID3D12GraphicsCommandList::SetMarker([In] unsigned int Metadata,[In, Buffer, Optional] const void* pData,[In] unsigned int Size) /// ID3D12GraphicsCommandList::SetMarker public void SetMarker(string name) { if (name == null) throw new ArgumentNullException("name"); IntPtr hMessage = IntPtr.Zero; try { hMessage = Marshal.StringToHGlobalUni(name); SetMarker(1, hMessage, name.Length); } finally { if (hMessage != IntPtr.Zero) { Marshal.FreeHGlobal(hMessage); hMessage = IntPtr.Zero; } } } /// ///

Apps perform indirect draws/dispatches using the ExecuteIndirect method.

///
///

Specifies a . The data referenced by pArgumentBuffer will be interpreted depending on the contents of the command signature. Refer to Indirect Drawing for the APIs that are used to create a command signature.

///

There are two ways that command counts can be specified:

  • If pCountBuffer is not null, then MaxCommandCount specifies the maximum number of operations which will be performed. The actual number of operations to be performed are defined by the minimum of this value, and a 32-bit unsigned integer contained in pCountBuffer (at the byte offset specified by CountBufferOffset).
  • If pCountBuffer is null, the MaxCommandCount specifies the exact number of operations which will be performed.
///

Specifies one or more objects, containing the command arguments.

///

Specifies an offset into pArgumentBuffer to identify the first command argument.

/// ///

The semantics of this API are defined with the following pseudo-code:

Non-null pCountBuffer:

// Read draw count out of count buffer /// UINT CommandCount = pCountBuffer->ReadUINT32(CountBufferOffset); CommandCount = min(CommandCount, MaxCommandCount) // Get reference to first Commanding argument /// BYTE* Arguments = pArgumentBuffer->GetBase() + ArgumentBufferOffset; for(UINT CommandIndex = 0; CommandIndex < CommandCount; CommandIndex++) /// { // Interpret the data contained in *Arguments // according to the command signature pCommandSignature->Interpret(Arguments); Arguments += pCommandSignature ->GetByteStride(); /// } ///

null pCountBuffer:

// Get reference to first Commanding argument /// BYTE* Arguments = pArgumentBuffer->GetBase() + ArgumentBufferOffset; for(UINT CommandIndex = 0; CommandIndex < MaxCommandCount; CommandIndex++) /// { // Interpret the data contained in *Arguments // according to the command signature pCommandSignature->Interpret(Arguments); Arguments += pCommandSignature ->GetByteStride(); /// } ///

The debug layer will issue an error if either the count buffer or the argument buffer are not in the state. The core runtime will validate:

  • CountBufferOffset and ArgumentBufferOffset are 4-byte aligned
  • pCountBuffer and pArgumentBuffer are buffer resources (any heap type)
  • The offset implied by MaxCommandCount, ArgumentBufferOffset, and the drawing program stride do not exceed the bounds of pArgumentBuffer (similarly for count buffer)
  • The command list is a direct command list or a compute command list (not a copy or JPEG decode command list)
  • The root signature of the command list matches the root signature of the command signature

The functionality of two APIs from earlier versions of Direct3D, DrawInstancedIndirect and DrawIndexedInstancedIndirect, are encompassed by ExecuteIndirect.

///
public void ExecuteIndirect( SharpDX.Direct3D12.CommandSignature commandSignature, int maxCommandCount, SharpDX.Direct3D12.Resource argumentBuffer, long argumentBufferOffset) { ExecuteIndirect( commandSignature, maxCommandCount, argumentBuffer, argumentBufferOffset, null, 0); } } }