+++ /dev/null
-#include "stdafx.h"\r
-/*\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
-\r
-#include <d3d11.h>\r
-\r
-#include "DepthStencilViewDescription11.h"\r
-\r
-namespace SlimDX\r
-{\r
-namespace Direct3D11\r
-{\r
- DepthStencilViewDescription::DepthStencilViewDescription( const D3D11_DEPTH_STENCIL_VIEW_DESC& native )\r
- {\r
- Format = static_cast<DXGI::Format>( native.Format );\r
- Dimension = static_cast<DepthStencilViewDimension>( native.ViewDimension );\r
- Flags = static_cast<DepthStencilViewFlags>( native.Flags );\r
-\r
- switch( Dimension )\r
- {\r
- case DepthStencilViewDimension::Texture1D:\r
- MipSlice = native.Texture1D.MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture1DArray:\r
- ArraySize = native.Texture1DArray.ArraySize;\r
- FirstArraySlice = native.Texture1DArray.FirstArraySlice;\r
- MipSlice = native.Texture1DArray.MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2D:\r
- MipSlice = native.Texture2D.MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DArray:\r
- ArraySize = native.Texture2DArray.ArraySize;\r
- FirstArraySlice = native.Texture2DArray.FirstArraySlice;\r
- MipSlice = native.Texture2DArray.MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DMultisampled:\r
- // Nothing to do here.\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DMultisampledArray:\r
- ArraySize = native.Texture2DMSArray.ArraySize;\r
- FirstArraySlice = native.Texture2DMSArray.FirstArraySlice;\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
- }\r
- \r
- D3D11_DEPTH_STENCIL_VIEW_DESC DepthStencilViewDescription::CreateNativeVersion()\r
- {\r
- D3D11_DEPTH_STENCIL_VIEW_DESC native;\r
- native.Format = static_cast<DXGI_FORMAT>( Format );\r
- native.ViewDimension = static_cast<D3D11_DSV_DIMENSION>( Dimension );\r
- native.Flags = static_cast<UINT>( Flags );\r
-\r
- switch( Dimension )\r
- {\r
- case DepthStencilViewDimension::Texture1D:\r
- native.Texture1D.MipSlice = MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture1DArray:\r
- native.Texture1DArray.ArraySize = ArraySize;\r
- native.Texture1DArray.FirstArraySlice = FirstArraySlice;\r
- native.Texture1DArray.MipSlice = MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2D:\r
- native.Texture2D.MipSlice = MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DArray:\r
- native.Texture2DArray.ArraySize = ArraySize;\r
- native.Texture2DArray.FirstArraySlice = FirstArraySlice;\r
- native.Texture2DArray.MipSlice = MipSlice;\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DMultisampled:\r
- // Nothing to do here.\r
- break;\r
-\r
- case DepthStencilViewDimension::Texture2DMultisampledArray:\r
- native.Texture2DMSArray.ArraySize = ArraySize;\r
- native.Texture2DMSArray.FirstArraySlice = FirstArraySlice;\r
- break;\r
-\r
- default:\r
- break;\r
- }\r
- \r
- return native;\r
- }\r
-\r
- bool DepthStencilViewDescription::operator == ( DepthStencilViewDescription left, DepthStencilViewDescription right )\r
- {\r
- return DepthStencilViewDescription::Equals( left, right );\r
- }\r
-\r
- bool DepthStencilViewDescription::operator != ( DepthStencilViewDescription left, DepthStencilViewDescription right )\r
- {\r
- return !DepthStencilViewDescription::Equals( left, right );\r
- }\r
-\r
- int DepthStencilViewDescription::GetHashCode()\r
- {\r
- return Format.GetHashCode() + Dimension.GetHashCode() + MipSlice.GetHashCode()\r
- + FirstArraySlice.GetHashCode() + ArraySize.GetHashCode() + Flags.GetHashCode();\r
- }\r
-\r
- bool DepthStencilViewDescription::Equals( Object^ value )\r
- {\r
- if( value == nullptr )\r
- return false;\r
-\r
- if( value->GetType() != GetType() )\r
- return false;\r
-\r
- return Equals( safe_cast<DepthStencilViewDescription>( value ) );\r
- }\r
-\r
- bool DepthStencilViewDescription::Equals( DepthStencilViewDescription value )\r
- {\r
- return ( Format == value.Format && Dimension == value.Dimension && MipSlice == value.MipSlice\r
- && FirstArraySlice == value.FirstArraySlice && ArraySize == value.ArraySize && Flags == value.Flags );\r
- }\r
-\r
- bool DepthStencilViewDescription::Equals( DepthStencilViewDescription% value1, DepthStencilViewDescription% value2 )\r
- {\r
- return ( value1.Format == value2.Format && value1.Dimension == value2.Dimension && value1.MipSlice == value2.MipSlice\r
- && value1.FirstArraySlice == value2.FirstArraySlice && value1.ArraySize == value2.ArraySize && value1.Flags == value2.Flags );\r
- }\r
-}\r
-}\r