3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
26 #include "DepthStencilViewDescription11.h"
\r
30 namespace Direct3D11
\r
32 DepthStencilViewDescription::DepthStencilViewDescription( const D3D11_DEPTH_STENCIL_VIEW_DESC& native )
\r
34 Format = static_cast<DXGI::Format>( native.Format );
\r
35 Dimension = static_cast<DepthStencilViewDimension>( native.ViewDimension );
\r
36 Flags = static_cast<DepthStencilViewFlags>( native.Flags );
\r
40 case DepthStencilViewDimension::Texture1D:
\r
41 MipSlice = native.Texture1D.MipSlice;
\r
44 case DepthStencilViewDimension::Texture1DArray:
\r
45 ArraySize = native.Texture1DArray.ArraySize;
\r
46 FirstArraySlice = native.Texture1DArray.FirstArraySlice;
\r
47 MipSlice = native.Texture1DArray.MipSlice;
\r
50 case DepthStencilViewDimension::Texture2D:
\r
51 MipSlice = native.Texture2D.MipSlice;
\r
54 case DepthStencilViewDimension::Texture2DArray:
\r
55 ArraySize = native.Texture2DArray.ArraySize;
\r
56 FirstArraySlice = native.Texture2DArray.FirstArraySlice;
\r
57 MipSlice = native.Texture2DArray.MipSlice;
\r
60 case DepthStencilViewDimension::Texture2DMultisampled:
\r
61 // Nothing to do here.
\r
64 case DepthStencilViewDimension::Texture2DMultisampledArray:
\r
65 ArraySize = native.Texture2DMSArray.ArraySize;
\r
66 FirstArraySlice = native.Texture2DMSArray.FirstArraySlice;
\r
74 D3D11_DEPTH_STENCIL_VIEW_DESC DepthStencilViewDescription::CreateNativeVersion()
\r
76 D3D11_DEPTH_STENCIL_VIEW_DESC native;
\r
77 native.Format = static_cast<DXGI_FORMAT>( Format );
\r
78 native.ViewDimension = static_cast<D3D11_DSV_DIMENSION>( Dimension );
\r
79 native.Flags = static_cast<UINT>( Flags );
\r
83 case DepthStencilViewDimension::Texture1D:
\r
84 native.Texture1D.MipSlice = MipSlice;
\r
87 case DepthStencilViewDimension::Texture1DArray:
\r
88 native.Texture1DArray.ArraySize = ArraySize;
\r
89 native.Texture1DArray.FirstArraySlice = FirstArraySlice;
\r
90 native.Texture1DArray.MipSlice = MipSlice;
\r
93 case DepthStencilViewDimension::Texture2D:
\r
94 native.Texture2D.MipSlice = MipSlice;
\r
97 case DepthStencilViewDimension::Texture2DArray:
\r
98 native.Texture2DArray.ArraySize = ArraySize;
\r
99 native.Texture2DArray.FirstArraySlice = FirstArraySlice;
\r
100 native.Texture2DArray.MipSlice = MipSlice;
\r
103 case DepthStencilViewDimension::Texture2DMultisampled:
\r
104 // Nothing to do here.
\r
107 case DepthStencilViewDimension::Texture2DMultisampledArray:
\r
108 native.Texture2DMSArray.ArraySize = ArraySize;
\r
109 native.Texture2DMSArray.FirstArraySlice = FirstArraySlice;
\r
119 bool DepthStencilViewDescription::operator == ( DepthStencilViewDescription left, DepthStencilViewDescription right )
\r
121 return DepthStencilViewDescription::Equals( left, right );
\r
124 bool DepthStencilViewDescription::operator != ( DepthStencilViewDescription left, DepthStencilViewDescription right )
\r
126 return !DepthStencilViewDescription::Equals( left, right );
\r
129 int DepthStencilViewDescription::GetHashCode()
\r
131 return Format.GetHashCode() + Dimension.GetHashCode() + MipSlice.GetHashCode()
\r
132 + FirstArraySlice.GetHashCode() + ArraySize.GetHashCode() + Flags.GetHashCode();
\r
135 bool DepthStencilViewDescription::Equals( Object^ value )
\r
137 if( value == nullptr )
\r
140 if( value->GetType() != GetType() )
\r
143 return Equals( safe_cast<DepthStencilViewDescription>( value ) );
\r
146 bool DepthStencilViewDescription::Equals( DepthStencilViewDescription value )
\r
148 return ( Format == value.Format && Dimension == value.Dimension && MipSlice == value.MipSlice
\r
149 && FirstArraySlice == value.FirstArraySlice && ArraySize == value.ArraySize && Flags == value.Flags );
\r
152 bool DepthStencilViewDescription::Equals( DepthStencilViewDescription% value1, DepthStencilViewDescription% value2 )
\r
154 return ( value1.Format == value2.Format && value1.Dimension == value2.Dimension && value1.MipSlice == value2.MipSlice
\r
155 && value1.FirstArraySlice == value2.FirstArraySlice && value1.ArraySize == value2.ArraySize && value1.Flags == value2.Flags );
\r