EffectPools { get; private set; }
-
- ///
- /// Gets the back buffer sets by the current setup on this device.
- ///
- /// The back buffer. The returned value may be null if no are setup on this device.
- public RenderTarget2D BackBuffer
- {
- get { return Presenter != null ? Presenter.BackBuffer : null; }
- }
-
- ///
- /// Gets the depth stencil buffer sets by the current setup on this device.
- ///
- /// The depth stencil buffer. The returned value may be null if no are setup on this device or no depth buffer was allocated.
- public DepthStencilBuffer DepthStencilBuffer
- {
- get { return Presenter != null ? Presenter.DepthStencilBuffer : null; }
- }
-
- ///
- /// Gets or sets the current presenter use by the method.
- ///
- /// The current presenter.
- public GraphicsPresenter Presenter { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the viewport is automatically calculated and set when a render target is set. Default is true.
- ///
- /// true if the viewport is automatically calculated and set when a render target is set; otherwise, false.
- public bool AutoViewportFromRenderTargets { get; set; }
-
- ///
- /// Gets the status of this device.
- ///
- /// ff476526
- /// GetDeviceRemovedReason
- /// GetDeviceRemovedReason
- /// HRESULT ID3D11Device::GetDeviceRemovedReason()
- public GraphicsDeviceStatus GraphicsDeviceStatus
- {
- get
- {
- var result = ((Device)MainDevice).DeviceRemovedReason;
- if (result == DXGI.ResultCode.DeviceRemoved)
- {
- return GraphicsDeviceStatus.Removed;
- }
-
- if (result == DXGI.ResultCode.DeviceReset)
- {
- return GraphicsDeviceStatus.Reset;
- }
-
- if (result == DXGI.ResultCode.DeviceHung)
- {
- return GraphicsDeviceStatus.Hung;
- }
-
- if (result == DXGI.ResultCode.DriverInternalError)
- {
- return GraphicsDeviceStatus.InternalError;
- }
-
- if (result == DXGI.ResultCode.InvalidCall)
- {
- return GraphicsDeviceStatus.InvalidCall;
- }
-
- if (result.Code < 0)
- {
- return GraphicsDeviceStatus.Reset;
- }
-
- return GraphicsDeviceStatus.Normal;
- }
- }
-
- ///
- /// Gets the access to performance profiler.
- ///
- /// The access to performance profiler.
- public GraphicsPerformance Performance { get; private set; }
-
- ///
- /// Gets the default quad primitive to issue draw commands.
- ///
- /// The default quad primitive to issue draw commands.
- public PrimitiveQuad Quad
- {
- get
- {
- return primitiveQuad;
- }
- }
-
- ///
- /// Clears the default render target and depth stencil buffer attached to the current .
- ///
- /// Set this color value in all buffers.
- /// Cannot clear without a Presenter set on this instance
- public void Clear(Color4 color)
- {
- var options = currentRenderTargetView != null ? ClearOptions.Target : (ClearOptions)0;
-
- if (currentDepthStencilView != null)
- {
- var textureView = currentDepthStencilView.Tag as TextureView;
- DepthStencilBuffer depthStencilBuffer;
-
- if (textureView == null || (depthStencilBuffer = textureView.Texture as DepthStencilBuffer) == null)
- {
- throw new InvalidOperationException("Clear on a custom DepthStencilView is not supported by this method. Use Clear(DepthStencilView) directly");
- }
-
- options |= depthStencilBuffer.HasStencil ? ClearOptions.DepthBuffer | ClearOptions.Stencil : ClearOptions.DepthBuffer;
-
- }
-
- Clear(options, color, 1f, 0);
- }
-
- ///
- /// Clears the default render target and depth stencil buffer attached to the current .
- ///
- /// Options for clearing a buffer.
- /// Set this four-component color value in the buffer.
- /// Set this depth value in the buffer.
- /// Set this stencil value in the buffer.
- public void Clear(ClearOptions options, Color4 color, float depth, int stencil)
- {
- if ((options & ClearOptions.Target) != 0)
- {
- if (currentRenderTargetView == null)
- {
- throw new InvalidOperationException("No default render target view setup. Call SetRenderTargets before calling this method.");
- }
- Clear(currentRenderTargetView, color);
- }
-
- if ((options & (ClearOptions.Stencil | ClearOptions.DepthBuffer)) != 0)
- {
- if (currentDepthStencilView == null)
- {
- throw new InvalidOperationException("No default depth stencil view setup. Call SetRenderTargets before calling this method.");
- }
-
- var flags = (options & ClearOptions.DepthBuffer) != 0 ? DepthStencilClearFlags.Depth : 0;
- if ((options & ClearOptions.Stencil) != 0)
- {
- flags |= DepthStencilClearFlags.Stencil;
- }
-
- Clear(currentDepthStencilView, flags, depth, (byte)stencil);
- }
- }
-
- ///
- /// Clears the default render target and depth stencil buffer attached to the current .
- ///
- /// Options for clearing a buffer.
- /// Set this four-component color value in the buffer.
- /// Set this depth value in the buffer.
- /// Set this stencil value in the buffer.
- public void Clear(ClearOptions options, Vector4 color, float depth, int stencil)
- {
- Clear(options, (Color4)color, depth, stencil);
- }
-
- ///
- /// Clears a render target view by setting all the elements in a render target to one value.
- ///
- /// The render target view.
- /// A 4-component array that represents the color to fill the render target with.
- /// 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. |
?
- /// ff476388
- /// void ID3D11DeviceContext::ClearRenderTargetView([In] ID3D11RenderTargetView* pRenderTargetView,[In] const SHARPDX_COLOR4* ColorRGBA)
- /// ID3D11DeviceContext::ClearRenderTargetView
- public void Clear(SharpDX.Direct3D11.RenderTargetView renderTargetView, Color4 colorRGBA)
- {
- Context.ClearRenderTargetView(renderTargetView, colorRGBA);
- }
-
- ///
- /// Clears the depth-stencil resource.
- ///
- /// Pointer to the depth stencil to be cleared.
- /// Identify the type of data to clear (see ).
- /// Clear the depth buffer with this value. This value will be clamped between 0 and 1.
- /// Clear the stencil buffer with this value.
- ///
- /// 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. |
?
- ///
- /// ff476387
- /// void ID3D11DeviceContext::ClearDepthStencilView([In] ID3D11DepthStencilView* pDepthStencilView,[In] D3D11_CLEAR_FLAG ClearFlags,[In] float Depth,[In] unsigned char Stencil)
- /// ID3D11DeviceContext::ClearDepthStencilView
- public void Clear(SharpDX.Direct3D11.DepthStencilView depthStencilView, SharpDX.Direct3D11.DepthStencilClearFlags clearFlags, float depth, byte stencil)
- {
- Context.ClearDepthStencilView(depthStencilView, clearFlags, depth, stencil);
- }
-
- ///
- /// Clears an unordered access resource with bit-precise values.
- ///
- /// The buffer to clear.
- /// The value used to clear.
- ///
- /// 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.
- ///
- /// ff476391
- /// void ID3D11DeviceContext::ClearUnorderedAccessViewUint([In] ID3D11UnorderedAccessView* pUnorderedAccessView,[In] const unsigned int* Values)
- /// ID3D11DeviceContext::ClearUnorderedAccessViewUint
- public void Clear(UnorderedAccessView view, Int4 value)
- {
- Context.ClearUnorderedAccessView(view, value);
- }
-
- ///
- /// Clears an unordered access resource with a float value.
- ///
- /// The buffer to clear.
- /// The value used to clear.
- ///
- /// 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.
- ///
- /// ff476390
- /// void ID3D11DeviceContext::ClearUnorderedAccessViewFloat([In] ID3D11UnorderedAccessView* pUnorderedAccessView,[In] const float* Values)
- /// ID3D11DeviceContext::ClearUnorderedAccessViewFloat
- public void Clear(UnorderedAccessView view, Vector4 value)
- {
- Context.ClearUnorderedAccessView(view, value);
- }
-
- ///
- /// Copies the content of this resource to another .
- ///
- /// The resource to copy from.
- /// The resource to copy to.
- /// See the unmanaged documentation for usage and restrictions.
- /// ff476392
- /// void ID3D11DeviceContext::CopyResource([In] ID3D11Resource* pDstResource,[In] ID3D11Resource* pSrcResource)
- /// ID3D11DeviceContext::CopyResource
- public void Copy(Direct3D11.Resource fromResource, Direct3D11.Resource toResource)
- {
- Context.CopyResource(fromResource, toResource);
- }
-
- ///
- /// Copy a region from a source resource to a destination resource.
- ///
- ///
- /// 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 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.
- ///
- /// A reference to the source resource (see ).
- /// Source subresource index.
- /// A reference to the destination resource (see ).
- /// Destination subresource index.
- /// The x-coordinate of the upper left corner of the destination region.
- /// The y-coordinate of the upper left corner of the destination region. For a 1D subresource, this must be zero.
- /// The z-coordinate of the upper left corner of the destination region. For a 1D or 2D subresource, this must be zero.
- /// ff476394
- /// void ID3D11DeviceContext::CopySubresourceRegion([In] ID3D11Resource* pDstResource,[In] unsigned int DstSubresource,[In] unsigned int DstX,[In] unsigned int DstY,[In] unsigned int DstZ,[In] ID3D11Resource* pSrcResource,[In] unsigned int SrcSubresource,[In, Optional] const D3D11_BOX* pSrcBox)
- /// ID3D11DeviceContext::CopySubresourceRegion
- public void Copy(SharpDX.Direct3D11.Resource source, int sourceSubresource, SharpDX.Direct3D11.Resource destination, int destinationSubResource, int dstX = 0, int dstY = 0, int dstZ = 0)
- {
- Context.CopySubresourceRegion(source, sourceSubresource, null, destination, destinationSubResource, dstX, dstY, dstZ);
- }
-
- ///
- /// Copy a region from a source resource to a destination resource.
- ///
- ///
- /// 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 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.
- ///
- /// A reference to the source resource (see ).
- /// Source subresource index.
- /// A reference to a 3D box (see ) 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.
- /// A reference to the destination resource (see ).
- /// Destination subresource index.
- /// The x-coordinate of the upper left corner of the destination region.
- /// The y-coordinate of the upper left corner of the destination region. For a 1D subresource, this must be zero.
- /// The z-coordinate of the upper left corner of the destination region. For a 1D or 2D subresource, this must be zero.
- /// ff476394
- /// void ID3D11DeviceContext::CopySubresourceRegion([In] ID3D11Resource* pDstResource,[In] unsigned int DstSubresource,[In] unsigned int DstX,[In] unsigned int DstY,[In] unsigned int DstZ,[In] ID3D11Resource* pSrcResource,[In] unsigned int SrcSubresource,[In, Optional] const D3D11_BOX* pSrcBox)
- /// ID3D11DeviceContext::CopySubresourceRegion
- public void Copy(SharpDX.Direct3D11.Resource source, int sourceSubresource, SharpDX.Direct3D11.ResourceRegion sourceRegion, SharpDX.Direct3D11.Resource destination, int destinationSubResource, int dstX = 0, int dstY = 0, int dstZ = 0)
- {
- Context.CopySubresourceRegion(source, sourceSubresource, sourceRegion, destination, destinationSubResource, dstX, dstY, dstZ);
- }
-
- ///
- /// Copy a multisampled resource into a non-multisampled resource.
- ///
- ///
- /// 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 ?
- ///
- /// Source resource. Must be multisampled.
- /// >The source subresource of the source resource.
- /// Destination resource. Must be a created with the flag and be single-sampled. See .
- /// A zero-based index, that identifies the destination subresource. Use {{D3D11CalcSubresource}} to calculate the index.
- /// A that indicates how the multisampled resource will be resolved to a single-sampled resource. See remarks.
- /// void ID3D11DeviceContext::ResolveSubresource([In] ID3D11Resource* pDstResource,[In] int DstSubresource,[In] ID3D11Resource* pSrcResource,[In] int SrcSubresource,[In] DXGI_FORMAT Format)
- public void Copy(SharpDX.Direct3D11.Resource source, int sourceSubresource, SharpDX.Direct3D11.Resource destination, int destinationSubresource, SharpDX.DXGI.Format format)
- {
- Context.ResolveSubresource(source, sourceSubresource, destination, destinationSubresource, format);
- }
-
- ///
- /// Copies data from a buffer holding variable length data.
- ///
- /// Pointer to an of a Structured Buffer resource created with either or specified when the UAV was created. These types of resources have hidden counters tracking "how many" records have been written.
- /// Pointer to . This can be any buffer resource that other copy commands, such as or , are able to write to.
- /// Offset from the start of pDstBuffer to write 32-bit UINT structure (vertex) count from pSrcView.
- /// ff476393
- /// void ID3D11DeviceContext::CopyStructureCount([In] ID3D11Buffer* pDstBuffer,[In] unsigned int DstAlignedByteOffset,[In] ID3D11UnorderedAccessView* pSrcView)
- /// ID3D11DeviceContext::CopyStructureCount
- public void CopyCount(SharpDX.Direct3D11.UnorderedAccessView sourceView, SharpDX.Direct3D11.Buffer destinationBuffer, int offsetInBytes = 0)
- {
- Context.CopyStructureCount(destinationBuffer, offsetInBytes, sourceView);
- }
-
- ///
- /// Restore all default settings.
- ///
- ///
- /// 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 and throw away the resulting .
- ///
- /// ff476389
- /// void ID3D11DeviceContext::ClearState()
- /// ID3D11DeviceContext::ClearState
- public void ClearState()
- {
- Context.ClearState();
- }
-
- private PrimitiveTopology PrimitiveType
- {
- set
- {
- InputAssemblerStage.PrimitiveTopology = value;
- }
- }
-
- ///
- /// Draw indexed, non-instanced primitives.
- ///
- /// Type of the primitive to draw.
- /// Number of indices to draw.
- /// The location of the first index read by the GPU from the index buffer.
- /// A value added to each index before reading a vertex from the vertex buffer.
- ///
- /// 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.
- ///
- /// ff476409
- /// void ID3D11DeviceContext::DrawIndexed([In] unsigned int IndexCount,[In] unsigned int StartIndexLocation,[In] int BaseVertexLocation)
- /// ID3D11DeviceContext::DrawIndexed
- public void DrawIndexed(PrimitiveType primitiveType, int indexCount, int startIndexLocation = 0, int baseVertexLocation = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawIndexed(indexCount, startIndexLocation, baseVertexLocation);
- }
-
- ///
- /// Draw non-indexed, non-instanced primitives.
- ///
- /// Type of the primitive to draw.
- /// Number of vertices to draw.
- /// Index of the first vertex, which is usually an offset in a vertex buffer; it could also be used as the first vertex id generated for a shader parameter marked with the SV_TargetId system-value semantic.
- ///
- /// A draw API 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. However, you could also provide the vertex data from a shader that has vertex data marked with the SV_VertexId system-value semantic.
- ///
- /// ff476407
- /// void ID3D11DeviceContext::Draw([In] unsigned int VertexCount,[In] unsigned int StartVertexLocation)
- /// ID3D11DeviceContext::Draw
- public void Draw(PrimitiveType primitiveType, int vertexCount, int startVertexLocation = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.Draw(vertexCount, startVertexLocation);
- }
-
- ///
- /// Draw indexed, instanced primitives.
- ///
- /// Type of the primitive to draw.
- /// Number of indices read from the index buffer for each instance.
- /// Number of instances to draw.
- /// The location of the first index read by the GPU from the index buffer.
- /// A value added to each index before reading a vertex from the vertex buffer.
- /// A value added to each index before reading per-instance data from a vertex buffer.
- ///
- /// 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. Indexing requires multiple vertex buffers: at least one for per-vertex data and a second buffer for per-instance data.
- ///
- /// ff476410
- /// void ID3D11DeviceContext::DrawIndexedInstanced([In] unsigned int IndexCountPerInstance,[In] unsigned int InstanceCount,[In] unsigned int StartIndexLocation,[In] int BaseVertexLocation,[In] unsigned int StartInstanceLocation)
- /// ID3D11DeviceContext::DrawIndexedInstanced
- public void DrawIndexedInstanced(PrimitiveType primitiveType, int indexCountPerInstance, int instanceCount, int startIndexLocation = 0, int baseVertexLocation = 0, int startInstanceLocation = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawIndexedInstanced(indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation);
- }
-
- ///
- /// Draw non-indexed, instanced primitives.
- ///
- /// Type of the primitive to draw.
- /// Number of vertices to draw.
- /// Number of instances to draw.
- /// Index of the first vertex.
- /// A value added to each index before reading per-instance data from a vertex buffer.
- ///
- /// 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).
- ///
- /// ff476412
- /// void ID3D11DeviceContext::DrawInstanced([In] unsigned int VertexCountPerInstance,[In] unsigned int InstanceCount,[In] unsigned int StartVertexLocation,[In] unsigned int StartInstanceLocation)
- /// ID3D11DeviceContext::DrawInstanced
- public void DrawInstanced(PrimitiveType primitiveType, int vertexCountPerInstance, int instanceCount, int startVertexLocation = 0, int startInstanceLocation = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawInstanced(vertexCountPerInstance, instanceCount, startVertexLocation, startInstanceLocation);
- }
-
- ///
- /// Draw geometry of an unknown size.
- ///
- /// Type of the primitive to draw.
- ///
- /// 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, and .
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 .
- ///
- /// ff476408
- /// void ID3D11DeviceContext::DrawAuto()
- /// ID3D11DeviceContext::DrawAuto
- public void DrawAuto(PrimitiveType primitiveType)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawAuto();
- }
-
- ///
- /// Draw indexed, instanced, GPU-generated primitives.
- ///
- /// Type of the primitive to draw.
- /// A reference to an , which is a buffer containing the GPU generated primitives.
- /// Offset in pBufferForArgs to the start of the GPU generated primitives.
- ///
- /// When an application creates a buffer that is associated with the interface that pBufferForArgs points to, the application must set the flag in the MiscFlags member of the structure that describes the buffer. To create the buffer, the application calls the method and in this call passes a reference to in the pDesc parameter.
- ///
- /// ff476411
- /// void ID3D11DeviceContext::DrawIndexedInstancedIndirect([In] ID3D11Buffer* pBufferForArgs,[In] unsigned int AlignedByteOffsetForArgs)
- /// ID3D11DeviceContext::DrawIndexedInstancedIndirect
- public void DrawIndexedInstanced(PrimitiveType primitiveType, SharpDX.Direct3D11.Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawIndexedInstancedIndirect(argumentsBuffer, alignedByteOffsetForArgs);
- }
-
- ///
- /// Draw instanced, GPU-generated primitives.
- ///
- /// Type of the primitive to draw.
- /// A reference to an , which is a buffer containing the GPU generated primitives.
- /// Offset in pBufferForArgs to the start of the GPU generated primitives.
- ///
- /// When an application creates a buffer that is associated with the interface that pBufferForArgs points to, the application must set the flag in the MiscFlags member of the structure that describes the buffer. To create the buffer, the application calls the method and in this call passes a reference to in the pDesc parameter.
- ///
- /// ff476413
- /// void ID3D11DeviceContext::DrawInstancedIndirect([In] ID3D11Buffer* pBufferForArgs,[In] unsigned int AlignedByteOffsetForArgs)
- /// ID3D11DeviceContext::DrawInstancedIndirect
- public void DrawInstanced(PrimitiveType primitiveType, SharpDX.Direct3D11.Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)
- {
- SetupInputLayout();
-
- PrimitiveType = primitiveType;
- Context.DrawInstancedIndirect(argumentsBuffer, alignedByteOffsetForArgs);
- }
-
- ///
- /// Execute a command list from a thread group.
- ///
- /// The number of groups dispatched in the x direction. ThreadGroupCountX must be less than (65535).
- /// The number of groups dispatched in the y direction. ThreadGroupCountY must be less than (65535).
- /// The number of groups dispatched in the z direction. ThreadGroupCountZ must be less than (65535). In feature level 10 the value for ThreadGroupCountZ must be 1.
- ///
- /// 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 , 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).
- ///
- /// ff476405
- /// void ID3D11DeviceContext::Dispatch([In] unsigned int ThreadGroupCountX,[In] unsigned int ThreadGroupCountY,[In] unsigned int ThreadGroupCountZ)
- /// ID3D11DeviceContext::Dispatch
- public void Dispatch(int threadGroupCountX, int threadGroupCountY, int threadGroupCountZ)
- {
- Context.Dispatch(threadGroupCountX, threadGroupCountY, threadGroupCountZ);
- }
-
- ///
- /// Execute a command list over one or more thread groups.
- ///
- /// A reference to an , which must be loaded with data that matches the argument list for .
- /// A byte-aligned offset between the start of the buffer and the arguments.
- ///
- /// You call the DispatchIndirect method to execute commands in a compute shader.
When an application creates a buffer that is associated with the interface that pBufferForArgs points to, the application must set the flag in the MiscFlags member of the structure that describes the buffer. To create the buffer, the application calls the method and in this call passes a reference to in the pDesc parameter.
- ///
- /// ff476406
- /// void ID3D11DeviceContext::DispatchIndirect([In] ID3D11Buffer* pBufferForArgs,[In] unsigned int AlignedByteOffsetForArgs)
- /// ID3D11DeviceContext::DispatchIndirect
- public void Dispatch(SharpDX.Direct3D11.Buffer argumentsBuffer, int alignedByteOffsetForArgs = 0)
- {
- Context.DispatchIndirect(argumentsBuffer, alignedByteOffsetForArgs);
- }
-
- ///
- /// Sends queued-up commands in the command buffer to the graphics processing unit (GPU).
- ///
- ///
- /// 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 method with the value to create an event query; you can then use that event query in a call to the 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 , and then call Flush.
Deferred Destruction Issues with Flip Presentation Swap ChainsDirect3D?11 defers the destruction of objects like views and resources until it can efficiently destroy them. This deferred destruction can cause problems with flip presentation model swap chains. Flip presentation model swap chains have the DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL flag set. When you create a flip presentation model swap chain, you can associate only one swap chain at a time with an , IWindow, or composition surface. If an application attempts to destroy a flip presentation model swap chain and replace it with another swap chain, the original swap chain is not destroyed when the application immediately frees all of the original swap chain's references.
Most applications typically use the method for the majority of scenarios where they replace new swap chain buffers for old swap chain buffers. However, if an application must actually destroy an old swap chain and create a new swap chain, the application must force the destruction of all objects that the application freed. To force the destruction, call (or otherwise ensure no views are bound to pipeline state), and then call Flush on the immediate context. You must force destruction before you call IDXGIFactory2::CreateSwapChainForHwnd, IDXGIFactory2::CreateSwapChainForImmersiveWindow, or IDXGIFactory2::CreateSwapChainForCompositionSurface again to create a new swap chain.
- ///
- /// ff476425
- /// void ID3D11DeviceContext::Flush()
- /// ID3D11DeviceContext::Flush
- public void Flush()
- {
- Context.Flush();
- }
-
- ///
- /// Creates a new from an existing .
- ///
- /// An existing device.
- /// A new instance of .
- public static GraphicsDevice New(SharpDX.Direct3D11.Device existingDevice)
- {
- return new GraphicsDevice(existingDevice);
- }
-
- ///
- /// Creates a new using .
- ///
- /// The flags.
- /// The feature levels.
- /// A new instance of
- public static GraphicsDevice New(DeviceCreationFlags flags = DeviceCreationFlags.None, params FeatureLevel[] featureLevels)
- {
- return New(DriverType.Hardware, flags, featureLevels);
- }
-
- ///
- /// Creates a new .
- ///
- /// The type.
- /// The flags.
- /// The feature levels.
- /// A new instance of .
- public static GraphicsDevice New(DriverType type, DeviceCreationFlags flags = DeviceCreationFlags.None, params FeatureLevel[] featureLevels)
- {
- if (type == DriverType.Hardware)
- return new GraphicsDevice(GraphicsAdapter.Default, flags, featureLevels);
-
- return new GraphicsDevice(type, flags, featureLevels);
- }
-
- ///
- /// Creates a new .
- ///
- /// The graphics adapter to use.
- /// The flags.
- /// The feature levels.
- /// A new instance of .
- public static GraphicsDevice New(GraphicsAdapter adapter, DeviceCreationFlags flags = DeviceCreationFlags.None, params FeatureLevel[] featureLevels)
- {
- return new GraphicsDevice(adapter, flags, featureLevels);
- }
-
- ///
- /// Creates a new deferred .
- ///
- /// A deferred .
- public GraphicsDevice NewDeferred()
- {
- return new GraphicsDevice(this, new DeviceContext(Device));
- }
-
- ///
- /// Sets the blend state of the output-merger stage.
- ///
- /// Pointer to a blend-state interface (see ). Passing in null implies a default blend state. See remarks for further details.
- ///
- /// Blend state is used by the output-merger stage to determine how to blend together two pixel values. The two values are commonly the current pixel value and the pixel value already in the output render target. Use the blend operation to control where the two pixel values come from and how they are mathematically combined.
To create a blend-state interface, call .
Passing in null for the blend-state interface indicates to the runtime to set a default blending state. The following table indicates the default blending parameters.
State | Default Value |
AlphaToCoverageEnable | |
BlendEnable | [8] |
SrcBlend | |
DstBlend | |
BlendOp | |
SrcBlendAlpha | |
DstBlendAlpha | |
BlendOpAlpha | |
RenderTargetWriteMask[8] | [8] |
?
A sample mask determines which samples get updated in all the active render targets. The mapping of bits in a sample mask to samples in a multisample render target is the responsibility of an individual application. A sample mask is always applied; it is independent of whether multisampling is enabled, and does not depend on whether an application uses multisample render targets.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
- ///
- /// ff476462
- /// void ID3D11DeviceContext::OMSetBlendState([In, Optional] ID3D11BlendState* pBlendState,[In, Optional] const SHARPDX_COLOR4* BlendFactor,[In] unsigned int SampleMask)
- /// ID3D11DeviceContext::OMSetBlendState
- public void SetBlendState(BlendState blendState)
- {
- if (blendState == null)
- {
- OutputMergerStage.SetBlendState(null, Color.White, -1);
- }
- else
- {
- OutputMergerStage.SetBlendState(blendState, blendState.BlendFactor, blendState.MultiSampleMask);
- }
- }
-
- ///
- /// Sets the blend state of the output-merger stage.
- ///
- /// Pointer to a blend-state interface (see ). Passing in null implies a default blend state. See remarks for further details.
- /// Array of blend factors, one for each RGBA component. This requires a blend state object that specifies the option.
- /// 32-bit sample coverage. The default value is 0xffffffff. See remarks.
- ///
- /// Blend state is used by the output-merger stage to determine how to blend together two pixel values. The two values are commonly the current pixel value and the pixel value already in the output render target. Use the blend operation to control where the two pixel values come from and how they are mathematically combined.
To create a blend-state interface, call .
Passing in null for the blend-state interface indicates to the runtime to set a default blending state. The following table indicates the default blending parameters.
State | Default Value |
AlphaToCoverageEnable | |
BlendEnable | [8] |
SrcBlend | |
DstBlend | |
BlendOp | |
SrcBlendAlpha | |
DstBlendAlpha | |
BlendOpAlpha | |
RenderTargetWriteMask[8] | [8] |
?
A sample mask determines which samples get updated in all the active render targets. The mapping of bits in a sample mask to samples in a multisample render target is the responsibility of an individual application. A sample mask is always applied; it is independent of whether multisampling is enabled, and does not depend on whether an application uses multisample render targets.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
- ///
- /// ff476462
- /// void ID3D11DeviceContext::OMSetBlendState([In, Optional] ID3D11BlendState* pBlendState,[In, Optional] const SHARPDX_COLOR4* BlendFactor,[In] unsigned int SampleMask)
- /// ID3D11DeviceContext::OMSetBlendState
- public void SetBlendState(BlendState blendState, Color4 blendFactor, int multiSampleMask = -1)
- {
- if (blendState == null)
- {
- OutputMergerStage.SetBlendState(null, blendFactor, multiSampleMask);
- }
- else
- {
- OutputMergerStage.SetBlendState(blendState, blendFactor, multiSampleMask);
- }
- }
-
- ///
- /// Sets the blend state of the output-merger stage.
- ///
- /// Pointer to a blend-state interface (see ). Passing in null implies a default blend state. See remarks for further details.
- /// Array of blend factors, one for each RGBA component. This requires a blend state object that specifies the option.
- /// 32-bit sample coverage. The default value is 0xffffffff. See remarks.
- ///
- /// Blend state is used by the output-merger stage to determine how to blend together two pixel values. The two values are commonly the current pixel value and the pixel value already in the output render target. Use the blend operation to control where the two pixel values come from and how they are mathematically combined.
To create a blend-state interface, call .
Passing in null for the blend-state interface indicates to the runtime to set a default blending state. The following table indicates the default blending parameters.
State | Default Value |
AlphaToCoverageEnable | |
BlendEnable | [8] |
SrcBlend | |
DstBlend | |
BlendOp | |
SrcBlendAlpha | |
DstBlendAlpha | |
BlendOpAlpha | |
RenderTargetWriteMask[8] | [8] |
?
A sample mask determines which samples get updated in all the active render targets. The mapping of bits in a sample mask to samples in a multisample render target is the responsibility of an individual application. A sample mask is always applied; it is independent of whether multisampling is enabled, and does not depend on whether an application uses multisample render targets.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
- ///
- /// ff476462
- /// void ID3D11DeviceContext::OMSetBlendState([In, Optional] ID3D11BlendState* pBlendState,[In, Optional] const SHARPDX_COLOR4* BlendFactor,[In] unsigned int SampleMask)
- /// ID3D11DeviceContext::OMSetBlendState
- public void SetBlendState(BlendState blendState, Color4 blendFactor, uint multiSampleMask = 0xFFFFFFFF)
- {
- SetBlendState(blendState, blendFactor, unchecked((int)multiSampleMask));
- }
-
- ///
- /// Sets the depth-stencil state of the output-merger stage.
- ///
- /// Pointer to a depth-stencil state interface (see ) to bind to the device. Set this to null to use the default state listed in .
- /// Reference value to perform against when doing a depth-stencil test. See remarks.
- ///
- /// To create a depth-stencil state interface, call .
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
- ///
- /// ff476463
- /// void ID3D11DeviceContext::OMSetDepthStencilState([In, Optional] ID3D11DepthStencilState* pDepthStencilState,[In] unsigned int StencilRef)
- /// ID3D11DeviceContext::OMSetDepthStencilState
- public void SetDepthStencilState(DepthStencilState depthStencilState, int stencilReference = 0)
- {
- OutputMergerStage.SetDepthStencilState(depthStencilState, stencilReference);
- }
-
- ///
- /// Sets the rasterizer state for the rasterizer stage of the pipeline.
- ///
- /// The rasterizer state to set on this device.
- /// ff476479
- /// void ID3D11DeviceContext::RSSetState([In, Optional] ID3D11RasterizerState* pRasterizerState)
- /// ID3D11DeviceContext::RSSetState
- public void SetRasterizerState(RasterizerState rasterizerState)
- {
- RasterizerStage.State = rasterizerState;
- }
-
- ///
- /// Binds a single scissor rectangle to the rasterizer stage.
- ///
- /// The left.
- /// The top.
- /// The right.
- /// The bottom.
- ///
- /// 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 ).
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 ).
- ///
- /// ff476478
- /// void ID3D11DeviceContext::RSSetScissorRects([In] unsigned int NumRects,[In, Buffer, Optional] const void* pRects)
- /// ID3D11DeviceContext::RSSetScissorRects
- public void SetScissorRectangles(int left, int top, int right, int bottom)
- {
- RasterizerStage.SetScissorRectangle(left, top, right, bottom);
- }
-
- ///
- /// Binds a set of scissor rectangles to the rasterizer stage.
- ///
- /// The set of scissor rectangles to bind.
- ///
- /// 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 ).
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 ).
- ///
- /// ff476478
- /// void ID3D11DeviceContext::RSSetScissorRects([In] unsigned int NumRects,[In, Buffer, Optional] const void* pRects)
- /// ID3D11DeviceContext::RSSetScissorRects
- public void SetScissorRectangles(params Rectangle[] scissorRectangles)
- {
- RasterizerStage.SetScissorRectangles(scissorRectangles);
- }
-
- ///
- /// Gets the main viewport.
- ///
- /// The main viewport.
- public ViewportF Viewport
- {
- get
- {
- RasterizerStage.GetViewports(viewports);
- return viewports[0];
- }
-
- set
- {
- SetViewport(value);
- }
- }
-
- ///
- /// Gets the viewport.
- ///
- /// The index.
- /// Returns a viewport bound to a specified render target
- public ViewportF GetViewport(int index)
- {
- RasterizerStage.GetViewports(viewports);
- return viewports[index];
- }
-
- ///
- /// Binds a single viewport to the rasterizer stage.
- ///
- /// The x coordinate of the viewport.
- /// The y coordinate of the viewport.
- /// The width.
- /// The height.
- /// The min Z.
- /// The max Z.
- ///
- /// 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.
- ///
- /// ff476480
- /// void ID3D11DeviceContext::RSSetViewports([In] unsigned int NumViewports,[In, Buffer, Optional] const void* pViewports)
- /// ID3D11DeviceContext::RSSetViewports
- public void SetViewport(float x, float y, float width, float height, float minZ = 0.0f, float maxZ = 1.0f)
- {
- viewports[0] = new ViewportF(x, y, width, height, minZ, maxZ);
- RasterizerStage.SetViewport(x, y, width, height, minZ, maxZ);
- }
-
- ///
- /// Binds a single viewport to the rasterizer stage.
- ///
- /// The viewport.
- ///
- /// 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.
- ///
- /// ff476480
- /// void ID3D11DeviceContext::RSSetViewports([In] unsigned int NumViewports,[In, Buffer, Optional] const void* pViewports)
- /// ID3D11DeviceContext::RSSetViewports
- public void SetViewport(ViewportF viewport)
- {
- viewports[0] = viewport;
- RasterizerStage.SetViewport(viewport);
- }
-
- ///
- /// Binds a set of viewports to the rasterizer stage.
- ///
- /// The set of viewports to bind.
- ///
- /// 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.
- ///
- /// ff476480
- /// void ID3D11DeviceContext::RSSetViewports([In] unsigned int NumViewports,[In, Buffer, Optional] const void* pViewports)
- /// ID3D11DeviceContext::RSSetViewports
- public void SetViewports(params ViewportF[] viewports)
- {
- for (int i = 0; i < viewports.Length; i++)
- this.viewports[i] = viewports[i];
-
- RasterizerStage.SetViewports(this.viewports, viewports.Length);
- }
-
- ///
- /// Unbinds all depth-stencil buffer and render targets from the output-merger stage.
- ///
- /// ff476464
- /// void ID3D11DeviceContext::OMSetRenderTargets([In] unsigned int NumViews,[In] const void** ppRenderTargetViews,[In, Optional] ID3D11DepthStencilView* pDepthStencilView)
- /// ID3D11DeviceContext::OMSetRenderTargets
- public void ResetTargets()
- {
- for (int i = 0; i < currentRenderTargetViews.Length; i++)
- currentRenderTargetViews[i] = null;
- actualRenderTargetViewCount = 0;
- currentRenderTargetView = null;
- currentDepthStencilView = null;
- OutputMergerStage.ResetTargets();
- }
-
- ///
- /// Gets the render targets currently bound to the through this instance.
- ///
- /// The depth stencil view, may ne null.
- /// An array of .
- public RenderTargetView[] GetRenderTargets(out DepthStencilView depthStencilViewRef)
- {
- var renderTargets = new RenderTargetView[actualRenderTargetViewCount];
- for (int i = 0; i < actualRenderTargetViewCount; i++)
- renderTargets[i] = currentRenderTargetViews[i];
- depthStencilViewRef = currentDepthStencilView;
- return renderTargets;
- }
-
- ///
- /// Bind one or more render targets atomically and the depth-stencil buffer to the output-merger stage.
- ///
- /// A set of render target views to bind.
- ///
- /// The maximum number of active render targets a device can have active at any given time is set by a #define in D3D11.h called D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT. It is invalid to try to set the same subresource to multiple render target slots. Any render targets not defined by this call are set to null.
If any subresources are also currently bound for reading in a different stage or writing (perhaps in a different part of the pipeline), those bind points will be set to null, in order to prevent the same subresource from being read and written simultaneously in a single rendering operation.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
If the render-target views were created from an array resource type, then all of the render-target views must have the same array size. This restriction also applies to the depth-stencil view, its array size must match that of the render-target views being bound.
The pixel shader must be able to simultaneously render to at least eight separate render targets. All of these render targets must access the same type of resource: Buffer, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, or TextureCube. All render targets must have the same size in all dimensions (width and height, and depth for 3D or array size for *Array types). If render targets use multisample anti-aliasing, all bound render targets and depth buffer must be the same form of multisample resource (that is, the sample counts must be the same). Each render target can have a different data format. These render target formats are not required to have identical bit-per-element counts.
Any combination of the eight slots for render targets can have a render target set or not set.
The same resource view cannot be bound to multiple render target slots simultaneously. However, you can set multiple non-overlapping resource views of a single resource as simultaneous multiple render targets.
- ///
- /// ff476464
- /// void ID3D11DeviceContext::OMSetRenderTargets([In] unsigned int NumViews,[In] const void** ppRenderTargetViews,[In, Optional] ID3D11DepthStencilView* pDepthStencilView)
- /// ID3D11DeviceContext::OMSetRenderTargets
- public void SetRenderTargets(params RenderTargetView[] renderTargetViews)
- {
- if (renderTargetViews == null)
- {
- throw new ArgumentNullException("renderTargetViews");
- }
-
- CommonSetRenderTargets(renderTargetViews);
- currentDepthStencilView = null;
- OutputMergerStage.SetTargets(renderTargetViews);
- }
-
- ///
- /// Binds a single render target to the output-merger stage.
- ///
- /// A view of the render target to bind.
- ///
- /// The maximum number of active render targets a device can have active at any given time is set by a #define in D3D11.h called D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT. It is invalid to try to set the same subresource to multiple render target slots. Any render targets not defined by this call are set to null.
If any subresources are also currently bound for reading in a different stage or writing (perhaps in a different part of the pipeline), those bind points will be set to null, in order to prevent the same subresource from being read and written simultaneously in a single rendering operation.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
If the render-target views were created from an array resource type, then all of the render-target views must have the same array size. This restriction also applies to the depth-stencil view, its array size must match that of the render-target views being bound.
The pixel shader must be able to simultaneously render to at least eight separate render targets. All of these render targets must access the same type of resource: Buffer, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, or TextureCube. All render targets must have the same size in all dimensions (width and height, and depth for 3D or array size for *Array types). If render targets use multisample anti-aliasing, all bound render targets and depth buffer must be the same form of multisample resource (that is, the sample counts must be the same). Each render target can have a different data format. These render target formats are not required to have identical bit-per-element counts.
Any combination of the eight slots for render targets can have a render target set or not set.
The same resource view cannot be bound to multiple render target slots simultaneously. However, you can set multiple non-overlapping resource views of a single resource as simultaneous multiple render targets.
- ///
- /// ff476464
- /// void ID3D11DeviceContext::OMSetRenderTargets([In] unsigned int NumViews,[In] const void** ppRenderTargetViews,[In, Optional] ID3D11DepthStencilView* pDepthStencilView)
- /// ID3D11DeviceContext::OMSetRenderTargets
- public void SetRenderTargets(RenderTargetView renderTargetView)
- {
- CommonSetRenderTargets(renderTargetView);
- currentDepthStencilView = null;
- OutputMergerStage.SetTargets(renderTargetView);
- }
-
- ///
- /// Binds a depth-stencil buffer and a set of render targets to the output-merger stage.
- ///
- /// A view of the depth-stencil buffer to bind.
- /// A set of render target views to bind.
- ///
- /// The maximum number of active render targets a device can have active at any given time is set by a #define in D3D11.h called D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT. It is invalid to try to set the same subresource to multiple render target slots. Any render targets not defined by this call are set to null.
If any subresources are also currently bound for reading in a different stage or writing (perhaps in a different part of the pipeline), those bind points will be set to null, in order to prevent the same subresource from being read and written simultaneously in a single rendering operation.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
If the render-target views were created from an array resource type, then all of the render-target views must have the same array size. This restriction also applies to the depth-stencil view, its array size must match that of the render-target views being bound.
The pixel shader must be able to simultaneously render to at least eight separate render targets. All of these render targets must access the same type of resource: Buffer, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, or TextureCube. All render targets must have the same size in all dimensions (width and height, and depth for 3D or array size for *Array types). If render targets use multisample anti-aliasing, all bound render targets and depth buffer must be the same form of multisample resource (that is, the sample counts must be the same). Each render target can have a different data format. These render target formats are not required to have identical bit-per-element counts.
Any combination of the eight slots for render targets can have a render target set or not set.
The same resource view cannot be bound to multiple render target slots simultaneously. However, you can set multiple non-overlapping resource views of a single resource as simultaneous multiple render targets.
- ///
- /// ff476464
- /// void ID3D11DeviceContext::OMSetRenderTargets([In] unsigned int NumViews,[In] const void** ppRenderTargetViews,[In, Optional] ID3D11DepthStencilView* pDepthStencilView)
- /// ID3D11DeviceContext::OMSetRenderTargets
- public void SetRenderTargets(DepthStencilView depthStencilView, params RenderTargetView[] renderTargetViews)
- {
- if (renderTargetViews == null)
- {
- throw new ArgumentNullException("renderTargetViews");
- }
-
- CommonSetRenderTargets(renderTargetViews);
- currentDepthStencilView = depthStencilView;
- OutputMergerStage.SetTargets(depthStencilView, renderTargetViews);
- }
-
- ///
- /// Binds a depth-stencil buffer and a single render target to the output-merger stage.
- ///
- /// A view of the depth-stencil buffer to bind.
- /// A view of the render target to bind.
- ///
- /// The maximum number of active render targets a device can have active at any given time is set by a #define in D3D11.h called D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT. It is invalid to try to set the same subresource to multiple render target slots. Any render targets not defined by this call are set to null.
If any subresources are also currently bound for reading in a different stage or writing (perhaps in a different part of the pipeline), those bind points will be set to null, in order to prevent the same subresource from being read and written simultaneously in a single rendering operation.
The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.
If the render-target views were created from an array resource type, then all of the render-target views must have the same array size. This restriction also applies to the depth-stencil view, its array size must match that of the render-target views being bound.
The pixel shader must be able to simultaneously render to at least eight separate render targets. All of these render targets must access the same type of resource: Buffer, Texture1D, Texture1DArray, Texture2D, Texture2DArray, Texture3D, or TextureCube. All render targets must have the same size in all dimensions (width and height, and depth for 3D or array size for *Array types). If render targets use multisample anti-aliasing, all bound render targets and depth buffer must be the same form of multisample resource (that is, the sample counts must be the same). Each render target can have a different data format. These render target formats are not required to have identical bit-per-element counts.
Any combination of the eight slots for render targets can have a render target set or not set.
The same resource view cannot be bound to multiple render target slots simultaneously. However, you can set multiple non-overlapping resource views of a single resource as simultaneous multiple render targets.
- ///
- /// ff476464
- /// void ID3D11DeviceContext::OMSetRenderTargets([In] unsigned int NumViews,[In] const void** ppRenderTargetViews,[In, Optional] ID3D11DepthStencilView* pDepthStencilView)
- /// ID3D11DeviceContext::OMSetRenderTargets
- public void SetRenderTargets(DepthStencilView depthStencilView, RenderTargetView renderTargetView)
- {
- CommonSetRenderTargets(renderTargetView);
- currentDepthStencilView = depthStencilView;
- OutputMergerStage.SetTargets(depthStencilView, renderTargetView);
- }
-
- ///
- /// Resets the stream output targets bound to the StreamOutput stage.
- ///
- /// ff476484
- /// void ID3D11DeviceContext::SOSetTargets([In] unsigned int NumBuffers,[In, Buffer, Optional] const ID3D11Buffer** ppSOTargets,[In, Buffer, Optional] const unsigned int* pOffsets)
- /// ID3D11DeviceContext::SOSetTargets
- public void ResetStreamOutputTargets()
- {
- Context.StreamOutput.SetTargets(0, null, null);
- }
-
- ///
- /// Sets the stream output targets bound to the StreamOutput stage.
- ///
- /// The buffer to bind on the first stream output slot.
- /// The offsets in bytes of the buffer. An offset of -1 will cause the stream output buffer to be appended, continuing after the last location written to the buffer in a previous stream output pass.
- /// ff476484
- /// void ID3D11DeviceContext::SOSetTargets([In] unsigned int NumBuffers,[In, Buffer, Optional] const ID3D11Buffer** ppSOTargets,[In, Buffer, Optional] const unsigned int* pOffsets)
- /// ID3D11DeviceContext::SOSetTargets
- public unsafe void SetStreamOutputTarget(Buffer buffer, int offsets = -1)
- {
- Context.StreamOutput.SetTarget(buffer, offsets);
- }
-
- ///
- /// Sets the stream output targets bound to the StreamOutput stage.
- ///
- /// The buffers.
- /// ff476484
- /// void ID3D11DeviceContext::SOSetTargets([In] unsigned int NumBuffers,[In, Buffer, Optional] const ID3D11Buffer** ppSOTargets,[In, Buffer, Optional] const unsigned int* pOffsets)
- /// ID3D11DeviceContext::SOSetTargets
- public void SetStreamOutputTargets(params StreamOutputBufferBinding[] buffers)
- {
- Context.StreamOutput.SetTargets(buffers);
- }
-
- ///
- /// Bind an index buffer to the input-assembler stage.
- ///
- /// A reference to an object, that contains indices. The index buffer must have been created with the flag.
- /// Set to true if indices are 32-bit values (integer size) or false if they are 16-bit values (short size)
- /// Offset (in bytes) from the start of the index buffer to the first index to use. Default to 0
- ///
- /// 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.
- ///
- /// ff476453
- /// void ID3D11DeviceContext::IASetIndexBuffer([In, Optional] ID3D11Buffer* pIndexBuffer,[In] DXGI_FORMAT Format,[In] unsigned int Offset)
- /// ID3D11DeviceContext::IASetIndexBuffer
- public void SetIndexBuffer(Buffer indexBuffer, bool is32Bit, int offset = 0)
- {
- InputAssemblerStage.SetIndexBuffer(indexBuffer, is32Bit ? DXGI.Format.R32_UInt : DXGI.Format.R16_UInt, offset);
- }
-
- ///
- /// Sets the vertex input layout.
- ///
- /// The input layout.
- /// ff476454
- /// void ID3D11DeviceContext::IASetInputLayout([In, Optional] ID3D11InputLayout* pInputLayout)
- /// ID3D11DeviceContext::IASetInputLayout
- public void SetVertexInputLayout(VertexInputLayout inputLayout)
- {
- currentVertexInputLayout = inputLayout;
- }
-
- ///
- /// Bind a vertex buffer on the slot #0 of the input-assembler stage.
- ///
- /// The vertex buffer to bind to this slot. This vertex buffer must have been created with the flag.
- /// The index is the number of vertex element between the first element of a vertex buffer and the first element that will be used.
- ///
- /// 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.
- ///
- /// ff476456
- /// void ID3D11DeviceContext::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumBuffers,[In, Buffer] const void* ppVertexBuffers,[In, Buffer] const void* pStrides,[In, Buffer] const void* pOffsets)
- /// ID3D11DeviceContext::IASetVertexBuffers
- public void SetVertexBuffer(Buffer vertexBuffer, int vertexIndex = 0) where T : struct
- {
- SetVertexBuffer(0, vertexBuffer, vertexIndex);
- }
-
- ///
- /// Bind a vertex buffer to the input-assembler stage.
- ///
- /// The first input slot for binding.
- /// The vertex buffer to bind to this slot. This vertex buffer must have been created with the flag.
- /// The index is the number of vertex element between the first element of a vertex buffer and the first element that will be used.
- ///
- /// 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.
- ///
- /// ff476456
- /// void ID3D11DeviceContext::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumBuffers,[In, Buffer] const void* ppVertexBuffers,[In, Buffer] const void* pStrides,[In, Buffer] const void* pOffsets)
- /// ID3D11DeviceContext::IASetVertexBuffers
- public unsafe void SetVertexBuffer(int slot, Buffer vertexBuffer, int vertexIndex = 0) where T : struct
- {
- IntPtr vertexBufferPtr = IntPtr.Zero;
- int stride = Utilities.SizeOf();
- int offset = vertexIndex * stride;
- if (vertexBuffer != null)
- {
- vertexBufferPtr = ((Direct3D11.Buffer)vertexBuffer).NativePointer;
-
- // Update the index of the last slot buffer bounded, used by ResetVertexBuffers
- if ((slot + 1) > maxSlotCountForVertexBuffer)
- maxSlotCountForVertexBuffer = slot + 1;
- }
- InputAssemblerStage.SetVertexBuffers(slot, 1, new IntPtr(&vertexBufferPtr), new IntPtr(&stride), new IntPtr(&offset));
- }
-
- ///
- /// Bind a vertex buffer to the input-assembler stage.
- ///
- /// The first input slot for binding.
- /// The vertex buffer to bind to this slot. This vertex buffer must have been created with the flag.
- /// The vertexStride is the size (in bytes) of the elements that are to be used from that vertex buffer.
- /// The offset is the number of bytes between the first element of a vertex buffer and the first element that will be used.
- ///
- /// 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.
- ///
- /// ff476456
- /// void ID3D11DeviceContext::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumBuffers,[In, Buffer] const void* ppVertexBuffers,[In, Buffer] const void* pStrides,[In, Buffer] const void* pOffsets)
- /// ID3D11DeviceContext::IASetVertexBuffers
- public unsafe void SetVertexBuffer(int slot, SharpDX.Direct3D11.Buffer vertexBuffer, int vertexStride, int offsetInBytes = 0)
- {
- IntPtr vertexBufferPtr = IntPtr.Zero;
- if (vertexBuffer != null)
- {
- vertexBufferPtr = vertexBuffer.NativePointer;
-
- // Update the index of the last slot buffer bounded, used by ResetVertexBuffers
- if ((slot + 1) > maxSlotCountForVertexBuffer)
- maxSlotCountForVertexBuffer = slot + 1;
- }
- InputAssemblerStage.SetVertexBuffers(slot, 1, new IntPtr(&vertexBufferPtr), new IntPtr(&vertexStride), new IntPtr(&offsetInBytes));
- }
-
- ///
- /// Resets all vertex buffers bounded to a slot range. By default, It clears all the bounded buffers. See remarks.
- ///
- ///
- /// This is sometimes required to unding explicitly vertex buffers bounding to the input shader assembly, when a
- /// vertex buffer is used as the output of the pipeline.
- ///
- /// ff476456
- /// void ID3D11DeviceContext::IASetVertexBuffers([In] unsigned int StartSlot,[In] unsigned int NumBuffers,[In, Buffer] const void* ppVertexBuffers,[In, Buffer] const void* pStrides,[In, Buffer] const void* pOffsets)
- /// ID3D11DeviceContext::IASetVertexBuffers
- public void ResetVertexBuffers()
- {
- if (maxSlotCountForVertexBuffer == 0)
- return;
-
- InputAssemblerStage.SetVertexBuffers(0, maxSlotCountForVertexBuffer, ResetSlotsPointers, ResetSlotsPointers, ResetSlotsPointers);
-
- maxSlotCountForVertexBuffer = 0;
- }
-
- ///
- /// Presents the Backbuffer to the screen.
- ///
- ///
- /// This method is only working if a is set on this device using property.
- ///
- /// bb174576
- /// HRESULT IDXGISwapChain::Present([In] unsigned int SyncInterval,[In] DXGI_PRESENT_FLAGS Flags)
- /// IDXGISwapChain::Present
- public void Present()
- {
- if (IsDeferred)
- throw new InvalidOperationException("Cannot use Present on a deferred context");
-
- if (Presenter != null)
- {
- try
- {
- Presenter.Present();
- }
- catch (SharpDXException ex)
- {
- if (ex.ResultCode == DXGI.ResultCode.DeviceReset || ex.ResultCode == DXGI.ResultCode.DeviceRemoved)
- {
- // TODO: Implement device reset / removed
- }
- throw;
- }
-
- }
- }
-
- ///
- /// Remove all shaders bounded to each stage.
- ///
- public void ResetShaderStages()
- {
- foreach (var commonShaderStage in ShaderStages)
- {
- commonShaderStage.SetShader(null, null, 0);
- }
- }
-
- public static implicit operator Device(GraphicsDevice from)
- {
- return from == null ? null : from.Device;
- }
-
- public static implicit operator DeviceContext(GraphicsDevice from)
- {
- return from == null ? null : from.Context;
- }
-
- private void SetupInputLayout()
- {
- if (CurrentPass == null)
- throw new InvalidOperationException("Cannot perform a Draw/Dispatch operation without an EffectPass applied.");
-
- var inputLayout = CurrentPass.GetInputLayout(currentVertexInputLayout);
- InputAssemblerStage.SetInputLayout(inputLayout);
- }
-
- ///
- /// A delegate called to create shareable data. See remarks.
- ///
- /// Type of the data to create.
- /// A new instance of the data to share.
- ///
- /// Because this method is being called from a lock region, this method should not be time consuming.
- ///
- public delegate T CreateSharedData() where T : IDisposable;
-
- ///
- /// Gets a shared data for this device context with a delegate to create the shared data if it is not present.
- ///
- /// Type of the shared data to get/create.
- /// Type of the data to share.
- /// The key of the shared data.
- /// The shared data creator.
- /// An instance of the shared data. The shared data will be disposed by this instance.
- public T GetOrCreateSharedData(SharedDataType type, object key, CreateSharedData sharedDataCreator) where T : IDisposable
- {
- var dictionary = (type == SharedDataType.PerDevice) ? sharedDataPerDevice : sharedDataPerDeviceContext;
-
- lock (dictionary)
- {
- object localValue;
- if (!dictionary.TryGetValue(key, out localValue))
- {
- localValue = ToDispose(sharedDataCreator());
- dictionary.Add(key, localValue);
- }
- return (T)localValue;
- }
- }
-
- protected override void Dispose(bool disposeManagedResources)
- {
- if (disposeManagedResources)
- {
- if (Presenter != null)
- {
-
- // Invalid for WinRT - throwing a "Value does not fall within the expected range" Exception
-#if !WIN8METRO
- // Make sure that the Presenter is reverted to window before shutting down
- // otherwise the Direct3D11.Device will generate an exception on Dispose()
- Presenter.IsFullScreen = false;
-#endif
- Presenter.Dispose();
- Presenter = null;
- }
-
- // effect pools will be disposed only by the master graphics device
- if(!IsDeferred)
- {
- // dispose EffectPools in reverse order as they will remove themselves from the list
- for(var i = EffectPools.Count - 1; i >= 0; i--)
- {
- EffectPools[i].Dispose();
- }
-
- EffectPools = null;
- }
- }
-
- base.Dispose(disposeManagedResources);
- }
-
-
- ///
- /// Gets or create an input signature manager for a particular signature.
- ///
- /// The signature bytecode.
- /// The signature hashcode.
- ///
- internal InputSignatureManager GetOrCreateInputSignatureManager(byte[] signatureBytecode, int signatureHashcode)
- {
- var key = new InputSignatureKey(signatureBytecode, signatureHashcode);
-
- InputSignatureManager signatureManager;
-
- // Lock all input signatures, as they are shared between all shaders/graphics device instances.
- lock (inputSignatureCache)
- {
- if (!inputSignatureCache.TryGetValue(key, out signatureManager))
- {
- signatureManager = ToDispose(new InputSignatureManager(this, signatureBytecode));
- inputSignatureCache.Add(key, signatureManager);
- }
- }
-
- return signatureManager;
- }
-
- private void CommonSetRenderTargets(RenderTargetView rtv)
- {
- currentRenderTargetViews[0] = rtv;
- for (int i = 1; i < actualRenderTargetViewCount; i++)
- currentRenderTargetViews[i] = null;
- actualRenderTargetViewCount = 1;
- currentRenderTargetView = rtv;
-
- // Setup the viewport from the rendertarget view
- TextureView textureView;
- if (AutoViewportFromRenderTargets && rtv != null && (textureView = rtv.Tag as TextureView) != null)
- {
- SetViewport(new ViewportF(0, 0, textureView.Width, textureView.Height));
- }
- }
-
- private void CommonSetRenderTargets(RenderTargetView[] rtvs)
- {
- var rtv0 = rtvs.Length > 0 ? rtvs[0] : null;
- for (int i = 0; i < rtvs.Length; i++)
- currentRenderTargetViews[i] = rtvs[i];
- for (int i = rtvs.Length; i < actualRenderTargetViewCount; i++)
- currentRenderTargetViews[i] = null;
- actualRenderTargetViewCount = rtvs.Length;
- currentRenderTargetView = rtv0;
-
- // Setup the viewport from the rendertarget view
- TextureView textureView;
- if (AutoViewportFromRenderTargets && rtv0 != null && (textureView = rtv0.Tag as TextureView) != null)
- {
- SetViewport(new ViewportF(0, 0, textureView.Width, textureView.Height));
- }
- }
- }
-}
+// 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 SharpDX.Direct3D;
+using SharpDX.Direct3D11;
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using SharpDX.Mathematics;
+using SharpDX.Mathematics.Interop;
+using SharpDX.Toolkit.Collections;
+using Device = SharpDX.Direct3D11.Device;
+
+namespace SharpDX.Toolkit.Graphics
+{
+ ///
+ /// This class is a front end to and .
+ ///
+ public class GraphicsDevice : Component
+ {
+ private readonly Dictionary