OSDN Git Service

フォーラム[#56172] SlimDX(改)のフォルダ内容が不完全だったので再UP。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / Capabilities.cpp
1 #include "stdafx.h"\r
2 /*\r
3 * Copyright (c) 2007-2010 SlimDX Group\r
4\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
11\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
14\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
21 * THE SOFTWARE.\r
22 */\r
23 #include <d3d9.h>\r
24 #include <d3dx9.h>\r
25 \r
26 #include "Capabilities.h"\r
27 \r
28 using namespace System;\r
29 \r
30 namespace SlimDX\r
31 {\r
32 namespace Direct3D9\r
33 {\r
34         bool VertexShader20Caps::operator == ( VertexShader20Caps left, VertexShader20Caps right )\r
35         {\r
36                 return VertexShader20Caps::Equals( left, right );\r
37         }\r
38 \r
39         bool VertexShader20Caps::operator != ( VertexShader20Caps left, VertexShader20Caps right )\r
40         {\r
41                 return !VertexShader20Caps::Equals( left, right );\r
42         }\r
43 \r
44         int VertexShader20Caps::GetHashCode()\r
45         {\r
46                 return Caps.GetHashCode() + DynamicFlowControlDepth.GetHashCode() + TempCount.GetHashCode()\r
47                          + StaticFlowControlDepth.GetHashCode();\r
48         }\r
49 \r
50         bool VertexShader20Caps::Equals( Object^ value )\r
51         {\r
52                 if( value == nullptr )\r
53                         return false;\r
54 \r
55                 if( value->GetType() != GetType() )\r
56                         return false;\r
57 \r
58                 return Equals( safe_cast<VertexShader20Caps>( value ) );\r
59         }\r
60 \r
61         bool VertexShader20Caps::Equals( VertexShader20Caps value )\r
62         {\r
63                 return ( Caps == value.Caps && DynamicFlowControlDepth == value.DynamicFlowControlDepth && TempCount == value.TempCount\r
64                          && StaticFlowControlDepth == value.StaticFlowControlDepth );\r
65         }\r
66 \r
67         bool VertexShader20Caps::Equals( VertexShader20Caps% value1, VertexShader20Caps% value2 )\r
68         {\r
69                 return ( value1.Caps == value2.Caps && value1.DynamicFlowControlDepth == value2.DynamicFlowControlDepth && value1.TempCount == value2.TempCount\r
70                          && value1.StaticFlowControlDepth == value2.StaticFlowControlDepth );\r
71         }\r
72 \r
73         bool PixelShader20Caps::operator == ( PixelShader20Caps left, PixelShader20Caps right )\r
74         {\r
75                 return PixelShader20Caps::Equals( left, right );\r
76         }\r
77 \r
78         bool PixelShader20Caps::operator != ( PixelShader20Caps left, PixelShader20Caps right )\r
79         {\r
80                 return !PixelShader20Caps::Equals( left, right );\r
81         }\r
82 \r
83         int PixelShader20Caps::GetHashCode()\r
84         {\r
85                 return Caps.GetHashCode() + DynamicFlowControlDepth.GetHashCode() + TempCount.GetHashCode()\r
86                          + StaticFlowControlDepth.GetHashCode() + InstructionSlotCount.GetHashCode();\r
87         }\r
88 \r
89         bool PixelShader20Caps::Equals( Object^ value )\r
90         {\r
91                 if( value == nullptr )\r
92                         return false;\r
93 \r
94                 if( value->GetType() != GetType() )\r
95                         return false;\r
96 \r
97                 return Equals( safe_cast<PixelShader20Caps>( value ) );\r
98         }\r
99 \r
100         bool PixelShader20Caps::Equals( PixelShader20Caps value )\r
101         {\r
102                 return ( Caps == value.Caps && DynamicFlowControlDepth == value.DynamicFlowControlDepth && TempCount == value.TempCount\r
103                          && StaticFlowControlDepth == value.StaticFlowControlDepth &&\r
104                          InstructionSlotCount == value.InstructionSlotCount );\r
105         }\r
106 \r
107         bool PixelShader20Caps::Equals( PixelShader20Caps% value1, PixelShader20Caps% value2 )\r
108         {\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
112         }\r
113 \r
114         Capabilities::Capabilities( D3DCAPS9& caps )\r
115         {\r
116                 DeviceType = static_cast<SlimDX::Direct3D9::DeviceType>( caps.DeviceType );\r
117                 AdapterOrdinal = caps.AdapterOrdinal;\r
118 \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
123 \r
124                 CursorCaps = static_cast<SlimDX::Direct3D9::CursorCaps>( caps.CursorCaps );\r
125 \r
126                 DeviceCaps = static_cast<SlimDX::Direct3D9::DeviceCaps>( caps.DevCaps );\r
127 \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
141 \r
142                 LineCaps = static_cast<SlimDX::Direct3D9::LineCaps>( caps.LineCaps );\r
143 \r
144                 MaxTextureWidth = caps.MaxTextureWidth;\r
145                 MaxTextureHeight = caps.MaxTextureHeight;\r
146                 MaxVolumeExtent = caps.MaxVolumeExtent;\r
147 \r
148                 MaxTextureRepeat = caps.MaxTextureRepeat;\r
149                 MaxTextureAspectRatio = caps.MaxTextureAspectRatio;\r
150                 MaxAnisotropy = caps.MaxAnisotropy;\r
151                 MaxVertexW = caps.MaxVertexW;\r
152 \r
153                 GuardBandLeft = caps.GuardBandLeft;\r
154                 GuardBandTop = caps.GuardBandTop;\r
155                 GuardBandRight = caps.GuardBandRight;\r
156                 GuardBandBottom = caps.GuardBandBottom;\r
157 \r
158                 ExtentsAdjust = caps.ExtentsAdjust;\r
159                 StencilCaps = static_cast<SlimDX::Direct3D9::StencilCaps>( caps.StencilCaps );\r
160 \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
165 \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
171 \r
172                 MaxPointSize = caps.MaxPointSize;\r
173 \r
174                 MaxPrimitiveCount = caps.MaxPrimitiveCount;\r
175                 MaxVertexIndex = caps.MaxVertexIndex;\r
176                 MaxStreams = caps.MaxStreams;\r
177                 MaxStreamStride = caps.MaxStreamStride;\r
178 \r
179                 VertexShaderVersion = gcnew Version( D3DSHADER_VERSION_MAJOR( caps.VertexShaderVersion ), \r
180                         D3DSHADER_VERSION_MINOR( caps.VertexShaderVersion ) );\r
181                 MaxVertexShaderConstants = caps.MaxVertexShaderConst;\r
182 \r
183                 PixelShaderVersion = gcnew Version( D3DSHADER_VERSION_MAJOR( caps.PixelShaderVersion ), \r
184                         D3DSHADER_VERSION_MINOR( caps.PixelShaderVersion ) );\r
185                 PixelShader1xMaxValue = caps.PixelShader1xMaxValue;\r
186 \r
187                 DeviceCaps2 = static_cast<SlimDX::Direct3D9::DeviceCaps2>( caps.DevCaps2 );\r
188 \r
189                 MaxNPatchTessellationLevel = caps.MaxNpatchTessellationLevel;\r
190 \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
204         }\r
205 \r
206         bool Capabilities::operator == ( Capabilities^ left, Capabilities^ right )\r
207         {\r
208                 if( ReferenceEquals( left, nullptr ) )\r
209                         return ReferenceEquals( right, nullptr );\r
210 \r
211                 return Capabilities::Equals( left, right );\r
212         }\r
213 \r
214         bool Capabilities::operator != ( Capabilities^ left, Capabilities^ right )\r
215         {\r
216                 return !( left == right );\r
217         }\r
218 \r
219         int Capabilities::GetHashCode()\r
220         {\r
221                 return DeviceType.GetHashCode() + AdapterOrdinal.GetHashCode();\r
222         }\r
223 \r
224         bool Capabilities::Equals( Object^ value )\r
225         {\r
226                 if( value == nullptr )\r
227                         return false;\r
228 \r
229                 if( value->GetType() != GetType() )\r
230                         return false;\r
231 \r
232                 return Equals( safe_cast<Capabilities^>( value ) );\r
233         }\r
234 \r
235         bool Capabilities::Equals( Capabilities^ value )\r
236         {\r
237                 if( value == nullptr )\r
238                         return false;\r
239 \r
240                 if( ReferenceEquals( this, value ) )\r
241                         return true;\r
242 \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
266         }\r
267 \r
268         bool Capabilities::Equals( Capabilities^ value1, Capabilities^ value2 )\r
269         {\r
270                 return value1->Equals( value2 );\r
271         }\r
272 }\r
273 }