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 "Capabilities.h"
\r
28 using namespace System;
\r
34 bool VertexShader20Caps::operator == ( VertexShader20Caps left, VertexShader20Caps right )
\r
36 return VertexShader20Caps::Equals( left, right );
\r
39 bool VertexShader20Caps::operator != ( VertexShader20Caps left, VertexShader20Caps right )
\r
41 return !VertexShader20Caps::Equals( left, right );
\r
44 int VertexShader20Caps::GetHashCode()
\r
46 return Caps.GetHashCode() + DynamicFlowControlDepth.GetHashCode() + TempCount.GetHashCode()
\r
47 + StaticFlowControlDepth.GetHashCode();
\r
50 bool VertexShader20Caps::Equals( Object^ value )
\r
52 if( value == nullptr )
\r
55 if( value->GetType() != GetType() )
\r
58 return Equals( safe_cast<VertexShader20Caps>( value ) );
\r
61 bool VertexShader20Caps::Equals( VertexShader20Caps value )
\r
63 return ( Caps == value.Caps && DynamicFlowControlDepth == value.DynamicFlowControlDepth && TempCount == value.TempCount
\r
64 && StaticFlowControlDepth == value.StaticFlowControlDepth );
\r
67 bool VertexShader20Caps::Equals( VertexShader20Caps% value1, VertexShader20Caps% value2 )
\r
69 return ( value1.Caps == value2.Caps && value1.DynamicFlowControlDepth == value2.DynamicFlowControlDepth && value1.TempCount == value2.TempCount
\r
70 && value1.StaticFlowControlDepth == value2.StaticFlowControlDepth );
\r
73 bool PixelShader20Caps::operator == ( PixelShader20Caps left, PixelShader20Caps right )
\r
75 return PixelShader20Caps::Equals( left, right );
\r
78 bool PixelShader20Caps::operator != ( PixelShader20Caps left, PixelShader20Caps right )
\r
80 return !PixelShader20Caps::Equals( left, right );
\r
83 int PixelShader20Caps::GetHashCode()
\r
85 return Caps.GetHashCode() + DynamicFlowControlDepth.GetHashCode() + TempCount.GetHashCode()
\r
86 + StaticFlowControlDepth.GetHashCode() + InstructionSlotCount.GetHashCode();
\r
89 bool PixelShader20Caps::Equals( Object^ value )
\r
91 if( value == nullptr )
\r
94 if( value->GetType() != GetType() )
\r
97 return Equals( safe_cast<PixelShader20Caps>( value ) );
\r
100 bool PixelShader20Caps::Equals( PixelShader20Caps value )
\r
102 return ( Caps == value.Caps && DynamicFlowControlDepth == value.DynamicFlowControlDepth && TempCount == value.TempCount
\r
103 && StaticFlowControlDepth == value.StaticFlowControlDepth &&
\r
104 InstructionSlotCount == value.InstructionSlotCount );
\r
107 bool PixelShader20Caps::Equals( PixelShader20Caps% value1, PixelShader20Caps% value2 )
\r
109 return ( value1.Caps == value2.Caps && value1.DynamicFlowControlDepth == value2.DynamicFlowControlDepth && value1.TempCount == value2.TempCount
\r
110 && value1.StaticFlowControlDepth == value2.StaticFlowControlDepth &&
\r
111 value1.InstructionSlotCount == value2.InstructionSlotCount );
\r
114 Capabilities::Capabilities( D3DCAPS9& caps )
\r
116 DeviceType = static_cast<SlimDX::Direct3D9::DeviceType>( caps.DeviceType );
\r
117 AdapterOrdinal = caps.AdapterOrdinal;
\r
119 Caps = static_cast<SlimDX::Direct3D9::Caps>( caps.Caps );
\r
120 Caps2 = static_cast<SlimDX::Direct3D9::Caps2>( caps.Caps2 );
\r
121 Caps3 = static_cast<SlimDX::Direct3D9::Caps3>( caps.Caps3 );
\r
122 PresentationIntervals = static_cast<SlimDX::Direct3D9::PresentInterval>( caps.PresentationIntervals );
\r
124 CursorCaps = static_cast<SlimDX::Direct3D9::CursorCaps>( caps.CursorCaps );
\r
126 DeviceCaps = static_cast<SlimDX::Direct3D9::DeviceCaps>( caps.DevCaps );
\r
128 PrimitiveMiscCaps = static_cast<SlimDX::Direct3D9::PrimitiveMiscCaps>( caps.PrimitiveMiscCaps );
\r
129 RasterCaps = static_cast<SlimDX::Direct3D9::RasterCaps>( caps.RasterCaps );
\r
130 DepthCompareCaps = static_cast<CompareCaps>( caps.ZCmpCaps );
\r
131 SourceBlendCaps = static_cast<BlendCaps>( caps.SrcBlendCaps );
\r
132 DestinationBlendCaps = static_cast<BlendCaps>( caps.DestBlendCaps );
\r
133 AlphaCompareCaps = static_cast<CompareCaps>( caps.AlphaCmpCaps );
\r
134 ShadeCaps = static_cast<SlimDX::Direct3D9::ShadeCaps>( caps.ShadeCaps );
\r
135 TextureCaps = static_cast<SlimDX::Direct3D9::TextureCaps>( caps.TextureCaps );
\r
136 TextureFilterCaps = static_cast<FilterCaps>( caps.TextureFilterCaps );
\r
137 CubeTextureFilterCaps = static_cast<FilterCaps>( caps.CubeTextureFilterCaps );
\r
138 VolumeTextureFilterCaps = static_cast<FilterCaps>( caps.VolumeTextureFilterCaps );
\r
139 TextureAddressCaps = static_cast<SlimDX::Direct3D9::TextureAddressCaps>( caps.TextureAddressCaps );
\r
140 VolumeTextureAddressCaps = static_cast<SlimDX::Direct3D9::TextureAddressCaps>( caps.VolumeTextureAddressCaps );
\r
142 LineCaps = static_cast<SlimDX::Direct3D9::LineCaps>( caps.LineCaps );
\r
144 MaxTextureWidth = caps.MaxTextureWidth;
\r
145 MaxTextureHeight = caps.MaxTextureHeight;
\r
146 MaxVolumeExtent = caps.MaxVolumeExtent;
\r
148 MaxTextureRepeat = caps.MaxTextureRepeat;
\r
149 MaxTextureAspectRatio = caps.MaxTextureAspectRatio;
\r
150 MaxAnisotropy = caps.MaxAnisotropy;
\r
151 MaxVertexW = caps.MaxVertexW;
\r
153 GuardBandLeft = caps.GuardBandLeft;
\r
154 GuardBandTop = caps.GuardBandTop;
\r
155 GuardBandRight = caps.GuardBandRight;
\r
156 GuardBandBottom = caps.GuardBandBottom;
\r
158 ExtentsAdjust = caps.ExtentsAdjust;
\r
159 StencilCaps = static_cast<SlimDX::Direct3D9::StencilCaps>( caps.StencilCaps );
\r
161 FVFCaps = static_cast<VertexFormatCaps>( caps.FVFCaps );
\r
162 TextureOperationCaps = static_cast<SlimDX::Direct3D9::TextureOperationCaps>( caps.TextureOpCaps );
\r
163 MaxTextureBlendStages = caps.MaxTextureBlendStages;
\r
164 MaxSimultaneousTextures = caps.MaxSimultaneousTextures;
\r
166 VertexProcessingCaps = static_cast<SlimDX::Direct3D9::VertexProcessingCaps>( caps.VertexProcessingCaps );
\r
167 MaxActiveLights = caps.MaxActiveLights;
\r
168 MaxUserClipPlanes = caps.MaxUserClipPlanes;
\r
169 MaxVertexBlendMatrices = caps.MaxVertexBlendMatrices;
\r
170 MaxVertexBlendMatrixIndex = caps.MaxVertexBlendMatrixIndex;
\r
172 MaxPointSize = caps.MaxPointSize;
\r
174 MaxPrimitiveCount = caps.MaxPrimitiveCount;
\r
175 MaxVertexIndex = caps.MaxVertexIndex;
\r
176 MaxStreams = caps.MaxStreams;
\r
177 MaxStreamStride = caps.MaxStreamStride;
\r
179 VertexShaderVersion = gcnew Version( D3DSHADER_VERSION_MAJOR( caps.VertexShaderVersion ),
\r
180 D3DSHADER_VERSION_MINOR( caps.VertexShaderVersion ) );
\r
181 MaxVertexShaderConstants = caps.MaxVertexShaderConst;
\r
183 PixelShaderVersion = gcnew Version( D3DSHADER_VERSION_MAJOR( caps.PixelShaderVersion ),
\r
184 D3DSHADER_VERSION_MINOR( caps.PixelShaderVersion ) );
\r
185 PixelShader1xMaxValue = caps.PixelShader1xMaxValue;
\r
187 DeviceCaps2 = static_cast<SlimDX::Direct3D9::DeviceCaps2>( caps.DevCaps2 );
\r
189 MaxNPatchTessellationLevel = caps.MaxNpatchTessellationLevel;
\r
191 MasterAdapterOrdinal = caps.MasterAdapterOrdinal;
\r
192 AdapterOrdinalInGroup = caps.AdapterOrdinalInGroup;
\r
193 NumberOfAdaptersInGroup = caps.NumberOfAdaptersInGroup;
\r
194 DeclarationTypes = static_cast<DeclarationTypeCaps>( caps.DeclTypes );
\r
195 SimultaneousRTCount = caps.NumSimultaneousRTs;
\r
196 StretchRectFilterCaps = static_cast<FilterCaps>( caps.StretchRectFilterCaps );
\r
197 VS20Caps = *reinterpret_cast<VertexShader20Caps*>( &caps.VS20Caps );
\r
198 PS20Caps = *reinterpret_cast<PixelShader20Caps*>( &caps.PS20Caps );
\r
199 VertexTextureFilterCaps = static_cast<FilterCaps>( caps.VertexTextureFilterCaps );
\r
200 MaxVShaderInstructionsExecuted = caps.MaxVShaderInstructionsExecuted;
\r
201 MaxPShaderInstructionsExecuted = caps.MaxPShaderInstructionsExecuted;
\r
202 MaxVertexShader30InstructionSlots = caps.MaxVertexShader30InstructionSlots;
\r
203 MaxPixelShader30InstructionSlots = caps.MaxPixelShader30InstructionSlots;
\r
206 bool Capabilities::operator == ( Capabilities^ left, Capabilities^ right )
\r
208 if( ReferenceEquals( left, nullptr ) )
\r
209 return ReferenceEquals( right, nullptr );
\r
211 return Capabilities::Equals( left, right );
\r
214 bool Capabilities::operator != ( Capabilities^ left, Capabilities^ right )
\r
216 return !( left == right );
\r
219 int Capabilities::GetHashCode()
\r
221 return DeviceType.GetHashCode() + AdapterOrdinal.GetHashCode();
\r
224 bool Capabilities::Equals( Object^ value )
\r
226 if( value == nullptr )
\r
229 if( value->GetType() != GetType() )
\r
232 return Equals( safe_cast<Capabilities^>( value ) );
\r
235 bool Capabilities::Equals( Capabilities^ value )
\r
237 if( value == nullptr )
\r
240 if( ReferenceEquals( this, value ) )
\r
243 return ( DeviceType == value->DeviceType && AdapterOrdinal == value->AdapterOrdinal && Caps == value->Caps
\r
244 && Caps2 == value->Caps2 && Caps3 == value->Caps3 && PresentationIntervals == value->PresentationIntervals
\r
245 && CursorCaps == value->CursorCaps && DeviceCaps == value->DeviceCaps && PrimitiveMiscCaps == value->PrimitiveMiscCaps
\r
246 && RasterCaps == value->RasterCaps && DepthCompareCaps == value->DepthCompareCaps && SourceBlendCaps == value->SourceBlendCaps
\r
247 && DestinationBlendCaps == value->DestinationBlendCaps && AlphaCompareCaps == value->AlphaCompareCaps && ShadeCaps == value->ShadeCaps
\r
248 && TextureCaps == value->TextureCaps && TextureFilterCaps == value->TextureFilterCaps && CubeTextureFilterCaps == value->CubeTextureFilterCaps
\r
249 && VolumeTextureFilterCaps == value->VolumeTextureFilterCaps && TextureAddressCaps == value->TextureAddressCaps && VolumeTextureAddressCaps == value->VolumeTextureAddressCaps
\r
250 && LineCaps == value->LineCaps && MaxTextureWidth == value->MaxTextureWidth && MaxTextureHeight == value->MaxTextureHeight
\r
251 && MaxVolumeExtent == value->MaxVolumeExtent && MaxTextureRepeat == value->MaxTextureRepeat && MaxTextureAspectRatio == value->MaxTextureAspectRatio
\r
252 && MaxAnisotropy == value->MaxAnisotropy && MaxVertexW == value->MaxVertexW && GuardBandLeft == value->GuardBandLeft
\r
253 && GuardBandTop == value->GuardBandTop && GuardBandRight == value->GuardBandRight && GuardBandBottom == value->GuardBandBottom
\r
254 && ExtentsAdjust == value->ExtentsAdjust && StencilCaps == value->StencilCaps && FVFCaps == value->FVFCaps
\r
255 && TextureOperationCaps == value->TextureOperationCaps && MaxTextureBlendStages == value->MaxTextureBlendStages && MaxSimultaneousTextures == value->MaxSimultaneousTextures
\r
256 && VertexProcessingCaps == value->VertexProcessingCaps && MaxActiveLights == value->MaxActiveLights && MaxUserClipPlanes == value->MaxUserClipPlanes
\r
257 && MaxVertexBlendMatrices == value->MaxVertexBlendMatrices && MaxVertexBlendMatrixIndex == value->MaxVertexBlendMatrixIndex && MaxPointSize == value->MaxPointSize
\r
258 && MaxPrimitiveCount == value->MaxPrimitiveCount && MaxVertexIndex == value->MaxVertexIndex && MaxStreams == value->MaxStreams
\r
259 && MaxStreamStride == value->MaxStreamStride && VertexShaderVersion == value->VertexShaderVersion && MaxVertexShaderConstants == value->MaxVertexShaderConstants
\r
260 && PixelShaderVersion == value->PixelShaderVersion && PixelShader1xMaxValue == value->PixelShader1xMaxValue && DeviceCaps2 == value->DeviceCaps2
\r
261 && MaxNPatchTessellationLevel == value->MaxNPatchTessellationLevel && MasterAdapterOrdinal == value->MasterAdapterOrdinal && AdapterOrdinalInGroup == value->AdapterOrdinalInGroup
\r
262 && NumberOfAdaptersInGroup == value->NumberOfAdaptersInGroup && DeclarationTypes == value->DeclarationTypes && SimultaneousRTCount == value->SimultaneousRTCount
\r
263 && StretchRectFilterCaps == value->StretchRectFilterCaps && VS20Caps == value->VS20Caps && PS20Caps == value->PS20Caps
\r
264 && VertexTextureFilterCaps == value->VertexTextureFilterCaps && MaxVShaderInstructionsExecuted == value->MaxVShaderInstructionsExecuted && MaxPShaderInstructionsExecuted == value->MaxPShaderInstructionsExecuted
\r
265 && MaxVertexShader30InstructionSlots == value->MaxVertexShader30InstructionSlots && MaxPixelShader30InstructionSlots == value->MaxPixelShader30InstructionSlots );
\r
268 bool Capabilities::Equals( Capabilities^ value1, Capabilities^ value2 )
\r
270 return value1->Equals( value2 );
\r