+++ /dev/null
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-#pragma once\r
-\r
-#include "../math/Color4.h"\r
-#include "../dxgi/Enums.h"\r
-\r
-#include "../DataBox.h"\r
-#include "../ComObject.h"\r
-\r
-#include "DeviceChild11.h"\r
-#include "Enums11.h"\r
-\r
-using System::Runtime::InteropServices::OutAttribute;\r
-\r
-namespace SlimDX\r
-{\r
- namespace Direct3D11\r
- {\r
- ref class Asynchronous;\r
- ref class Device;\r
- ref class CommandList;\r
- ref class Resource;\r
- ref class DepthStencilView;\r
- ref class RenderTargetView;\r
- ref class ShaderResourceView;\r
- ref class UnorderedAccessView;\r
- ref class Buffer;\r
- ref class Predicate;\r
- value class ResourceRegion;\r
-\r
- ref class GeometryShaderWrapper;\r
- ref class InputAssemblerWrapper;\r
- ref class OutputMergerWrapper;\r
- ref class RasterizerWrapper;\r
- ref class PixelShaderWrapper;\r
- ref class StreamOutputWrapper;\r
- ref class VertexShaderWrapper;\r
- ref class DomainShaderWrapper;\r
- ref class HullShaderWrapper;\r
- ref class ComputeShaderWrapper;\r
-\r
- /// <summary>Represents a device context which generates rendering commands.</summary>\r
- /// <unmanaged>ID3D11DeviceContext</unmanaged>\r
- public ref class DeviceContext : DeviceChild\r
- {\r
- COMOBJECT_CUSTOM(ID3D11DeviceContext, DeviceContext);\r
-\r
- private:\r
- InputAssemblerWrapper^ inputAssembler;\r
- OutputMergerWrapper^ outputMerger;\r
- StreamOutputWrapper^ streamOutput;\r
- RasterizerWrapper^ rasterizer;\r
- VertexShaderWrapper^ vertexShader;\r
- PixelShaderWrapper^ pixelShader;\r
- GeometryShaderWrapper^ geometryShader;\r
- DomainShaderWrapper^ domainShader;\r
- HullShaderWrapper^ hullShader;\r
- ComputeShaderWrapper^ computeShader;\r
-\r
- void InitializeSubclasses();\r
-\r
- public:\r
- /// <summary>\r
- /// Initializes a new instance of the <see cref="DeviceContext"/> class. This instance will be a deferred rendering context.\r
- /// </summary>\r
- /// <param name="device">The device used to create the context.</param>\r
- DeviceContext( SlimDX::Direct3D11::Device^ device );\r
-\r
- /// <summary>\r
- /// Marks the beginning of a series of asynchronous commands.\r
- /// </summary>\r
- /// <param name="data">An asynchronous data provider.</param>\r
- void Begin( Asynchronous^ data );\r
-\r
- /// <summary>\r
- /// Clears the specified depth-stencil resource.\r
- /// </summary>\r
- /// <param name="view">The view of the resource to clear.</param>\r
- /// <param name="flags">Flags indicating which parts of the resource to clear.</param>\r
- /// <param name="depth">The depth value to clear to, if applicable.</param>\r
- /// <param name="stencil">The stencil value to clear to, if applicable.</param>\r
- void ClearDepthStencilView( DepthStencilView^ view, DepthStencilClearFlags flags, float depth, System::Byte stencil );\r
- \r
- /// <summary>\r
- /// Clears the specified render target resource.\r
- /// </summary>\r
- /// <param name="view">The view of the resource to clear.</param>\r
- /// <param name="color">The color to clear to.</param>\r
- void ClearRenderTargetView( RenderTargetView^ view, Color4 color );\r
-\r
- /// <summary>\r
- /// Restores all device state to defaults.\r
- /// </summary>\r
- void ClearState();\r
-\r
- /// <summary>\r
- /// Clears an unordered access resource with the given values.\r
- /// </summary>\r
- /// <param name="unorderedAccessView">The view of the resource to clear.</param>\r
- /// <param name="values">Values that will be copied to corresponding channels on the resource.</param>\r
- void ClearUnorderedAccessView( UnorderedAccessView^ unorderedAccessView, array<int>^ values );\r
-\r
- /// <summary>\r
- /// Clears an unordered access resource with the given values.\r
- /// </summary>\r
- /// <param name="unorderedAccessView">The view of the resource to clear.</param>\r
- /// <param name="values">Values that will be copied to corresponding channels on the resource.</param>\r
- void ClearUnorderedAccessView( UnorderedAccessView^ unorderedAccessView, array<float>^ values );\r
- \r
- /// <summary>\r
- /// Copies resource data using the GPU.\r
- /// </summary>\r
- /// <param name="source">The source resource.</param>\r
- /// <param name="destination">The destination resource.</param>\r
- void CopyResource( Resource^ source, Resource^ destination );\r
-\r
- /// <summary>\r
- /// Copies data from a buffer holding variable length data.\r
- /// </summary>\r
- /// <param name="unorderedAccessView">The view of the source resource.</param>\r
- /// <param name="destinationBuffer">The destination buffer.</param>\r
- /// <param name="destinationOffset">Aligned byte offset from the start of the destination buffer to which data will be copied.</param>\r
- void CopyStructureCount( UnorderedAccessView^ unorderedAccessView, Buffer^ destinationBuffer, int destinationOffset );\r
-\r
- /// <summary>\r
- /// Copies a portion of a resource's data using the GPU.\r
- /// </summary>\r
- /// <param name="source">The source resource.</param>\r
- /// <param name="sourceSubresource">The source subresource.</param>\r
- /// <param name="region">The source region.</param>\r
- /// <param name="destination">The destination resource.</param>\r
- /// <param name="destinationSubresource">The destination subresource.</param>\r
- /// <param name="x">The X offset between the source region origin and the destination location.</param>\r
- /// <param name="y">The Y offset between the source region origin and the destination location.</param>\r
- /// <param name="z">The Z offset between the source region origin and the destination location.</param>\r
- void CopySubresourceRegion( Resource^ source, int sourceSubresource, ResourceRegion region, Resource^ destination, int destinationSubresource, int x, int y, int z );\r
- \r
- /// <summary>\r
- /// Copies a multisampled resource into a non-multisampled resource.\r
- /// </summary>\r
- /// <param name="source">The source resource.</param>\r
- /// <param name="sourceSubresource">The source subresource.</param>\r
- /// <param name="destination">The destination resource.</param>\r
- /// <param name="destinationSubresource">The destination subresource.</param>\r
- /// <param name="format">The format that indicates how the multisampled resource will be resolved.</param>\r
- void ResolveSubresource( Resource^ source, int sourceSubresource, Resource^ destination, int destinationSubresource, DXGI::Format format );\r
- \r
- /// <summary>\r
- /// Copies data from the CPU to to a non-mappable subresource region.\r
- /// </summary>\r
- /// <param name="source">The source data.</param>\r
- /// <param name="resource">The destination resource.</param>\r
- /// <param name="subresource">The destination subresource.</param>\r
- void UpdateSubresource( DataBox^ source, Resource^ resource, int subresource );\r
-\r
- /// <summary>\r
- /// Copies data from the CPU to to a non-mappable subresource region.\r
- /// </summary>\r
- /// <param name="source">The source data.</param>\r
- /// <param name="resource">The destination resource.</param>\r
- /// <param name="subresource">The destination subresource.</param>\r
- /// <param name="region">The destination region within the resource.</param>\r
- void UpdateSubresource( DataBox^ source, Resource^ resource, int subresource, ResourceRegion region );\r
-\r
- /// <summary>\r
- /// Executes a command list from a thread group.\r
- /// </summary>\r
- /// <param name="threadGroupCountX">The number of groups dispatched in the x direction.</param>\r
- /// <param name="threadGroupCountY">The number of groups dispatched in the y direction.</param>\r
- /// <param name="threadGroupCountZ">The number of groups dispatched in the z direction.</param>\r
- void Dispatch( int threadGroupCountX, int threadGroupCountY, int threadGroupCountZ );\r
-\r
- /// <summary>\r
- /// Execute a command list to draw GPU-generated primitives over one of more thread groups.\r
- /// </summary>\r
- /// <param name="arguments">A buffer containing arguments for the thread groups.</param>\r
- /// <param name="alignedOffset">A byte-aligned offset between the start of the buffer and the arguments.</param>\r
- void DispatchIndirect( Buffer^ arguments, int alignedOffset );\r
-\r
- /// <summary>\r
- /// Renders non-indexed, non-instanced primitive data.\r
- /// </summary>\r
- /// <param name="vertexCount">The number of vertices to use.</param>\r
- /// <param name="startVertexLocation">The index of the first vertex.</param>\r
- void Draw( int vertexCount, int startVertexLocation );\r
-\r
- /// <summary>\r
- /// Renders non-indexed, instanced primitive data.\r
- /// </summary>\r
- /// <param name="vertexCountPerInstance">The number of vertices to use per instance.</param>\r
- /// <param name="instanceCount">The number of instances to render.</param>\r
- /// <param name="startVertexLocation">The index of the first vertex.</param>\r
- /// <param name="startInstanceLocation">The index of the first instance.</param>\r
- void DrawInstanced( int vertexCountPerInstance, int instanceCount, int startVertexLocation, int startInstanceLocation );\r
-\r
- /// <summary>\r
- /// Renders non-indexed, instanced, GPU-generated primitive data.\r
- /// </summary>\r
- /// <param name="arguments">A buffer containing arguments for the draw call.</param>\r
- /// <param name="alignedOffset">A byte-aligned offset between the start of the buffer and the arguments.</param>\r
- void DrawInstancedIndirect( Buffer^ arguments, int alignedOffset );\r
- \r
- /// <summary>\r
- /// Renders indexed, non-instanced primitive data.\r
- /// </summary>\r
- /// <param name="indexCount">The number of indices to use.</param>\r
- /// <param name="startIndexLocation">The index of the first index.</param>\r
- /// <param name="baseVertexLocation">The index of the first vertex.</param>\r
- void DrawIndexed( int indexCount, int startIndexLocation, int baseVertexLocation );\r
-\r
- /// <summary>\r
- /// Renders indexed, instanced primitive data.\r
- /// </summary>\r
- /// <param name="indexCountPerInstance">The number of indices to use per instance.</param>\r
- /// <param name="instanceCount">The number of instances to render.</param>\r
- /// <param name="startIndexLocation">The index of the first index.</param>\r
- /// <param name="baseVertexLocation">The index of the first vertex.</param>\r
- /// <param name="startInstanceLocation">The index of the first instance.</param>\r
- void DrawIndexedInstanced( int indexCountPerInstance, int instanceCount, int startIndexLocation, int baseVertexLocation, int startInstanceLocation );\r
- \r
- /// <summary>\r
- /// Renders indexed, instanced, GPU-generated primitive data.\r
- /// </summary>\r
- /// <param name="arguments">A buffer containing arguments for the draw call.</param>\r
- /// <param name="alignedOffset">A byte-aligned offset between the start of the buffer and the arguments.</param>\r
- void DrawIndexedInstancedIndirect( Buffer^ arguments, int alignedOffset );\r
-\r
- /// <summary>\r
- /// Renders primitive data of an unknown size that was created by a geometry shader.\r
- /// </summary>\r
- void DrawAuto();\r
-\r
- /// <summary>\r
- /// Marks the end of a series of asynchronous commands.\r
- /// </summary>\r
- /// <param name="data">An asynchronous data provider.</param>\r
- void End( Asynchronous^ data );\r
-\r
- /// <summary>\r
- /// Queues commands from a command list onto a device.\r
- /// </summary>\r
- /// <param name="commands">The list of commands to execute.</param>\r
- /// <param name="restoreState">A flag indicating whether the immediate context state is saved (prior) and restored (after) the execution of a command list.</param>\r
- void ExecuteCommandList( CommandList^ commands, bool restoreState );\r
-\r
- /// <summary>\r
- /// Create a command list and record graphics commands into it.\r
- /// </summary>\r
- /// <param name="restoreState">A flag indicating whether the immediate context state is saved (prior) and restored (after) the execution of a command list.</param>\r
- /// <returns>The created command list containing the queued rendering commands.</returns>\r
- CommandList^ FinishCommandList( bool restoreState );\r
-\r
- /// <summary>\r
- /// Sends queued commands in the command buffer to the GPU.\r
- /// </summary>\r
- void Flush();\r
- \r
- /// <summary>\r
- /// Generates mipmaps for the specified shader resource.\r
- /// </summary>\r
- /// <param name="view">A view of the resource for which to generate mipmaps.</param>\r
- void GenerateMips( ShaderResourceView^ view );\r
-\r
- /// <summary>\r
- /// Gets the minimum level-of-detail for a resource.\r
- /// </summary>\r
- /// <param name="resource">The resource for which level-of-detail information is to be retrieved.</param>\r
- /// <returns>The minimum level-of-detail for the specified resource.</returns>\r
- float GetMinimumLod( Resource^ resource );\r
-\r
- /// <summary>\r
- /// Sets the minimum level-of-detail for a resource.\r
- /// </summary>\r
- /// <param name="resource">The resource for which level-of-detail information is to be set.</param>\r
- /// <param name="minimumLod">The level-of-detail for the resource.</param>\r
- void SetMinimumLod( Resource^ resource, float minimumLod );\r
-\r
- /// <summary>\r
- /// Gets data from the GPU asynchronously.\r
- /// </summary>\r
- /// <param name="data">The asynchronous data provider.</param>\r
- /// <returns>The data retrieved from the GPU.</returns>\r
- DataStream^ GetData( Asynchronous^ data );\r
-\r
- /// <summary>\r
- /// Gets data from the GPU asynchronously.\r
- /// </summary>\r
- /// <param name="data">The asynchronous data provider.</param>\r
- /// <param name="flags">Flags specifying how the command should operate.</param>\r
- /// <returns>The data retrieved from the GPU.</returns>\r
- DataStream^ GetData( Asynchronous^ data, AsynchronousFlags flags );\r
-\r
- /// <summary>\r
- /// Gets data from the GPU asynchronously.\r
- /// </summary>\r
- /// <param name="data">The asynchronous data provider.</param>\r
- /// <returns>The data retrieved from the GPU.</returns>\r
- generic<typename T> where T : value class\r
- T GetData( Asynchronous^ data );\r
-\r
- /// <summary>\r
- /// Gets data from the GPU asynchronously.\r
- /// </summary>\r
- /// <param name="data">The asynchronous data provider.</param>\r
- /// <param name="flags">Flags specifying how the command should operate.</param>\r
- /// <returns>The data retrieved from the GPU.</returns>\r
- generic<typename T> where T : value class\r
- T GetData( Asynchronous^ data, AsynchronousFlags flags );\r
-\r
- /// <summary>\r
- /// Gets the rendering predicate state.\r
- /// </summary>\r
- /// <param name="predicate">When the method completes, contains the predicate interface currently in use.</param>\r
- /// <param name="predicateValue">When the method completes, contains the predicate comparison value.</param>\r
- void GetPredication( [Out] Predicate^ %predicate, [Out] bool %predicateValue );\r
-\r
- /// <summary>\r
- /// Maps a GPU resource into CPU-accessible memory.\r
- /// </summary>\r
- /// <param name="resource">The resource to map.</param>\r
- /// <param name="subresource">Index of the subresource to map.</param>\r
- /// <param name="sizeInBytes">Size, in bytes, of the data to retrieve.</param>\r
- /// <param name="mode">Specifies the CPU's read and write permissions for the resource. </param>\r
- /// <param name="flags">Flags that specify what the CPU should do when the GPU is busy.</param>\r
- /// <returns>The mapped resource data.</returns>\r
- DataBox^ MapSubresource( Resource^ resource, int subresource, int sizeInBytes, MapMode mode, MapFlags flags );\r
-\r
- /// <summary>\r
- /// Releases a previously mapped resource.\r
- /// </summary>\r
- /// <param name="resource">The resource to unmap.</param>\r
- /// <param name="subresource">Index of the subresource to unmap.</param>\r
- void UnmapSubresource( Resource^ resource, int subresource );\r
- \r
- /// <summary>\r
- /// Sets a rendering predicate.\r
- /// </summary>\r
- /// <param name="predicate">The predicate to set.</param>\r
- /// <param name="predicateValue">If true, rendering will be affected when the predicate's conditions are met. Otherwise,\r
- /// rendering will be affected when the predicate's conditions are not met.</param>\r
- void SetPredication( Predicate^ predicate, bool predicateValue );\r
-\r
- /// <summary>\r
- /// Gets the type of the device context.\r
- /// </summary>\r
- property DeviceContextType Type\r
- {\r
- DeviceContextType get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's input assembler interface.\r
- /// </summary>\r
- property InputAssemblerWrapper^ InputAssembler\r
- {\r
- InputAssemblerWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's output merger interface.\r
- /// </summary>\r
- property OutputMergerWrapper^ OutputMerger\r
- {\r
- OutputMergerWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's stream output interface.\r
- /// </summary>\r
- property StreamOutputWrapper^ StreamOutput\r
- {\r
- StreamOutputWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's rasterizer interface.\r
- /// </summary>\r
- property RasterizerWrapper^ Rasterizer\r
- {\r
- RasterizerWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's vertex shader interface.\r
- /// </summary>\r
- property VertexShaderWrapper^ VertexShader\r
- {\r
- VertexShaderWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's pixel shader interface.\r
- /// </summary>\r
- property PixelShaderWrapper^ PixelShader\r
- {\r
- PixelShaderWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's geometry shader interface.\r
- /// </summary>\r
- property GeometryShaderWrapper^ GeometryShader\r
- {\r
- GeometryShaderWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's domain shader interface.\r
- /// </summary>\r
- property DomainShaderWrapper^ DomainShader\r
- {\r
- DomainShaderWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's hull shader interface.\r
- /// </summary>\r
- property HullShaderWrapper^ HullShader\r
- {\r
- HullShaderWrapper^ get();\r
- }\r
-\r
- /// <summary>\r
- /// Gets the device's compute shader interface.\r
- /// </summary>\r
- property ComputeShaderWrapper^ ComputeShader\r
- {\r
- ComputeShaderWrapper^ get();\r
- }\r
- };\r
- }\r
-}
\ No newline at end of file