OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d11 / DeviceContext11.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/direct3d11/DeviceContext11.cpp b/SlimDXc_Jun2010(VC++2008)/source/direct3d11/DeviceContext11.cpp
deleted file mode 100644 (file)
index a7737ab..0000000
+++ /dev/null
@@ -1,388 +0,0 @@
-/*\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
-#include "stdafx.h"\r
-\r
-#include "../DataStream.h"\r
-\r
-#include "Direct3D11Exception.h"\r
-\r
-#include "Buffer11.h"\r
-#include "CommandList11.h"\r
-#include "Asynchronous11.h"\r
-#include "DeviceContext11.h"\r
-#include "InputAssemblerWrapper11.h"\r
-#include "OutputMergerWrapper11.h"\r
-#include "StreamOutputWrapper11.h"\r
-#include "RasterizerWrapper11.h"\r
-#include "VertexShaderWrapper11.h"\r
-#include "PixelShaderWrapper11.h"\r
-#include "GeometryShaderWrapper11.h"\r
-#include "DomainShaderWrapper11.h"\r
-#include "HullShaderWrapper11.h"\r
-#include "ComputeShaderWrapper11.h"\r
-#include "DepthStencilView11.h"\r
-#include "RenderTargetView11.h"\r
-#include "UnorderedAccessView11.h"\r
-#include "ShaderResourceView11.h"\r
-#include "Resource11.h"\r
-#include "ResourceRegion11.h"\r
-#include "Predicate11.h"\r
-#include "Device11.h"\r
-\r
-using namespace System;\r
-using namespace System::Runtime::InteropServices;\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D11\r
-{\r
-       void DeviceContext::InitializeSubclasses()\r
-       {\r
-               inputAssembler = gcnew InputAssemblerWrapper( InternalPointer );\r
-               outputMerger = gcnew OutputMergerWrapper( InternalPointer );\r
-               streamOutput = gcnew StreamOutputWrapper( InternalPointer );\r
-               rasterizer = gcnew RasterizerWrapper( InternalPointer );\r
-               vertexShader = gcnew VertexShaderWrapper( InternalPointer );\r
-               pixelShader = gcnew PixelShaderWrapper( InternalPointer );\r
-               geometryShader = gcnew GeometryShaderWrapper( InternalPointer );\r
-               domainShader = gcnew DomainShaderWrapper( InternalPointer );\r
-               hullShader = gcnew HullShaderWrapper( InternalPointer );\r
-               computeShader = gcnew ComputeShaderWrapper( InternalPointer );\r
-       }\r
-\r
-       DeviceContext::DeviceContext( ID3D11DeviceContext* pointer, ComObject^ owner )\r
-       {\r
-               Construct( pointer, owner );\r
-               InitializeSubclasses();\r
-       }\r
-       \r
-       DeviceContext::DeviceContext( IntPtr pointer )\r
-       {\r
-               Construct( pointer, NativeInterface );\r
-               InitializeSubclasses();\r
-       }\r
-       \r
-       DeviceContext^ DeviceContext::FromPointer( ID3D11DeviceContext* pointer, ComObject^ owner, ComObjectFlags flags )\r
-       {\r
-               return ConstructFromPointer<DeviceContext,ID3D11DeviceContext>( pointer, owner, flags );\r
-       }\r
-       \r
-       DeviceContext^ DeviceContext::FromPointer( IntPtr pointer )\r
-       {\r
-               return ConstructFromUserPointer<DeviceContext>( pointer );\r
-       }\r
-\r
-       DeviceContext::DeviceContext( SlimDX::Direct3D11::Device^ device )\r
-       {\r
-               ID3D11DeviceContext* context;\r
-\r
-               HRESULT hr = device->InternalPointer->CreateDeferredContext( 0, &context );\r
-               if( RECORD_D3D11( hr ).IsFailure )\r
-                       throw gcnew Direct3D11Exception( Result::Last );\r
-\r
-               Construct( context );\r
-               InitializeSubclasses();\r
-       }\r
-\r
-       void DeviceContext::Begin( Asynchronous^ data )\r
-       {\r
-               InternalPointer->Begin( data->InternalPointer );\r
-       }\r
-\r
-       void DeviceContext::ClearDepthStencilView( DepthStencilView^ view, DepthStencilClearFlags flags, float depth, Byte stencil )\r
-       {\r
-               InternalPointer->ClearDepthStencilView( view->InternalPointer, static_cast<UINT>( flags ), depth, stencil );\r
-       }\r
-       \r
-       void DeviceContext::ClearRenderTargetView( RenderTargetView^ view, Color4 color )\r
-       {\r
-               const float nativeColor[] = { color.Red, color.Green, color.Blue, color.Alpha };\r
-               InternalPointer->ClearRenderTargetView( view->InternalPointer, nativeColor );\r
-       }\r
-       \r
-       void DeviceContext::ClearState()\r
-       {\r
-               InternalPointer->ClearState();\r
-       }\r
-\r
-       void DeviceContext::ClearUnorderedAccessView( UnorderedAccessView^ unorderedAccessView, array<int>^ values )\r
-       {\r
-               if( values->Length != 4 )\r
-                       throw gcnew ArgumentException( "Must supply exactly four clear values", "values" );\r
-\r
-               const UINT nativeValues[] = { values[0], values[1], values[2], values[3] };\r
-               InternalPointer->ClearUnorderedAccessViewUint( unorderedAccessView->InternalPointer, nativeValues );\r
-       }\r
-\r
-       void DeviceContext::ClearUnorderedAccessView( UnorderedAccessView^ unorderedAccessView, array<float>^ values )\r
-       {\r
-               if( values->Length != 4 )\r
-                       throw gcnew ArgumentException( "Must supply exactly four clear values", "values" );\r
-\r
-               const FLOAT nativeValues[] = { values[0], values[1], values[2], values[3] };\r
-               InternalPointer->ClearUnorderedAccessViewFloat( unorderedAccessView->InternalPointer, nativeValues );\r
-       }\r
-       \r
-       void DeviceContext::CopyResource( Resource^ source, Resource^ destination )\r
-       {\r
-               InternalPointer->CopyResource( destination->InternalPointer, source->InternalPointer );\r
-       }\r
-\r
-       void DeviceContext::CopyStructureCount( UnorderedAccessView^ unorderedAccessView, Buffer^ destinationBuffer, int destinationOffset )\r
-       {\r
-               InternalPointer->CopyStructureCount( destinationBuffer->InternalPointer, destinationOffset, unorderedAccessView->InternalPointer );\r
-       }\r
-       \r
-       void DeviceContext::CopySubresourceRegion( Resource^ source, int sourceSubresource, ResourceRegion region, Resource^ destination, int destinationSubresource, int x, int y, int z )\r
-       {\r
-               D3D11_BOX nativeRegion = region.CreateNativeVersion();\r
-               InternalPointer->CopySubresourceRegion( destination->InternalPointer, destinationSubresource, x, y, z, source->InternalPointer, sourceSubresource, &nativeRegion );\r
-       }\r
-       \r
-       void DeviceContext::ResolveSubresource( Resource^ source, int sourceSubresource, Resource^ destination, int destinationSubresource, DXGI::Format format )\r
-       {\r
-               InternalPointer->ResolveSubresource( destination->InternalPointer, destinationSubresource, source->InternalPointer, sourceSubresource, static_cast<DXGI_FORMAT>( format ) );\r
-       }\r
-       \r
-       void DeviceContext::UpdateSubresource( DataBox^ source, Resource^ resource, int subresource ) \r
-       {\r
-               InternalPointer->UpdateSubresource( resource->InternalPointer, static_cast<UINT>( subresource), 0, source->Data->PositionPointer, source->RowPitch,source->SlicePitch);\r
-       }\r
-\r
-       void DeviceContext::UpdateSubresource( DataBox^ source, Resource^ resource, int subresource, ResourceRegion region ) \r
-       {\r
-               D3D11_BOX nativeRegion = region.CreateNativeVersion();\r
-               InternalPointer->UpdateSubresource( resource->InternalPointer, static_cast<UINT>( subresource), &nativeRegion, source->Data->PositionPointer, source->RowPitch,source->SlicePitch);\r
-       }\r
-\r
-       void DeviceContext::Dispatch( int threadGroupCountX, int threadGroupCountY, int threadGroupCountZ )\r
-       {\r
-               InternalPointer->Dispatch( threadGroupCountX, threadGroupCountY, threadGroupCountZ );\r
-       }\r
-       \r
-       void DeviceContext::DispatchIndirect( Buffer^ arguments, int alignedOffset )\r
-       {\r
-               InternalPointer->DispatchIndirect( arguments->InternalPointer, alignedOffset );\r
-       }\r
-\r
-       void DeviceContext::Draw( int vertexCount, int startVertexLocation )\r
-       {\r
-               InternalPointer->Draw( vertexCount, startVertexLocation );\r
-       }\r
-       \r
-       void DeviceContext::DrawInstanced( int vertexCountPerInstance, int instanceCount, int startVertexLocation, int startInstanceLocation )\r
-       {\r
-               InternalPointer->DrawInstanced( vertexCountPerInstance, instanceCount, startVertexLocation, startInstanceLocation );\r
-       }\r
-\r
-       void DeviceContext::DrawInstancedIndirect( Buffer^ arguments, int alignedOffset )\r
-       {\r
-               InternalPointer->DrawInstancedIndirect( arguments->InternalPointer, alignedOffset );\r
-       }\r
-       \r
-       void DeviceContext::DrawIndexed( int indexCount, int startIndexLocation, int baseVertexLocation )\r
-       {\r
-               InternalPointer->DrawIndexed( indexCount, startIndexLocation, baseVertexLocation );\r
-       }\r
-       \r
-       void DeviceContext::DrawIndexedInstanced( int indexCountPerInstance, int instanceCount, int startIndexLocation, int baseVertexLocation, int startInstanceLocation )\r
-       {\r
-               InternalPointer->DrawIndexedInstanced( indexCountPerInstance, instanceCount, startIndexLocation, baseVertexLocation, startInstanceLocation );\r
-       }\r
-\r
-       void DeviceContext::DrawIndexedInstancedIndirect( Buffer^ arguments, int alignedOffset )\r
-       {\r
-               InternalPointer->DrawIndexedInstancedIndirect( arguments->InternalPointer, alignedOffset );\r
-       }\r
-       \r
-       void DeviceContext::DrawAuto()\r
-       {\r
-               InternalPointer->DrawAuto();\r
-       }\r
-\r
-       void DeviceContext::End( Asynchronous^ data )\r
-       {\r
-               InternalPointer->End( data->InternalPointer );\r
-       }\r
-\r
-       void DeviceContext::ExecuteCommandList( CommandList^ commands, bool restoreState )\r
-       {\r
-               InternalPointer->ExecuteCommandList( commands->InternalPointer, restoreState );\r
-       }\r
-\r
-       CommandList^ DeviceContext::FinishCommandList( bool restoreState )\r
-       {\r
-               ID3D11CommandList* commands;\r
-\r
-               HRESULT hr = InternalPointer->FinishCommandList( restoreState, &commands );\r
-               if( RECORD_D3D11( hr ).IsFailure )\r
-                       return nullptr;\r
-\r
-               return CommandList::FromPointer( commands );\r
-       }\r
-       \r
-       void DeviceContext::Flush()\r
-       {\r
-               InternalPointer->Flush();\r
-       }\r
-       \r
-       void DeviceContext::GenerateMips( ShaderResourceView^ view )\r
-       {\r
-               InternalPointer->GenerateMips( view->InternalPointer );\r
-       }\r
-\r
-       float DeviceContext::GetMinimumLod( Resource^ resource )\r
-       {\r
-               return InternalPointer->GetResourceMinLOD( resource->InternalPointer );\r
-       }\r
-\r
-       void DeviceContext::SetMinimumLod( Resource^ resource, float minimumLod )\r
-       {\r
-               InternalPointer->SetResourceMinLOD( resource->InternalPointer, minimumLod );\r
-       }\r
-\r
-       DataStream^ DeviceContext::GetData( Asynchronous^ data )\r
-       {\r
-               return GetData( data, AsynchronousFlags::None );\r
-       }\r
-       \r
-       DataStream^ DeviceContext::GetData( Asynchronous^ data, AsynchronousFlags flags )\r
-       {\r
-               int size = data->InternalPointer->GetDataSize();\r
-               DataStream^ result = gcnew DataStream( size, true, true );\r
-\r
-               if( RECORD_D3D11( InternalPointer->GetData( data->InternalPointer, result->PositionPointer, size, static_cast<UINT>( flags ) ) ).IsFailure )\r
-                       return nullptr;\r
-               return result;\r
-       }\r
-\r
-// disables bogus warning: \r
-// SlimDX::Direct3D11::DeviceContext::GetData<T>' : recursive on\r
-// all control paths, function will cause runtime stack overflow\r
-#pragma warning(disable:4717)\r
-       generic<typename T> where T : value class\r
-       T DeviceContext::GetData( Asynchronous^ data )\r
-       {\r
-               return GetData<T>( data, AsynchronousFlags::None );\r
-       }\r
-\r
-       generic<typename T> where T : value class\r
-       T DeviceContext::GetData( Asynchronous^ data, AsynchronousFlags flags )\r
-       {\r
-               int size = Marshal::SizeOf(T::typeid);\r
-               T result;\r
-\r
-               if( RECORD_D3D11( InternalPointer->GetData( data->InternalPointer, &result, size, static_cast<UINT>( flags ) ) ).IsFailure )\r
-                       return T();\r
-\r
-               return result;\r
-       }\r
-#pragma warning(default:4717)\r
-\r
-       void DeviceContext::GetPredication( [Out] Predicate^ %predicate, bool %predicateValue )\r
-       {\r
-               ID3D11Predicate* pointer;\r
-               BOOL value;\r
-\r
-               InternalPointer->GetPredication( &pointer, &value );\r
-\r
-               predicate = Predicate::FromPointer( pointer );\r
-               predicateValue = value > 0;\r
-       }\r
-\r
-       void DeviceContext::SetPredication( Predicate^ predicate, bool predicateValue )\r
-       {\r
-               InternalPointer->SetPredication( predicate->InternalPointer, predicateValue );\r
-       }\r
-\r
-       DataBox^ DeviceContext::MapSubresource( Resource^ resource, int subresource, int sizeInBytes, MapMode mode, MapFlags flags )\r
-       {\r
-               D3D11_MAPPED_SUBRESOURCE mapped;\r
-               HRESULT hr = InternalPointer->Map( resource->InternalPointer, subresource, static_cast<D3D11_MAP>( mode ), static_cast<UINT>( flags ), &mapped );\r
-               if( RECORD_D3D11( hr ).IsFailure )\r
-                       return nullptr;\r
-\r
-               DataBox^ box = gcnew DataBox( mapped.RowPitch, mapped.DepthPitch, gcnew DataStream( mapped.pData, sizeInBytes, true, true, false ) );\r
-               return box;\r
-       }\r
-\r
-       void DeviceContext::UnmapSubresource( Resource^ resource, int subresource )\r
-       {\r
-               InternalPointer->Unmap( resource->InternalPointer, subresource );\r
-       }\r
-\r
-       DeviceContextType DeviceContext::Type::get()\r
-       {\r
-               return static_cast<DeviceContextType>( InternalPointer->GetType() );\r
-       }\r
-\r
-       InputAssemblerWrapper^ DeviceContext::InputAssembler::get()\r
-       {\r
-               return inputAssembler;\r
-       }\r
-       \r
-       OutputMergerWrapper^ DeviceContext::OutputMerger::get()\r
-       {\r
-               return outputMerger;\r
-       }\r
-       \r
-       StreamOutputWrapper^ DeviceContext::StreamOutput::get()\r
-       {\r
-               return streamOutput;\r
-       }\r
-       \r
-       RasterizerWrapper^ DeviceContext::Rasterizer::get()\r
-       {\r
-               return rasterizer;\r
-       }\r
-\r
-       VertexShaderWrapper^ DeviceContext::VertexShader::get()\r
-       {\r
-               return vertexShader;\r
-       }\r
-\r
-       PixelShaderWrapper^ DeviceContext::PixelShader::get()\r
-       {\r
-               return pixelShader;\r
-       }\r
-\r
-       GeometryShaderWrapper^ DeviceContext::GeometryShader::get()\r
-       {\r
-               return geometryShader;\r
-       }\r
-\r
-       DomainShaderWrapper^ DeviceContext::DomainShader::get()\r
-       {\r
-               return domainShader;\r
-       }\r
-\r
-       HullShaderWrapper^ DeviceContext::HullShader::get()\r
-       {\r
-               return hullShader;\r
-       }\r
-\r
-       ComputeShaderWrapper^ DeviceContext::ComputeShader::get()\r
-       {\r
-               return computeShader;\r
-       }\r
-}\r
-}
\ No newline at end of file