Class DeviceContextProxy
- Namespace
- HelixToolkit.SharpDX.Render
- Assembly
- HelixToolkit.SharpDX.dll
public sealed class DeviceContextProxy : DisposeObject, IDisposable
- Inheritance
-
DeviceContextProxy
- Implements
- Inherited Members
Constructors
DeviceContextProxy(Device1)
Initializes a new deferred context
public DeviceContextProxy(Device1 device)
Parameters
deviceDevice1The device.
DeviceContextProxy(DeviceContext1, Device1)
Muse pass immediate context for this constructor
public DeviceContextProxy(DeviceContext1 context, Device1 device)
Parameters
contextDeviceContext1The context.
deviceDevice1device
Fields
ConstantBufferCount
public const int ConstantBufferCount = 14
Field Value
IsDeferred
public readonly bool IsDeferred
Field Value
SamplerStateCount
public const int SamplerStateCount = 16
Field Value
ShaderResourceViewCount
public const int ShaderResourceViewCount = 128
Field Value
SimultaneousRenderTargetCount
public const int SimultaneousRenderTargetCount = 8
Field Value
StageCount
public const int StageCount = 6
Field Value
UnorderedAcccesViewCount
public const int UnorderedAcccesViewCount = 8
Field Value
Properties
AutoSkipRedundantStateSetting
public static bool AutoSkipRedundantStateSetting { get; set; }
Property Value
CurrShaderPass
Gets or sets the last shader pass.
public ShaderPass? CurrShaderPass { get; }
Property Value
- ShaderPass
The last shader pass.
InputLayout
Gets or sets the input layout.
public InputLayoutProxy? InputLayout { get; set; }
Property Value
- InputLayoutProxy
The input layout.
NumberOfDrawCalls
Gets the number of draw calls.
public int NumberOfDrawCalls { get; }
Property Value
- int
The number of draw calls.
PrimitiveTopology
Gets or sets the primitive topology.
public PrimitiveTopology PrimitiveTopology { get; set; }
Property Value
- PrimitiveTopology
The primitive topology.
Methods
Begin(Asynchronous)
public void Begin(Asynchronous query)
Parameters
queryAsynchronous
ClearDepthStencilView(DepthStencilView?, DepthStencilClearFlags, float, byte)
Clears the depth stencil view.
public void ClearDepthStencilView(DepthStencilView? view, DepthStencilClearFlags clearFlag, float depth = 1, byte stencil = 0)
Parameters
viewDepthStencilViewThe view.
clearFlagDepthStencilClearFlagsThe clear flag.
depthfloatThe depth.
stencilbyteThe stencil.
ClearRenderTagetBindings()
public void ClearRenderTagetBindings()
ClearRenderTargetView(RenderTargetView?, Color4)
Clears the render target view.
public void ClearRenderTargetView(RenderTargetView? renderTargetViewRef, Color4 colorRGBA)
Parameters
renderTargetViewRefRenderTargetViewThe render target view reference.
colorRGBAColor4A 4-component array that represents the color to fill the render target with.
Remarks
Applications that wish to clear a render target to a specific integer value bit pattern should render a screen-aligned quad instead of using this method. The reason for this is because this method accepts as input a floating point value, which may not have the same bit pattern as the original integer. Differences between Direct3D 9 and Direct3D 11/10: Unlike Direct3D 9, the full extent of the resource view is always cleared. Viewport and scissor settings are not applied. ?When using D3D_FEATURE_LEVEL_9_x, ClearRenderTargetView only clears the first array slice in the render target view. This can impact (for example) cube map rendering scenarios. Applications should create a render target view for each face or array slice, then clear each view individually.
ClearRenderTargets(DX11RenderBufferProxyBase?, Color4)
Clears the render targets.
public void ClearRenderTargets(DX11RenderBufferProxyBase? buffer, Color4 color)
Parameters
bufferDX11RenderBufferProxyBaseThe buffer.
colorColor4The color.
ClearState()
Restore all default settings.
public void ClearState()
Remarks
This method resets any device context to the default settings. This sets all input/output resource slots, shaders, input layouts, predications, scissor rectangles, depth-stencil state, rasterizer state, blend state, sampler state, and viewports to null. The primitive topology is set to UNDEFINED.For a scenario where you would like to clear a list of commands recorded so far, call SharpDX.Direct3D11.DeviceContext.FinishCommandListInternal(SharpDX.Mathematics.Interop.RawBool,SharpDX.Direct3D11.CommandList@) and throw away the resulting SharpDX.Direct3D11.CommandList.
ClearUnorderedAccessView(UnorderedAccessView?, Int4)
Clears an unordered access resource with bit-precise values.
public void ClearUnorderedAccessView(UnorderedAccessView? unorderedAccessViewRef, Int4 values)
Parameters
unorderedAccessViewRefUnorderedAccessViewThe unordered access view reference.
valuesInt4The values.
Remarks
This API copies the lower ni bits from each array element i to the corresponding channel, where ni is the number of bits in the ith channel of the resource format (for example, R8G8B8_FLOAT has 8 bits for the first 3 channels). This works on any UAV with no format conversion. For a raw or structured buffer view, only the first array element value is used.
ClearUnorderedAccessView(UnorderedAccessView?, ref Int4)
Clears an unordered access resource with bit-precise values.
public void ClearUnorderedAccessView(UnorderedAccessView? unorderedAccessViewRef, ref Int4 values)
Parameters
unorderedAccessViewRefUnorderedAccessViewThe unordered access view reference.
valuesInt4The values.
Remarks
This API copies the lower ni bits from each array element i to the corresponding channel, where ni is the number of bits in the ith channel of the resource format (for example, R8G8B8_FLOAT has 8 bits for the first 3 channels). This works on any UAV with no format conversion. For a raw or structured buffer view, only the first array element value is used.
ClearUnorderedAccessView(UnorderedAccessView?, Vector4)
Clears an unordered access resource with a float value.
public void ClearUnorderedAccessView(UnorderedAccessView? unorderedAccessViewRef, Vector4 values)
Parameters
unorderedAccessViewRefUnorderedAccessViewThe unordered access view reference.
valuesVector4The values.
Remarks
This API works on FLOAT, UNORM, and SNORM unordered access views (UAVs), with format conversion from FLOAT to *NORM where appropriate. On other UAVs, the operation is invalid and the call will not reach the driver.
ClearUnorderedAccessView(UnorderedAccessView?, ref Vector4)
Clears an unordered access resource with a float value.
public void ClearUnorderedAccessView(UnorderedAccessView? unorderedAccessViewRef, ref Vector4 values)
Parameters
unorderedAccessViewRefUnorderedAccessViewThe unordered access view reference.
valuesVector4The values.
Remarks
This API works on FLOAT, UNORM, and SNORM unordered access views (UAVs), with format conversion from FLOAT to *NORM where appropriate. On other UAVs, the operation is invalid and the call will not reach the driver.
CopyResource(Resource, Resource)
Copy the entire contents of the source resource to the destination resource using the GPU.
public void CopyResource(Resource source, Resource destination)
Parameters
sourceResourceA reference to the source resource (see SharpDX.Direct3D11.Resource).
destinationResourceA reference to the destination resource (see SharpDX.Direct3D11.Resource).
Remarks
This method is unusual in that it causes the GPU to perform the copy operation (similar to a memcpy by the CPU). As a result, it has a few restrictions designed for improving performance. For instance, the source and destination resources: Must be different resources. Must be the same type. Must have identical dimensions (including width, height, depth, and size as appropriate). Will only be copied. CopyResource does not support any stretch, color key, blend, or format conversions. Must have compatible DXGI formats, which means the formats must be identical or at least from the same type group. For example, a DXGI_FORMAT_R32G32B32_FLOAT texture can be copied to an DXGI_FORMAT_R32G32B32_UINT texture since both of these formats are in the DXGI_FORMAT_R32G32B32_TYPELESS group. Might not be currently mapped. You cannot use an {{Immutable}} resource as a destination. You can use a {{depth-stencil}} resource as either a source or a destination. Resources created with multisampling capability (see SharpDX.DXGI.SampleDescription) can be used as source and destination only if both source and destination have identical multisampled count and quality. If source and destination differ in multisampled count and quality or if one is multisampled and the other is not multisampled the call to ID3D11DeviceContext::CopyResource fails. The method is an asynchronous call which may be added to the command-buffer queue. This attempts to remove pipeline stalls that may occur when copying data. An application that only needs to copy a portion of the data in a resource should use SharpDX.Direct3D11.DeviceContext.CopySubresourceRegion_(SharpDX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Int32,SharpDX.Direct3D11.Resource,System.Int32,System.Nullable{SharpDX.Direct3D11.ResourceRegion}) instead.
CopyStructureCount(Buffer, int, UnorderedAccessView?)
Copies data from a buffer holding variable length data.
public void CopyStructureCount(Buffer dstBufferRef, int dstAlignedByteOffset, UnorderedAccessView? srcViewRef)
Parameters
dstBufferRefBufferPointer to SharpDX.Direct3D11.Buffer. This can be any buffer resource that other copy commands, such as SharpDX.Direct3D11.DeviceContext.CopyResource_(SharpDX.Direct3D11.Resource,SharpDX.Direct3D11.Resource) or SharpDX.Direct3D11.DeviceContext.CopySubresourceRegion_(SharpDX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Int32,SharpDX.Direct3D11.Resource,System.Int32,System.Nullable{SharpDX.Direct3D11.ResourceRegion}), are able to write to.
dstAlignedByteOffsetintOffset from the start of pDstBuffer to write 32-bit UINT structure (vertex) count from pSrcView.
srcViewRefUnorderedAccessViewPointer to an SharpDX.Direct3D11.UnorderedAccessView of a Structured Buffer resource created with either SharpDX.Direct3D11.UnorderedAccessViewBufferFlags.Append or SharpDX.Direct3D11.UnorderedAccessViewBufferFlags.Counter specified when the UAV was created. These types of resources have hidden counters tracking "how many" records have been written.
CopySubresourceRegion(Resource, int, ResourceRegion?, Resource, int, int, int, int)
Copy a region from a source resource to a destination resource.
public void CopySubresourceRegion(Resource source, int sourceSubresource, ResourceRegion? sourceRegion, Resource destination, int destinationSubResource, int dstX = 0, int dstY = 0, int dstZ = 0)
Parameters
sourceResourceA reference to the source resource (see SharpDX.Direct3D11.Resource).
sourceSubresourceintSource subresource index.
sourceRegionResourceRegion?A reference to a 3D box (see SharpDX.Direct3D11.ResourceRegion) that defines the source subresources that can be copied. If NULL, the entire source subresource is copied. The box must fit within the source resource.
destinationResourceA reference to the destination resource (see SharpDX.Direct3D11.Resource).
destinationSubResourceintDestination subresource index.
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 subresource, this must be zero.
dstZintThe z-coordinate of the upper left corner of the destination region. For a 1D or 2D subresource, this must be zero.
Remarks
The source box must be within the size of the source resource. The destination offsets, (x, y, and z) allow the source box to be offset when writing into the destination resource; however, the dimensions of the source box 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. {{D3D11CalcSubresource}} is a helper function for calculating subresource indexes. CopySubresourceRegion performs the copy on the GPU (similar to a memcpy by the CPU). As a consequence, the source and destination resources: Must be different subresources (although they can be from the same resource). Must be the same type. Must have compatible DXGI formats (identical or from the same type group). For example, a DXGI_FORMAT_R32G32B32_FLOAT texture can be copied to an DXGI_FORMAT_R32G32B32_UINT texture since both of these formats are in the DXGI_FORMAT_R32G32B32_TYPELESS group. May not be currently mapped. CopySubresourceRegion only supports copy; it does not support any stretch, color key, blend, or format conversions. An application that needs to copy an entire resource should use SharpDX.Direct3D11.DeviceContext.CopyResource_(SharpDX.Direct3D11.Resource,SharpDX.Direct3D11.Resource) instead. CopySubresourceRegion is an asynchronous call which may be added to the command-buffer queue, this attempts to remove pipeline stalls that may occur when copying data. See performance considerations for more details. Note??If you use CopySubresourceRegion with a depth-stencil buffer or a multisampled resource, you must copy the whole subresource. In this situation, you must pass 0 to the DstX, DstY, and DstZ parameters and NULL to the pSrcBox parameter. In addition, source and destination resources, which are represented by the pSrcResource and pDstResource parameters, should have identical sample count values. Example The following code snippet copies a box (located at (120,100),(200,220)) from a source texture into a region (10,20),(90,140) in a destination texture. D3D11_BOX sourceRegion; sourceRegion.left = 120; sourceRegion.right = 200; sourceRegion.top = 100; sourceRegion.bottom = 220; sourceRegion.front = 0; sourceRegion.back = 1; pd3dDeviceContext->CopySubresourceRegion( pDestTexture, 0, 10, 20, 0, pSourceTexture, 0, sourceRegion ); Notice, that for a 2D texture, front and back are set to 0 and 1 respectively.
CreatePredicate(in QueryDescription)
public Predicate CreatePredicate(in QueryDescription description)
Parameters
descriptionQueryDescription
Returns
- Predicate
CreateQuery(in QueryDescription)
public Query CreateQuery(in QueryDescription description)
Parameters
descriptionQueryDescription
Returns
- Query
Dispatch(int, int, int)
Execute a command list from a thread group.
public void Dispatch(int threadGroupCountX, int threadGroupCountY, int threadGroupCountZ)
Parameters
threadGroupCountXintThe number of groups dispatched in the x direction. ThreadGroupCountX must be less than or equal to SharpDX.Direct3D11.ComputeShaderStage.DispatchMaximumThreadGroupsPerDimension (65535).
threadGroupCountYintThe number of groups dispatched in the y direction. ThreadGroupCountY must be less than or equal to SharpDX.Direct3D11.ComputeShaderStage.DispatchMaximumThreadGroupsPerDimension (65535).
threadGroupCountZintThe number of groups dispatched in the z direction. ThreadGroupCountZ must be less than or equal to SharpDX.Direct3D11.ComputeShaderStage.DispatchMaximumThreadGroupsPerDimension (65535). In feature level 10 the value for ThreadGroupCountZ must be 1.
Remarks
You call the Dispatch method to execute commands in a compute shader. A compute shader can be run on many threads in parallel, within a thread group. Index a particular thread, within a thread group using a 3D vector given by (x,y,z).In the following illustration, assume a thread group with 50 threads where the size of the group is given by (5,5,2). A single thread is identified from a thread group with 50 threads in it, using the vector (4,1,1).The following illustration shows the relationship between the parameters passed to SharpDX.Direct3D11.DeviceContext.Dispatch(System.Int32,System.Int32,System.Int32), Dispatch(5,3,2), the values specified in the numthreads attribute, numthreads(10,8,3), and values that will passed to the compute shader for the thread-related system values (SV_GroupIndex,SV_DispatchThreadID,SV_GroupThreadID,SV_GroupID).
DispatchIndirect(Buffer, int)
Execute a command list over one or more thread groups.
public void DispatchIndirect(Buffer bufferForArgsRef, int alignedByteOffsetForArgs)
Parameters
bufferForArgsRefBufferA reference to an SharpDX.Direct3D11.Buffer, which must be loaded with data that matches the argument list for SharpDX.Direct3D11.DeviceContext.Dispatch(System.Int32,System.Int32,System.Int32).
alignedByteOffsetForArgsintA byte-aligned offset between the start of the buffer and the arguments.
Remarks
You call the DispatchIndirect method to execute commands in a compute shader.When an application creates a buffer that is associated with the SharpDX.Direct3D11.Buffer interface that pBufferForArgs points to, the application must set the SharpDX.Direct3D11.ResourceOptionFlags.DrawIndirectArguments flag in the MiscFlags member of the SharpDX.Direct3D11.BufferDescription structure that describes the buffer. To create the buffer, the application calls the SharpDX.Direct3D11.Device.CreateBuffer(SharpDX.Direct3D11.BufferDescription@,System.Nullable{SharpDX.DataBox},SharpDX.Direct3D11.Buffer) method and in this call passes a reference to SharpDX.Direct3D11.BufferDescription in the pDesc parameter.
Draw(int, int)
Draw non-indexed, non-instanced primitives.
public void Draw(int vertexCount, int startVertexLocation)
Parameters
vertexCountintNumber of vertices to draw.
startVertexLocationintIndex of the first vertex, which is usually an offset in a vertex buffer.
Remarks
Draw submits work to the rendering pipeline.The vertex data for a draw call normally comes from a vertex buffer that is bound to the pipeline.Even without any vertex buffer bound to the pipeline, you can generate your own vertex data in your vertex shader by using the SV_VertexID system-value semantic to determine the current vertex that the runtime is processing.
DrawAuto()
Draw geometry of an unknown size.
public void DrawAuto()
Remarks
A draw API submits work to the rendering pipeline. This API submits work of an unknown size that was processed by the input assembler, vertex shader, and stream-output stages; the work may or may not have gone through the geometry-shader stage.After data has been streamed out to stream-output stage buffers, those buffers can be again bound to the Input Assembler stage at input slot 0 and DrawAuto will draw them without the application needing to know the amount of data that was written to the buffers. A measurement of the amount of data written to the SO stage buffers is maintained internally when the data is streamed out. This means that the CPU does not need to fetch the measurement before re-binding the data that was streamed as input data. Although this amount is tracked internally, it is still the responsibility of applications to use input layouts to describe the format of the data in the SO stage buffers so that the layouts are available when the buffers are again bound to the input assembler.The following diagram shows the DrawAuto process.Calling DrawAuto does not change the state of the streaming-output buffers that were bound again as inputs.DrawAuto only works when drawing with one input buffer bound as an input to the IA stage at slot 0. Applications must create the SO buffer resource with both binding flags, SharpDX.Direct3D11.BindFlags.VertexBuffer and SharpDX.Direct3D11.BindFlags.StreamOutput.This API does not support indexing or instancing.If an application needs to retrieve the size of the streaming-output buffer, it can query for statistics on streaming output by using SharpDX.Direct3D11.QueryType.StreamOutputStatistics.
DrawIndexed(int, int, int)
Draw indexed, non-instanced primitives.
public void DrawIndexed(int indexCount, int startIndexLocation, int baseVertexLocation)
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.
Remarks
A draw API submits work to the rendering pipeline.If the sum of both indices is negative, the result of the function call is undefined.
DrawIndexedInstanced(int, int, int, int, int)
Draw indexed, instanced primitives.
public void DrawIndexedInstanced(int indexCountPerInstance, int instanceCount, int startIndexLocation, int baseVertexLocation, int startInstanceLocation)
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.
baseVertexLocationintTA 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.
Remarks
A draw API submits work to the rendering pipeline.Instancing may extend performance by reusing the same geometry to draw multiple objects in a scene. One example of instancing could be to draw the same object with different positions and colors. Instancing requires multiple vertex buffers: at least one for per-vertex data and a second buffer for per-instance data.
DrawIndexedInstancedIndirect(Buffer, int)
Draw indexed, instanced, GPU-generated primitives.
public void DrawIndexedInstancedIndirect(Buffer bufferForArgsRef, int alignedByteOffsetForArgs)
Parameters
bufferForArgsRefBufferA reference to an SharpDX.Direct3D11.Buffer, which is a buffer containing the GPU generated primitives.
alignedByteOffsetForArgsintOffset in pBufferForArgs to the start of the GPU generated primitives.
Remarks
When an application creates a buffer that is associated with the SharpDX.Direct3D11.Buffer interface that pBufferForArgs points to, the application must set the SharpDX.Direct3D11.ResourceOptionFlags.DrawIndirectArguments flag in the MiscFlags member of the SharpDX.Direct3D11.BufferDescription structure that describes the buffer. To create the buffer, the application calls the SharpDX.Direct3D11.Device.CreateBuffer(SharpDX.Direct3D11.BufferDescription@,System.Nullable{SharpDX.DataBox},SharpDX.Direct3D11.Buffer) method and in this call passes a reference to SharpDX.Direct3D11.BufferDescription in the pDesc parameter. Windows?Phone?8: This API is supported.
DrawInstanced(int, int, int, int)
Draw non-indexed, instanced primitives.
public void DrawInstanced(int vertexCountPerInstance, int instanceCount, int startVertexLocation, int startInstanceLocation)
Parameters
vertexCountPerInstanceintNumber of vertices to draw.
instanceCountintNumber of instances to draw.
startVertexLocationintIndex of the first vertex.
startInstanceLocationintA value added to each index before reading per-instance data from a vertex buffer.
Remarks
A draw API submits work to the rendering pipeline.Instancing may extend performance by reusing the same geometry to draw multiple objects in a scene. One example of instancing could be to draw the same object with different positions and colors.The vertex data for an instanced draw call normally comes from a vertex buffer that is bound to the pipeline. However, you could also provide the vertex data from a shader that has instanced data identified with a system-value semantic (SV_InstanceID).
DrawInstancedIndirect(Buffer, int)
Draw instanced, GPU-generated primitives.
public void DrawInstancedIndirect(Buffer bufferForArgsRef, int alignedByteOffsetForArgs)
Parameters
bufferForArgsRefBufferA reference to an SharpDX.Direct3D11.Buffer, which is a buffer containing the GPU generated primitives.
alignedByteOffsetForArgsintOffset in pBufferForArgs to the start of the GPU generated primitives.
Remarks
When an application creates a buffer that is associated with the SharpDX.Direct3D11.Buffer interface that pBufferForArgs points to, the application must set the SharpDX.Direct3D11.ResourceOptionFlags.DrawIndirectArguments flag in the MiscFlags member of the SharpDX.Direct3D11.BufferDescription structure that describes the buffer. To create the buffer, the application calls the SharpDX.Direct3D11.Device.CreateBuffer(SharpDX.Direct3D11.BufferDescription@,System.Nullable{SharpDX.DataBox},SharpDX.Direct3D11.Buffer) method and in this call passes a reference to SharpDX.Direct3D11.BufferDescription in the pDesc parameter.
End(Asynchronous)
public void End(Asynchronous query)
Parameters
queryAsynchronous
ExecuteCommandList(CommandList, bool)
Queues commands from a command list onto a device.
public void ExecuteCommandList(CommandList commandListRef, bool restoreContextState)
Parameters
commandListRefCommandListThe command list reference.
restoreContextStateboolA Boolean flag that determines whether the target context state is saved prior to and restored after the execution of a command list. Use TRUE to indicate that the runtime needs to save and restore the state. Use SharpDX.Result.False to indicate that no state shall be saved or restored, which causes the target context to return to its default state after the command list executes. Applications should typically use SharpDX.Result.False unless they will restore the state to be nearly equivalent to the state that the runtime would restore if TRUE were passed. When applications use SharpDX.Result.False, they can avoid unnecessary and inefficient state transitions.
Remarks
Use this method to play back a command list that was recorded by a deferred context on any thread. A call to ExecuteCommandList of a command list from a deferred context onto the immediate context is required for the recorded commands to be executed on the graphics processing unit (GPU). A call to ExecuteCommandList of a command list from a deferred context onto another deferred context can be used to merge recorded lists. But to run the commands from the merged deferred command list on the GPU, you need to execute them on the immediate context. This method performs some runtime validation related to queries. Queries that are begun in a device context cannot be manipulated indirectly by executing a command list (that is, Begin or End was invoked against the same query by the deferred context which generated the command list). If such a condition occurs, the ExecuteCommandList method does not execute the command list. However, the state of the device context is still maintained, as would be expected (SharpDX.Direct3D11.DeviceContext.ClearState is performed, unless the application indicates to preserve the device context state). Windows?Phone?8: This API is supported.
FinishCommandList(bool)
Create a command list and record graphics commands into it.
public CommandList? FinishCommandList(bool restoreState)
Parameters
restoreStateboolA flag indicating whether the immediate context state is saved (prior) and restored (after) the execution of a command list.
Returns
- CommandList
Flush()
Sends queued-up commands in the command buffer to the graphics processing unit (GPU).
public void Flush()
Remarks
Most applications don't need to call this method. If an application calls this method when not necessary, it incurs a performance penalty. Each call to Flush incurs a significant amount of overhead.When Microsoft Direct3D state-setting, present, or draw commands are called by an application, those commands are queued into an internal command buffer. Flush sends those commands to the GPU for processing. Typically, the Direct3D runtime sends these commands to the GPU automatically whenever the runtime determines that they need to be sent, such as when the command buffer is full or when an application maps a resource. Flush sends the commands manually.We recommend that you use Flush when the CPU waits for an arbitrary amount of time (such as when you call the Sleep function).Because Flush operates asynchronously, it can return either before or after the GPU finishes executing the queued graphics commands. However, the graphics commands eventually always complete. You can call the SharpDX.Direct3D11.Device.CreateQuery(SharpDX.Direct3D11.QueryDescription,SharpDX.Direct3D11.Query) method with the SharpDX.Direct3D11.QueryType.Event value to create an event query; you can then use that event query in a call to the SharpDX.Direct3D11.DeviceContext.GetDataInternal(SharpDX.Direct3D11.Asynchronous,System.IntPtr,System.Int32,SharpDX.Direct3D11.AsynchronousFlags) method to determine when the GPU is finished processing the graphics commands. Microsoft Direct3D?11 defers the destruction of objects. Therefore, an application can't rely upon objects immediately being destroyed. By calling Flush, you destroy any objects whose destruction was deferred. If an application requires synchronous destruction of an object, we recommend that the application release all its references, call SharpDX.Direct3D11.DeviceContext.ClearState, and then call Flush.
GenerateMips(ShaderResourceView?)
Generates mipmaps for the given shader resource.
public void GenerateMips(ShaderResourceView? shaderResourceViewRef)
Parameters
shaderResourceViewRefShaderResourceViewThe shader resource view reference.
Remarks
You can call GenerateMips on any shader-resource view to generate the lower mipmap levels for the shader resource. GenerateMips uses the largest mipmap level of the view to recursively generate the lower levels of the mip and stops with the smallest level that is specified by the view. If the base resource wasn't created with SharpDX.Direct3D11.BindFlags.RenderTarget, SharpDX.Direct3D11.BindFlags.ShaderResource, and SharpDX.Direct3D11.ResourceOptionFlags.GenerateMipMaps, the call to GenerateMips has no effect.Feature levels 9.1, 9.2, and 9.3 can't support automatic generation of mipmaps for 3D (volume) textures.Video adapters that support feature level 9.1 and higher support generating mipmaps if you use any of these formats: SharpDX.DXGI.Format.R8G8B8A8_UNorm SharpDX.DXGI.Format.R8G8B8A8_UNorm_SRgb SharpDX.DXGI.Format.B5G6R5_UNorm SharpDX.DXGI.Format.B8G8R8A8_UNorm SharpDX.DXGI.Format.B8G8R8A8_UNorm_SRgb SharpDX.DXGI.Format.B8G8R8X8_UNorm SharpDX.DXGI.Format.B8G8R8X8_UNorm_SRgb Video adapters that support feature level 9.2 and higher support generating mipmaps if you use any of these formats in addition to any of the formats for feature level 9.1: SharpDX.DXGI.Format.R16G16B16A16_Float SharpDX.DXGI.Format.R16G16B16A16_UNorm SharpDX.DXGI.Format.R16G16_Float SharpDX.DXGI.Format.R16G16_UNorm SharpDX.DXGI.Format.R32_Float Video adapters that support feature level 9.3 and higher support generating mipmaps if you use any of these formats in addition to any of the formats for feature levels 9.1 and 9.2: SharpDX.DXGI.Format.R32G32B32A32_Float DXGI_FORMAT_B4G4R4A4 (optional) Video adapters that support feature level 10 and higher support generating mipmaps if you use any of these formats in addition to any of the formats for feature levels 9.1, 9.2, and 9.3: SharpDX.DXGI.Format.R32G32B32_Float (optional) SharpDX.DXGI.Format.R16G16B16A16_SNorm SharpDX.DXGI.Format.R32G32_Float SharpDX.DXGI.Format.R10G10B10A2_UNorm SharpDX.DXGI.Format.R11G11B10_Float SharpDX.DXGI.Format.R8G8B8A8_SNorm SharpDX.DXGI.Format.R16G16_SNorm SharpDX.DXGI.Format.R8G8_UNorm SharpDX.DXGI.Format.R8G8_SNorm SharpDX.DXGI.Format.R16_Float SharpDX.DXGI.Format.R16_UNorm SharpDX.DXGI.Format.R16_SNorm SharpDX.DXGI.Format.R8_UNorm SharpDX.DXGI.Format.R8_SNorm SharpDX.DXGI.Format.A8_UNorm SharpDX.DXGI.Format.B5G5R5A1_UNorm (optional) For all other unsupported formats, GenerateMips will silently fail.
GetData<T>(Asynchronous, out T)
public bool GetData<T>(Asynchronous query, out T dataOut) where T : unmanaged
Parameters
queryAsynchronousdataOutT
Returns
Type Parameters
T
GetDepthStencilView(out DepthStencilView?)
Gets the depth stencil view.
public void GetDepthStencilView(out DepthStencilView? depthStencilViewRef)
Parameters
depthStencilViewRefDepthStencilViewThe depth stencil view reference.
Remarks
Any returned interfaces will have their reference count incremented by one. Applications should call {{IUnknown::Release}} on the returned interfaces when they are no longer needed to avoid memory leaks.
GetRenderTargets(int)
Gets the render targets.
public RenderTargetView[]? GetRenderTargets(int numViews)
Parameters
numViewsintThe number views.
Returns
- RenderTargetView[]
Remarks
Any returned interfaces will have their reference count incremented by one. Applications should call {{IUnknown::Release}} on the returned interfaces when they are no longer needed to avoid memory leaks.
GetRenderTargets(int, out DepthStencilView?)
Gets the render targets.
public RenderTargetView[]? GetRenderTargets(int numViews, out DepthStencilView? depthStencilViewRef)
Parameters
numViewsintThe number views.
depthStencilViewRefDepthStencilViewThe depth stencil view reference.
Returns
- RenderTargetView[]
Remarks
Any returned interfaces will have their reference count incremented by one. Applications should call {{IUnknown::Release}} on the returned interfaces when they are no longer needed to avoid memory leaks.
GetSampler(ComputeShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(ComputeShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetSampler(DomainShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(DomainShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetSampler(GeometryShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(GeometryShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetSampler(HullShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(HullShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetSampler(PixelShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(PixelShaderType shaderType, int startSlot, int num)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetSampler(VertexShaderType, int, int)
Gets the sampler. Use Type
public SamplerState[]? GetSampler(VertexShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeVertexShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- SamplerState[]
GetShaderResources(ComputeShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(ComputeShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetShaderResources(DomainShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(DomainShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetShaderResources(GeometryShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(GeometryShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetShaderResources(HullShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(HullShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetShaderResources(PixelShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(PixelShaderType shaderType, int startSlot, int num)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetShaderResources(VertexShaderType, int, int)
Gets the texture. Use Type
public ShaderResourceView[]? GetShaderResources(VertexShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeVertexShaderTypeThe shader type. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- ShaderResourceView[]
GetUnorderedAccessView(ComputeShaderType, int, int)
Gets the unordered access view. Use Type
public UnorderedAccessView[]? GetUnorderedAccessView(ComputeShaderType shaderType, int startSlot, int num)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
startSlotintThe start slot.
numintThe number.
Returns
- UnorderedAccessView[]
GetUnorderedAccessViews(int, int)
Gets the unordered access views.
public UnorderedAccessView[]? GetUnorderedAccessViews(int startSlot, int count)
Parameters
startSlotintIndex of the first element in the zero-based array to return (ranges from 0 to D3D11_PS_CS_UAV_REGISTER_COUNT - 1).
countintNumber of views to get (ranges from 0 to D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot).
Returns
- UnorderedAccessView[]
Remarks
Any returned interfaces will have their reference count incremented by one. Applications should call IUnknown::Release on the returned interfaces when they are no longer needed to avoid memory leaks.
IsDataAvailable(Asynchronous)
public bool IsDataAvailable(Asynchronous query)
Parameters
queryAsynchronous
Returns
MapSubresource(Buffer, MapMode, MapFlags)
Maps the data contained in a subresource to a memory pointer, and denies the GPU access to that subresource.
public DataBox? MapSubresource(Buffer resource, MapMode mode, MapFlags flags)
Parameters
resourceBufferThe resource.
modeMapModeThe mode.
flagsMapFlagsThe flags.
Returns
- DataBox?
The locked SharpDX.DataBox
MapSubresource(Buffer?, MapMode, MapFlags, out DataStream?)
public DataBox? MapSubresource(Buffer? resource, MapMode mode, MapFlags flags, out DataStream? stream)
Parameters
resourceBuffermodeMapModeflagsMapFlagsstreamDataStream
Returns
- DataBox?
MapSubresource(Resource?, int, MapMode, MapFlags)
Maps the subresource.
public DataBox? MapSubresource(Resource? resourceRef, int subresource, MapMode mapType, MapFlags mapFlags)
Parameters
resourceRefResourceThe resource reference.
subresourceintThe subresource.
mapTypeMapModeType of the map.
mapFlagsMapFlagsThe map flags.
Returns
- DataBox?
Remarks
If you call Map on a deferred context, you can only pass SharpDX.Direct3D11.MapMode.WriteDiscard, SharpDX.Direct3D11.MapMode.WriteNoOverwrite, or both to the MapType parameter. Other SharpDX.Direct3D11.MapMode-typed values are not supported for a deferred context.The Direct3D 11.1 runtime, which is available starting with Windows Developer Preview, can map shader resource views (SRVs) of dynamic buffers with SharpDX.Direct3D11.MapMode.WriteNoOverwrite. The Direct3D 11 and earlier runtimes limited mapping to vertex or index buffers. If SharpDX.Direct3D11.MapFlags.DoNotWait is used and the resource is still being used by the GPU, this method return an empty DataBox whose property SharpDX.DataBox.IsEmpty returns true.
MapSubresource(Resource?, int, MapMode, MapFlags, out DataStream?)
Maps the subresource.
public DataBox? MapSubresource(Resource? resource, int subresource, MapMode mode, MapFlags flags, out DataStream? stream)
Parameters
resourceResourceThe resource.
subresourceintThe subresource.
modeMapModeThe mode.
flagsMapFlagsThe flags.
streamDataStreamThe stream.
Returns
- DataBox?
MapSubresource(Resource?, int, int, MapMode, MapFlags, out int)
Maps the subresource.
public DataBox? MapSubresource(Resource? resource, int mipSlice, int arraySlice, MapMode mode, MapFlags flags, out int mipSizeOut)
Parameters
resourceResourceThe resource.
mipSliceintThe mip slice.
arraySliceintThe array slice.
modeMapModeThe mode.
flagsMapFlagsThe flags.
mipSizeOutintSize of the mip.
Returns
- DataBox?
MapSubresource(Texture1D?, int, int, MapMode, MapFlags, out DataStream?)
Maps the data contained in a subresource to a memory pointer, and denies the GPU access to that subresource.
public DataBox? MapSubresource(Texture1D? resource, int mipSlice, int arraySlice, MapMode mode, MapFlags flags, out DataStream? stream)
Parameters
resourceTexture1DThe resource.
mipSliceintThe mip slice.
arraySliceintThe array slice.
modeMapModeThe mode.
flagsMapFlagsThe flags.
streamDataStreamThe stream.
Returns
- DataBox?
The locked SharpDX.DataBox
MapSubresource(Texture2D?, int, int, MapMode, MapFlags, out DataStream?)
Maps the data contained in a subresource to a memory pointer, and denies the GPU access to that subresource.
public DataBox? MapSubresource(Texture2D? resource, int mipSlice, int arraySlice, MapMode mode, MapFlags flags, out DataStream? stream)
Parameters
resourceTexture2DThe resource.
mipSliceintThe mip slice.
arraySliceintThe array slice.
modeMapModeThe mode.
flagsMapFlagsThe flags.
streamDataStreamThe stream.
Returns
- DataBox?
The locked SharpDX.DataBox
MapSubresource(Texture3D?, int, int, MapMode, MapFlags, out DataStream?)
Maps the data contained in a subresource to a memory pointer, and denies the GPU access to that subresource.
public DataBox? MapSubresource(Texture3D? resource, int mipSlice, int arraySlice, MapMode mode, MapFlags flags, out DataStream? stream)
Parameters
resourceTexture3DThe resource.
mipSliceintThe mip slice.
arraySliceintThe array slice.
modeMapModeThe mode.
flagsMapFlagsThe flags.
streamDataStreamThe stream.
Returns
- DataBox?
The locked SharpDX.DataBox
OnDispose(bool)
protected override void OnDispose(bool disposeManagedResources)
Parameters
disposeManagedResourcesbool
Reset()
Resets this instance.
public void Reset()
ResetDrawCalls()
public int ResetDrawCalls()
Returns
ResolveSubresource(Resource, int, Resource, int, Format)
Copy a multisampled resource into a non-multisampled resource.
public void ResolveSubresource(Resource source, int sourceSubresource, Resource destination, int destinationSubresource, Format format)
Parameters
sourceResourceSource resource. Must be multisampled.
sourceSubresourceintThe source subresource.
destinationResourceDestination resource. Must be a created with the SharpDX.Direct3D11.ResourceUsage.Default flag and be single-sampled. See SharpDX.Direct3D11.Resource.
destinationSubresourceintA zero-based index, that identifies the destination subresource. Use {{D3D11CalcSubresource}} to calculate the index.
formatFormatA SharpDX.DXGI.Format that indicates how the multisampled resource will be resolved to a single-sampled resource. See remarks.
Remarks
This API is most useful when re-using the resulting render target of one render pass as an input to a second render pass. The source and destination resources must be the same resource type and have the same dimensions. In addition, they must have compatible formats. There are three scenarios for this: ScenarioRequirements Source and destination are prestructured and typedBoth 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 typelessThe typed resource must have a format that is compatible with the typeless resource (i.e. the typed resource is DXGI_FORMAT_R32_FLOAT and the typeless resource is DXGI_FORMAT_R32_TYPELESS). The format of the typed resource must be specified in the Format parameter. Source and destination are prestructured and typelessBoth the source and destination must have the same typeless format (i.e. both must have DXGI_FORMAT_R32_TYPELESS), and the Format parameter must specify a format that is compatible with the source and destination (i.e. if both are DXGI_FORMAT_R32_TYPELESS then DXGI_FORMAT_R32_FLOAT could be specified in the Format parameter). For example, given the DXGI_FORMAT_R16G16B16A16_TYPELESS format: The source (or dest) format could be DXGI_FORMAT_R16G16B16A16_UNORM The dest (or source) format could be DXGI_FORMAT_R16G16B16A16_FLOAT ?
SetBlendState(BlendStateProxy, Color4?, int)
Sets the state of the blend.
public void SetBlendState(BlendStateProxy blendState, Color4? blendFactor = null, int sampleMask = -1)
Parameters
blendStateBlendStateProxyState of the blend.
blendFactorColor4?The blend factor.
sampleMaskintThe sample mask.
SetBlendState(BlendStateProxy, Color4?, uint)
Sets the state of the blend.
public void SetBlendState(BlendStateProxy blendState, Color4? blendFactor = null, uint sampleMask = 4294967295)
Parameters
blendStateBlendStateProxyState of the blend.
blendFactorColor4?The blend factor.
sampleMaskuintThe sample mask.
SetDepthStencil(DepthStencilView?)
Sets the depth stencil only. This will clear all render target bindings and only binds depth stencil view to output merger.
public void SetDepthStencil(DepthStencilView? dsv)
Parameters
dsvDepthStencilViewThe DSV.
SetDepthStencilState(DepthStencilStateProxy, int)
Sets the state of the depth stencil.
public void SetDepthStencilState(DepthStencilStateProxy depthStencilState, int stencilRef = 0)
Parameters
depthStencilStateDepthStencilStateProxyState of the depth stencil.
stencilRefintThe stencil reference.
SetIndexBuffer(Buffer?, Format, int)
Bind an index buffer to the input-assembler stage.
public void SetIndexBuffer(Buffer? indexBufferRef, Format format, int offset)
Parameters
indexBufferRefBufferA reference to an SharpDX.Direct3D11.Buffer object, that contains indices. The index buffer must have been created with the SharpDX.Direct3D11.BindFlags.IndexBuffer flag.
formatFormatA SharpDX.DXGI.Format that specifies the format of the data in the index buffer. The only formats allowed for index buffer data are 16-bit (SharpDX.DXGI.Format.R16_UInt) and 32-bit (SharpDX.DXGI.Format.R32_UInt) integers.
offsetintOffset (in bytes) from the start of the index buffer to the first index to use.
Remarks
For information about creating index buffers, see How to: Create an Index Buffer. Calling this method using a buffer that is currently bound for writing (i.e. bound to the stream output pipeline stage) will effectively bind null instead because a buffer cannot be bound as both an input and an output at the same time. The debug layer will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime. The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10. Windows?Phone?8: This API is supported.
SetOutputUAV(int, UnorderedAccessView?)
public void SetOutputUAV(int slot, UnorderedAccessView? uav)
Parameters
slotintuavUnorderedAccessView
SetOutputUAVs(int, UnorderedAccessView[]?)
public void SetOutputUAVs(int startSlot, UnorderedAccessView[]? uavs)
Parameters
startSlotintuavsUnorderedAccessView[]
SetRasterState(RasterizerStateProxy?)
Sets the state of the raster.
public void SetRasterState(RasterizerStateProxy? rasterState)
Parameters
rasterStateRasterizerStateProxyState of the raster.
SetRenderTarget(DepthStencilView?, RenderTargetView?)
Sets the render target.
public void SetRenderTarget(DepthStencilView? dsv, RenderTargetView? renderTarget)
Parameters
dsvDepthStencilViewThe DSV.
renderTargetRenderTargetViewThe render target.
SetRenderTarget(DepthStencilView?, RenderTargetView?, bool, Color4, bool, DepthStencilClearFlags, float, byte)
Sets the render target.
public void SetRenderTarget(DepthStencilView? dsv, RenderTargetView? rtv, bool clearRTV, Color4 color, bool clearDSV, DepthStencilClearFlags flags = DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, float depth = 1, byte stencil = 0)
Parameters
dsvDepthStencilViewThe DSV.
rtvRenderTargetViewThe RTV.
clearRTVboolif set to
true[clear RTV].colorColor4clearDSVboolif set to
true[clear DSV].flagsDepthStencilClearFlagsdepthfloatstencilbyte
SetRenderTarget(RenderTargetView?)
Sets the render target only.
public void SetRenderTarget(RenderTargetView? rtv)
Parameters
rtvRenderTargetViewThe RTV.
SetRenderTarget(RenderTargetView?, bool, Color4)
Sets the render target. This sets depth stencil buffer to null
public void SetRenderTarget(RenderTargetView? rtv, bool clearRTV, Color4 color)
Parameters
SetRenderTargets(DX11RenderBufferProxyBase)
public void SetRenderTargets(DX11RenderBufferProxyBase buffer)
Parameters
bufferDX11RenderBufferProxyBase
SetRenderTargets(DepthStencilView?, RenderTargetView?[]?)
Sets the render targets.
public void SetRenderTargets(DepthStencilView? dsv, RenderTargetView?[]? renderTarget)
Parameters
dsvDepthStencilViewThe DSV.
renderTargetRenderTargetView[]The render target.
SetSampler(ComputeShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(ComputeShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSampler(DomainShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(DomainShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSampler(GeometryShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(GeometryShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSampler(HullShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(HullShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSampler(PixelShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(PixelShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSampler(VertexShaderType, int, SamplerState?)
Binds the sampler. Use Type
public void SetSampler(VertexShaderType shaderType, int slot, SamplerState? sampler)
Parameters
shaderTypeVertexShaderTypeThe shader type. Use Type
slotintThe slot.
samplerSamplerStateThe sampler.
SetSamplers(ComputeShaderType, int, SamplerState[])
Binds the sampler. Use Type
public void SetSamplers(ComputeShaderType shaderType, int slot, SamplerState[] samplers)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetSamplers(DomainShaderType, int, SamplerState[])
Binds the sampler. Use Type
public void SetSamplers(DomainShaderType shaderType, int slot, SamplerState[] samplers)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetSamplers(GeometryShaderType, int, SamplerState[])
Binds the sampler. Use Type
public void SetSamplers(GeometryShaderType shaderType, int slot, SamplerState[] samplers)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetSamplers(HullShaderType, int, SamplerState[])
Binds the sampler. Use Type
public void SetSamplers(HullShaderType shaderType, int slot, SamplerState[] samplers)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetSamplers(PixelShaderType, int, SamplerState?[]?)
Binds the sampler. Use Type
public void SetSamplers(PixelShaderType shaderType, int slot, SamplerState?[]? samplers)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetSamplers(VertexShaderType, int, SamplerState[])
Binds the sampler. Use Type
public void SetSamplers(VertexShaderType shaderType, int slot, SamplerState[] samplers)
Parameters
shaderTypeVertexShaderTypeThe shader type. Use Type
slotintThe slot.
samplersSamplerState[]The sampler.
SetScissorRectangle(ref ViewportF)
public void SetScissorRectangle(ref ViewportF viewport)
Parameters
viewportViewportF
SetScissorRectangle(int, int, int, int)
Sets the scissor rectangle.
public void SetScissorRectangle(int left, int top, int right, int bottom)
Parameters
Remarks
All scissor rects must be set atomically as one operation. Any scissor rects not defined by the call are disabled.The scissor rectangles will only be used if ScissorEnable is set to true in the rasterizer state (see SharpDX.Direct3D11.RasterizerStateDescription).Which scissor rectangle to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader (see shader semantic syntax). If a geometry shader does not make use of the SV_ViewportArrayIndex semantic then Direct3D will use the first scissor rectangle in the array.Each scissor rectangle in the array corresponds to a viewport in an array of viewports (see SharpDX.Direct3D11.RasterizerStage.SetViewports(SharpDX.Mathematics.Interop.RawViewportF[],System.Int32)).
SetScissorRectangles<T>(params T[])
Binds a set of scissor rectangles to the rasterizer stage.
public void SetScissorRectangles<T>(params T[] scissorRectangles) where T : unmanaged
Parameters
scissorRectanglesT[]The scissor rectangles.
Type Parameters
T
Remarks
All scissor rects must be set atomically as one operation. Any scissor rects not defined by the call are disabled.The scissor rectangles will only be used if ScissorEnable is set to true in the rasterizer state (see SharpDX.Direct3D11.RasterizerStateDescription).Which scissor rectangle to use is determined by the SV_ViewportArrayIndex semantic output by a geometry shader (see shader semantic syntax). If a geometry shader does not make use of the SV_ViewportArrayIndex semantic then Direct3D will use the first scissor rectangle in the array.Each scissor rectangle in the array corresponds to a viewport in an array of viewports (see SharpDX.Direct3D11.RasterizerStage.SetViewports(SharpDX.Mathematics.Interop.RawViewportF[],System.Int32)).
SetShader(ComputeShader, bool)
Sets the compute shader.
public void SetShader(ComputeShader shader, bool bindConstantBuffer = true)
Parameters
shaderComputeShaderThe shader.
bindConstantBufferbool
SetShader(DomainShader, bool)
Sets the domain shader.
public void SetShader(DomainShader shader, bool bindConstantBuffer = true)
Parameters
shaderDomainShaderThe shader.
bindConstantBufferbool
SetShader(GeometryShader, bool)
Sets the geometry shader.
public void SetShader(GeometryShader shader, bool bindConstantBuffer = true)
Parameters
shaderGeometryShaderThe shader.
bindConstantBufferbool
SetShader(HullShader, bool)
Sets the hull shader.
public void SetShader(HullShader shader, bool bindConstantBuffer = true)
Parameters
shaderHullShaderThe shader.
bindConstantBufferbool
SetShader(PixelShader, bool)
Sets the pixel shader.
public void SetShader(PixelShader shader, bool bindConstantBuffer = true)
Parameters
shaderPixelShaderThe shader.
bindConstantBufferbool
SetShader(VertexShader, bool)
Sets the vertex shader.
public void SetShader(VertexShader shader, bool bindConstantBuffer = true)
Parameters
shaderVertexShaderThe shader.
bindConstantBufferbool
SetShaderPass(ShaderPass, bool)
public void SetShaderPass(ShaderPass pass, bool bindConstantBuffer = true)
Parameters
passShaderPassbindConstantBufferbool
SetShaderResource(ComputeShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(ComputeShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResource(DomainShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(DomainShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResource(GeometryShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(GeometryShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResource(HullShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(HullShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResource(PixelShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(PixelShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResource(VertexShaderType, int, ShaderResourceView?)
Binds the texture. Use Type
public void SetShaderResource(VertexShaderType shaderType, int slot, ShaderResourceView? texture)
Parameters
shaderTypeVertexShaderTypeThe shader type. Use Type
slotintThe slot.
textureShaderResourceViewThe texture.
SetShaderResources(ComputeShaderType, int, ShaderResourceView[])
Binds the texture. Use Type
public void SetShaderResources(ComputeShaderType shaderType, int slot, ShaderResourceView[] texture)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetShaderResources(DomainShaderType, int, ShaderResourceView[])
Binds the texture. Use Type
public void SetShaderResources(DomainShaderType shaderType, int slot, ShaderResourceView[] texture)
Parameters
shaderTypeDomainShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetShaderResources(GeometryShaderType, int, ShaderResourceView[])
Binds the texture. Use Type
public void SetShaderResources(GeometryShaderType shaderType, int slot, ShaderResourceView[] texture)
Parameters
shaderTypeGeometryShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetShaderResources(HullShaderType, int, ShaderResourceView[])
Binds the texture. Use Type
public void SetShaderResources(HullShaderType shaderType, int slot, ShaderResourceView[] texture)
Parameters
shaderTypeHullShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetShaderResources(PixelShaderType, int, ShaderResourceView?[]?)
Binds the texture. Use Type
public void SetShaderResources(PixelShaderType shaderType, int slot, ShaderResourceView?[]? texture)
Parameters
shaderTypePixelShaderTypeThe shaderType. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetShaderResources(VertexShaderType, int, ShaderResourceView[])
Binds the texture. Use Type
public void SetShaderResources(VertexShaderType shaderType, int slot, ShaderResourceView[] texture)
Parameters
shaderTypeVertexShaderTypeThe shader. Use Type
slotintThe slot.
textureShaderResourceView[]The texture.
SetStreamOutputTarget(Buffer?, int)
Sets the stream output target.
public void SetStreamOutputTarget(Buffer? buffer, int offset = 0)
Parameters
bufferBufferThe buffer.
offsetintThe offset.
SetStreamOutputTarget(StreamOutputBufferBinding[]?)
Sets the stream output target.
public void SetStreamOutputTarget(StreamOutputBufferBinding[]? bufferBindings)
Parameters
bufferBindingsStreamOutputBufferBinding[]The buffer bindings.
SetUnorderedAccessView(ComputeShaderType, int, UnorderedAccessView?)
Binds the unordered access view. Use Type
public void SetUnorderedAccessView(ComputeShaderType shaderType, int slot, UnorderedAccessView? uav)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
uavUnorderedAccessViewThe texture.
SetUnorderedAccessViews(ComputeShaderType, int, UnorderedAccessView[])
Binds the unordered access views. Use Type
public void SetUnorderedAccessViews(ComputeShaderType shaderType, int slot, UnorderedAccessView[] UAVs)
Parameters
shaderTypeComputeShaderTypeThe shaderType. Use Type
slotintThe slot.
UAVsUnorderedAccessView[]The texture.
SetVertexBuffers(int, Buffer[], int[], int[])
Sets the vertex buffers.
public void SetVertexBuffers(int slot, Buffer[] vertexBuffers, int[] stridesRef, int[] offsetsRef)
Parameters
slotintThe first input slot for binding. The first vertex buffer is explicitly bound to the start slot; this causes each additional vertex buffer in the array to be implicitly bound to each subsequent input slot. The maximum of 16 or 32 input slots (ranges from 0 to SharpDX.Direct3D11.InputAssemblerStage.VertexInputResourceSlotCount
-
- are available; the maximum number of input slots depends on the feature level.
-
vertexBuffersBuffer[]A reference to an array of vertex buffers (see SharpDX.Direct3D11.Buffer). The vertex buffers must have been created with the SharpDX.Direct3D11.BindFlags.VertexBuffer flag.
stridesRefint[]Pointer to an array of stride values; one stride value for each buffer in the vertex-buffer array. Each stride is the size (in bytes) of the elements that are to be used from that vertex buffer.
offsetsRefint[]Pointer to an array of offset values; one offset value for each buffer in the vertex-buffer array. Each offset is the number of bytes between the first element of a vertex buffer and the first element that will be used.
Remarks
For information about creating vertex buffers, see Create a Vertex Buffer.Calling this method using a buffer that is currently bound for writing (i.e. bound to the stream output pipeline stage) will effectively bind null instead because a buffer cannot be bound as both an input and an output at the same time.The debug layer will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime. The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
SetVertexBuffers(int, ref VertexBufferBinding)
Bind a single vertex buffer to the input-assembler stage.
public void SetVertexBuffers(int slot, ref VertexBufferBinding vertexBufferBinding)
Parameters
slotintThe first input slot for binding. The first vertex buffer is explicitly bound to the start slot; this causes each additional vertex buffer in the array to be implicitly bound to each subsequent input slot. The maximum of 16 or 32 input slots (ranges from 0 to SharpDX.Direct3D11.InputAssemblerStage.VertexInputResourceSlotCount
-
- are available; the maximum number of input slots depends on the feature level.
-
vertexBufferBindingVertexBufferBindingA SharpDX.Direct3D11.VertexBufferBinding. The vertex buffer must have been created with the SharpDX.Direct3D11.BindFlags.VertexBuffer flag.
Remarks
For information about creating vertex buffers, see Create a Vertex Buffer.Calling this method using a buffer that is currently bound for writing (i.e. bound to the stream output pipeline stage) will effectively bind null instead because a buffer cannot be bound as both an input and an output at the same time.The debug layer will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime. The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
SetVertexBuffers(int, params VertexBufferBinding[])
Bind an array of vertex buffers to the input-assembler stage.
public void SetVertexBuffers(int firstSlot, params VertexBufferBinding[] vertexBufferBindings)
Parameters
firstSlotintThe first input slot for binding. The first vertex buffer is explicitly bound to the start slot; this causes each additional vertex buffer in the array to be implicitly bound to each subsequent input slot. The maximum of 16 or 32 input slots (ranges from 0 to SharpDX.Direct3D11.InputAssemblerStage.VertexInputResourceSlotCount
-
- are available; the maximum number of input slots depends on the feature level.
-
vertexBufferBindingsVertexBufferBinding[]A reference to an array of SharpDX.Direct3D11.VertexBufferBinding. The vertex buffers must have been created with the SharpDX.Direct3D11.BindFlags.VertexBuffer flag.
Remarks
For information about creating vertex buffers, see Create a Vertex Buffer.Calling this method using a buffer that is currently bound for writing (i.e. bound to the stream output pipeline stage) will effectively bind null instead because a buffer cannot be bound as both an input and an output at the same time.The debug layer will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime. The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
SetViewport(Viewport)
Binds a single viewport to the rasterizer stage.
public void SetViewport(Viewport viewport)
Parameters
viewportViewport
SetViewport(ref Viewport)
Binds a single viewport to the rasterizer stage.
public void SetViewport(ref Viewport viewport)
Parameters
viewportViewportThe viewport.
Remarks
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.
SetViewport(ref ViewportF)
Binds a single viewport to the rasterizer stage.
public void SetViewport(ref ViewportF viewport)
Parameters
viewportViewportFThe viewport.
Remarks
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.
SetViewport(float, float, float, float, float, float)
Binds a single viewport to the rasterizer stage.
public void SetViewport(float x, float y, float width, float height, float minZ = 0, float maxZ = 1)
Parameters
xfloatThe x.
yfloatThe y.
widthfloatThe width.
heightfloatThe height.
minZfloatThe minimum z.
maxZfloatThe maximum z.
Remarks
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.
UnmapSubresource(Resource?, int)
Invalidate the reference to a resource and reenable the GPU's access to that resource.
public void UnmapSubresource(Resource? resourceRef, int subresource)
Parameters
resourceRefResourceThe resource reference.
subresourceintThe subresource.
Remarks
For info about how to use Unmap, see How to: Use dynamic resources. Windows?Phone?8: This API is supported.
UpdateSubresource(DataBox, Resource?, int)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresource(DataBox source, Resource? resource, int subresource = 0)
Parameters
sourceDataBoxThe source.
resourceResourceThe resource.
subresourceintThe subresource.
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresource(DataBox, Resource?, int, ref ResourceRegion)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresource(DataBox source, Resource? resource, int subresource, ref ResourceRegion region)
Parameters
sourceDataBoxThe source.
resourceResourceThe resource.
subresourceintThe subresource.
regionResourceRegionThe region.
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresource(Resource?, int, ResourceRegion?, nint, int, int)
The CPU copies data from memory to a subresource created in non-mappable memory.
public void UpdateSubresource(Resource? dstResourceRef, int dstSubresource, ResourceRegion? dstBoxRef, nint srcDataRef, int srcRowPitch, int srcDepthPitch)
Parameters
dstResourceRefResourceA reference to the destination resource (see SharpDX.Direct3D11.Resource).
dstSubresourceintA zero-based index, that identifies the destination subresource. See D3D11CalcSubresource for more details.
dstBoxRefResourceRegion?A reference to a box that defines the portion of the destination subresource to copy the resource data into. Coordinates are in bytes for buffers and in texels for textures. If null, the data is written to the destination subresource with no offset. The dimensions of the source must fit the destination (see SharpDX.Direct3D11.ResourceRegion). An empty box results in a no-op. A box is 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. When the box is empty, UpdateSubresource doesn't perform an update operation.
srcDataRefnintA reference to the source data in memory.
srcRowPitchintThe size of one row of the source data.
srcDepthPitchintThe size of one depth slice of source data.
Remarks
Remarks: For a shader-constant buffer; set pDstBox to null. It is not possible to use this method to partially update a shader-constant buffer.A resource cannot be used as a destination if: the resource is created with immutable or dynamic usage. the resource is created as a depth-stencil resource. the resource is created with multisampling capability (see SharpDX.DXGI.SampleDescription). When UpdateSubresource returns, the application is free to change or even free the data pointed to by pSrcData because the method has already copied/snapped away the original contents.The performance of UpdateSubresource depends on whether or not there is contention for the destination resource. For example, contention for a vertex buffer resource occurs when the application executes a Draw call and later calls UpdateSubresource on the same vertex buffer before the Draw call is actually executed by the GPU. When there is contention for the resource, UpdateSubresource will perform 2 copies of the source data. First, the data is copied by the CPU to a temporary storage space accessible by the command buffer. This copy happens before the method returns. A second copy is then performed by the GPU to copy the source data into non-mappable memory. This second copy happens asynchronously because it is executed by GPU when the command buffer is flushed. When there is no resource contention, the behavior of UpdateSubresource is dependent on which is faster (from the CPU's perspective): copying the data to the command buffer and then having a second copy execute when the command buffer is flushed, or having the CPU copy the data to the final resource location. This is dependent on the architecture of the underlying system. Note??Applies only to feature level 9_x hardware If you use UpdateSubresource or SharpDX.Direct3D11.DeviceContext.CopySubresourceRegion_(SharpDX.Direct3D11.Resource,System.Int32,System.Int32,System.Int32,System.Int32,SharpDX.Direct3D11.Resource,System.Int32,System.Nullable{SharpDX.Direct3D11.ResourceRegion}) to copy from a staging resource to a default resource, you can corrupt the destination contents. This occurs if you pass a null source box and if the source resource has different dimensions from those of the destination resource or if you use destination offsets, (x, y, and z). In this situation, always pass a source box that is the full size of the source resource.?To better understand the source row pitch and source depth pitch parameters, the following illustration shows a 3D volume texture.Each block in this visual represents an element of data, and the size of each element is dependent on the resource's format. For example, if the resource format is SharpDX.DXGI.Format.R32G32B32A32_Float, the size of each element would be 128 bits, or 16 bytes. This 3D volume texture has a width of two, a height of three, and a depth of four.To calculate the source row pitch and source depth pitch for a given resource, use the following formulas: Source Row Pitch = [size of one element in bytes] * [number of elements in one row] Source Depth Pitch = [Source Row Pitch] * [number of rows (height)] In the case of this example 3D volume texture where the size of each element is 16 bytes, the formulas are as follows: Source Row Pitch = 16 * 2 = 32 Source Depth Pitch = 16 * 2 * 3 = 96 The following illustration shows the resource as it is laid out in memory.For example, the following code snippet shows how to specify a destination region in a 2D texture. Assume the destination texture is 512x512 and the operation will copy the data pointed to by pData to [(120,100)..(200,220)] in the destination texture. Also assume that rowPitch has been initialized with the proper value (as explained above). front and back are set to 0 and 1 respectively, because by having front equal to back, the box is technically empty. SharpDX.Direct3D11.ResourceRegion destRegion; destRegion.left = 120; destRegion.right = 200; destRegion.top = 100; destRegion.bottom = 220; destRegion.front = 0; destRegion.back = 1; pd3dDeviceContext->UpdateSubresource( pDestTexture, 0, destRegion, pData, rowPitch, 0 ); The 1D case is similar. The following snippet shows how to specify a destination region in a 1D texture. Use the same assumptions as above, except that the texture is 512 in length. SharpDX.Direct3D11.ResourceRegion destRegion; destRegion.left = 120; destRegion.right = 200; destRegion.top = 0; destRegion.bottom = 1; destRegion.front = 0; destRegion.back = 1; pd3dDeviceContext->UpdateSubresource( pDestTexture, 0, destRegion, pData, rowPitch, 0 ); For info about various resource types and how UpdateSubresource might work with each resource type, see Introduction to a Resource in Direct3D 11.
UpdateSubresourceSafe(ref DataBox, Resource?, int, int, ResourceRegion, bool)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresourceSafe(ref DataBox source, Resource? resource, int srcBytesPerElement, int subresource, ResourceRegion region, bool isCompressedResource = false)
Parameters
sourceDataBoxThe source.
resourceResourceThe resource.
srcBytesPerElementintThe size in bytes per pixel/block element.
subresourceintThe subresource.
regionResourceRegionThe region.
isCompressedResourceboolif set to true the resource is a block/compressed resource
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresourceSafe(ref DataBox, Resource?, int, int, bool)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresourceSafe(ref DataBox source, Resource? resource, int srcBytesPerElement, int subresource = 0, bool isCompressedResource = false)
Parameters
sourceDataBoxThe source.
resourceResourceThe resource.
srcBytesPerElementintThe size in bytes per pixel/block element.
subresourceintThe subresource.
isCompressedResourceboolif set to true the resource is a block/compressed resource
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresourceSafe<T>(ref T, Resource?, int, int, int, int, bool)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresourceSafe<T>(ref T data, Resource? resource, int srcBytesPerElement, int subresource = 0, int rowPitch = 0, int depthPitch = 0, bool isCompressedResource = false) where T : unmanaged
Parameters
dataTThe data.
resourceResourceThe resource.
srcBytesPerElementintThe size in bytes per pixel/block element.
subresourceintThe subresource.
rowPitchintThe row pitch.
depthPitchintThe depth pitch.
isCompressedResourceboolif set to
true[is compressed resource].
Type Parameters
T
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresourceSafe<T>(T[], Resource?, int, int, int, int, bool)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresourceSafe<T>(T[] data, Resource? resource, int srcBytesPerElement, int subresource = 0, int rowPitch = 0, int depthPitch = 0, bool isCompressedResource = false) where T : unmanaged
Parameters
dataT[]The data.
resourceResourceThe resource.
srcBytesPerElementintThe size in bytes per pixel/block element.
subresourceintThe subresource.
rowPitchintThe row pitch.
depthPitchintThe depth pitch.
isCompressedResourceboolif set to true the resource is a block/compressed resource
Type Parameters
T
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresource<T>(ref T, Resource?, int, int, int, ResourceRegion?)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresource<T>(ref T data, Resource? resource, int subresource = 0, int rowPitch = 0, int depthPitch = 0, ResourceRegion? region = null) where T : unmanaged
Parameters
dataTThe data.
resourceResourceThe resource.
subresourceintThe subresource.
rowPitchintThe row pitch.
depthPitchintThe depth pitch.
regionResourceRegion?The region.
Type Parameters
T
Remarks
This method is implementing the workaround for deferred context.
UpdateSubresource<T>(T[], Resource?, int, int, int, ResourceRegion?)
Copies data from the CPU to to a non-mappable subresource region.
public void UpdateSubresource<T>(T[] data, Resource? resource, int subresource = 0, int rowPitch = 0, int depthPitch = 0, ResourceRegion? region = null) where T : unmanaged
Parameters
dataT[]The data.
resourceResourceThe resource.
subresourceintThe subresource.
rowPitchintThe row pitch.
depthPitchintThe depth pitch.
regionResourceRegion?A region that defines the portion of the destination subresource to copy the resource data into. Coordinates are in bytes for buffers and in texels for textures.
Type Parameters
T
Remarks
This method is implementing the workaround for deferred context.
Operators
explicit operator DeviceContext1?(DeviceContextProxy)
Performs an implicit conversion from DeviceContextProxy to SharpDX.Direct3D11.DeviceContext1.
public static explicit operator DeviceContext1?(DeviceContextProxy proxy)
Parameters
proxyDeviceContextProxyThe proxy.
Returns
- DeviceContext1
The result of the conversion.
implicit operator Device1(DeviceContextProxy)
Performs an implicit conversion from DeviceContextProxy to SharpDX.Direct3D11.Device1.
public static implicit operator Device1(DeviceContextProxy proxy)
Parameters
proxyDeviceContextProxyThe proxy.
Returns
- Device1
The result of the conversion.