OSDN Git Service

#36897 [DTXC] MIDIインポート機能の呼び出し口を、ファイルメニュー内にも配置。
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d11 / Device11.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy\r
5 * of this software and associated documentation files (the "Software"), to deal\r
6 * in the Software without restriction, including without limitation the rights\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
8 * copies of the Software, and to permit persons to whom the Software is\r
9 * furnished to do so, subject to the following conditions:\r
10\r
11 * The above copyright notice and this permission notice shall be included in\r
12 * all copies or substantial portions of the Software.\r
13\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "../ComObject.h"\r
25 \r
26 #include "../dxgi/Adapter.h"\r
27 #include "../dxgi/Enums.h"\r
28 #include "../dxgi/SwapChainDxgi.h"\r
29 #include "../dxgi/SwapChainDescription.h"\r
30 #include "../math/Color4.h"\r
31 \r
32 #include "Enums11.h"\r
33 \r
34 using System::Runtime::InteropServices::OutAttribute;\r
35 \r
36 namespace SlimDX\r
37 {\r
38         namespace Direct3D11\r
39         {\r
40                 ref class DeviceContext;\r
41                 value class CounterCapabilities;\r
42                 value class CounterMetadata;\r
43 \r
44                 /// <summary>\r
45                 /// Represents a virtual adapter used to perform rendering and create resources.\r
46                 /// </summary>\r
47                 /// <unmanaged>ID3D11Device</unmanaged>\r
48                 public ref class Device : ComObject\r
49                 {\r
50                         COMOBJECT(ID3D11Device, Device);\r
51 \r
52                 private:\r
53                         void Initialize( DXGI::Adapter^ adapter, DriverType driverType, DeviceCreationFlags flags, const D3D_FEATURE_LEVEL *featureLevels, int count );\r
54 \r
55                 public:\r
56                         /// <summary>\r
57                         /// The maximum number of multisample quality levels supported.\r
58                         /// </summary>\r
59                         literal int MultisampleCountMaximum = D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT;\r
60 \r
61                         /// <summary>\r
62                         /// Gets the flags used to create the device.\r
63                         /// </summary>\r
64                         property DeviceCreationFlags CreationFlags\r
65                         {\r
66                                 DeviceCreationFlags get();\r
67                         }\r
68 \r
69                         /// <summary>\r
70                         /// Gets the reason why the device was removed.\r
71                         /// </summary>\r
72                         property Result DeviceRemovedReason\r
73                         {\r
74                                 Result get();\r
75                         }\r
76 \r
77                         /// <summary>\r
78                         /// Gets the feature level of the hardware device.\r
79                         /// </summary>\r
80                         property FeatureLevel FeatureLevel\r
81                         {\r
82                                 Direct3D11::FeatureLevel get();\r
83                         }\r
84 \r
85                         /// <summary>\r
86                         /// Gets the intrinsic immediate context for the device.\r
87                         /// </summary>\r
88                         property DeviceContext^ ImmediateContext\r
89                         {\r
90                                 DeviceContext^ get();\r
91                         }\r
92 \r
93                         /// <summary>\r
94                         /// Gets a value indicating whether the current device is using the reference rasterizer.\r
95                         /// </summary>\r
96                         property bool IsReferenceDevice\r
97                         {\r
98                                 bool get();\r
99                         }\r
100 \r
101                         /// <summary>\r
102                         /// Initializes a new instance of the <see cref="Device"/> class using the highest supported feature level.\r
103                         /// </summary>\r
104                         /// <param name="adapter">The video adapter on which the device should be created.</param>\r
105                         Device( DXGI::Adapter^ adapter );\r
106 \r
107                         /// <summary>\r
108                         /// Initializes a new instance of the <see cref="Device"/> class using the highest supported feature level.\r
109                         /// </summary>\r
110                         /// <param name="adapter">The video adapter on which the device should be created.</param>\r
111                         /// <param name="flags">A list of runtime layers to enable.</param>\r
112                         Device( DXGI::Adapter^ adapter, DeviceCreationFlags flags );\r
113 \r
114                         /// <summary>\r
115                         /// Initializes a new instance of the <see cref="Device"/> class.\r
116                         /// </summary>\r
117                         /// <param name="adapter">The video adapter on which the device should be created.</param>\r
118                         /// <param name="flags">A list of runtime layers to enable.</param>\r
119                         /// <param name="featureLevels">A list of feature levels which determine the order of feature levels to attempt to create.</param>\r
120                         Device( DXGI::Adapter^ adapter, DeviceCreationFlags flags, ... array<Direct3D11::FeatureLevel>^ featureLevels );\r
121 \r
122                         /// <summary>\r
123                         /// Initializes a new instance of the <see cref="Device"/> class using the highest supported feature level.\r
124                         /// </summary>\r
125                         /// <param name="driverType">The type of device to create.</param>\r
126                         Device( DriverType driverType );\r
127 \r
128                         /// <summary>\r
129                         /// Initializes a new instance of the <see cref="Device"/> class using the highest supported feature level.\r
130                         /// </summary>\r
131                         /// <param name="driverType">The type of device to create.</param>\r
132                         /// <param name="flags">A list of runtime layers to enable.</param>\r
133                         Device( DriverType driverType, DeviceCreationFlags flags );\r
134 \r
135                         /// <summary>\r
136                         /// Initializes a new instance of the <see cref="Device"/> class.\r
137                         /// </summary>\r
138                         /// <param name="driverType">The type of device to create.</param>\r
139                         /// <param name="flags">A list of runtime layers to enable.</param>\r
140                         /// <param name="featureLevels">A list of feature levels which determine the order of feature levels to attempt to create.</param>\r
141                         Device( DriverType driverType, DeviceCreationFlags flags, ... array<Direct3D11::FeatureLevel>^ featureLevels );\r
142 \r
143                         /// <summary>\r
144                         /// Gets information about the device's performance counters.\r
145                         /// </summary>\r
146                         /// <returns>Information about the device's performance counters.</returns>\r
147                         CounterCapabilities GetCounterCapabilities();\r
148 \r
149                         /// <summary>\r
150                         /// Gets metadata (name, type, measurement units, et cetera) for a specific counter.\r
151                         /// </summary>\r
152                         /// <param name="counterKind">The type of the counter to retrieve information about.</param>\r
153                         /// <returns>Metadata for the specified counter.</returns>\r
154                         CounterMetadata GetCounterMetadata( CounterKind counterKind );\r
155                         \r
156                         /// <summary>\r
157                         /// Gets information about the supported applications of a specified format.\r
158                         /// </summary>\r
159                         /// <param name="format">The format for which to check support.</param>\r
160                         /// <returns>Flags indicating usage contexts in which the specified format is supported.</returns>\r
161                         FormatSupport CheckFormatSupport( DXGI::Format format );\r
162 \r
163                         /// <summary>\r
164                         /// Gets information about the supported compute shader applications of a specified format.\r
165                         /// </summary>\r
166                         /// <param name="format">The format for which to check support.</param>\r
167                         /// <returns>Flags indicating usage contexts in which the specified format is supported.</returns>\r
168                         ComputeShaderFormatSupport CheckComputeShaderFormatSupport( DXGI::Format format );\r
169 \r
170                         /// <summary>\r
171                         /// Checks for hardware support of the specified device feature.\r
172                         /// </summary>\r
173                         /// <returns><c>true</c> if the specified feature is supported; otherwise, <c>false</c>.</returns>\r
174                         bool CheckFeatureSupport( Feature feature );\r
175 \r
176                         /// <summary>\r
177                         /// Checks the level of hardware multithreading supported by this device.\r
178                         /// </summary>\r
179                         /// <param name="supportsConcurrentResources">When the method completes, contains a value indicating whether resources can be created concurrently on multiple threads while drawing.</param>\r
180                         /// <param name="supportCommandLists">When the method completes, contains a value indicating whether command lists are supported by the current driver.</param>\r
181                         /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
182                         Result CheckThreadingSupport( [Out] bool% supportsConcurrentResources, [Out] bool% supportCommandLists );\r
183 \r
184                         /// <summary>\r
185                         /// Gets the number of quality levels supported during multisampling of resources using a specified format.\r
186                         /// </summary>\r
187                         /// <param name="format">The format to check support for.</param>\r
188                         /// <param name="sampleCount">The multisample count for which to check support.</param>\r
189                         /// <returns>The number of quality levels supported. 0 if an error occured or if the format/sampleCount pair is not supported.</returns>\r
190                         int CheckMultisampleQualityLevels( DXGI::Format format, int sampleCount );\r
191 \r
192                         /// <summary>\r
193                         /// Gives the device access to a shared resource created on a different device.\r
194                         /// </summary>\r
195                         /// <typeparam name="T">The type of the resource.</typeparam>\r
196                         /// <param name="handle">A handle to the shared resource.</param>\r
197                         /// <returns>The new reference to the shared resource.</returns>\r
198                         generic<typename T> where T : ComObject\r
199                         T OpenSharedResource(System::IntPtr handle);\r
200 \r
201                         /// <summary>\r
202                         /// Switches between the reference rasterizer and a hardware accelerated device.\r
203                         /// </summary>\r
204                         /// <param name="useReferenceRasterizer"><c>true</c> to use the reference rasterizer; <c>false</c> to switch back to a hardware accelerated device.</param>\r
205                         void SwitchToReference(bool useReferenceRasterizer);\r
206 \r
207                         /// <summary>\r
208                         /// Gets the highest supported hardware feature level of the primary adapter.\r
209                         /// </summary>\r
210                         /// <returns>The highest supported hardware feature level.</returns>\r
211                         static Direct3D11::FeatureLevel GetSupportedFeatureLevel();\r
212 \r
213                         /// <summary>\r
214                         /// Gets the highest supported hardware feature level of the given adapter.\r
215                         /// </summary>\r
216                         /// <param name="adapter">The adapter for which the feature level is to be retrieved.</param>\r
217                         /// <returns>The highest supported hardware feature level.</returns>\r
218                         static Direct3D11::FeatureLevel GetSupportedFeatureLevel( DXGI::Adapter^ adapter );\r
219 \r
220                         /// <summary>\r
221                         /// Initializes a new instance of the <see cref="Device"/> class along with a new <see cref="SlimDX::DXGI::SwapChain"/> used for rendering.\r
222                         /// </summary>\r
223                         /// <param name="adapter">The video adapter on which the device should be created.</param>\r
224                         /// <param name="flags">A list of runtime layers to enable.</param>\r
225                         /// <param name="swapChainDescription">Details used to create the swap chain.</param>\r
226                         /// <param name="device">When the method completes, contains the created device instance.</param>\r
227                         /// <param name="swapChain">When the method completes, contains the created swap chain instance.</param>\r
228                         /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
229                         static Result CreateWithSwapChain( DXGI::Adapter^ adapter, DeviceCreationFlags flags, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
230                         \r
231                         /// <summary>\r
232                         /// Initializes a new instance of the <see cref="Device"/> class along with a new <see cref="SlimDX::DXGI::SwapChain"/> used for rendering.\r
233                         /// </summary>\r
234                         /// <param name="adapter">The video adapter on which the device should be created.</param>\r
235                         /// <param name="flags">A list of runtime layers to enable.</param>\r
236                         /// <param name="featureLevels">A list of feature levels which determine the order of feature levels to attempt to create.</param>\r
237                         /// <param name="swapChainDescription">Details used to create the swap chain.</param>\r
238                         /// <param name="device">When the method completes, contains the created device instance.</param>\r
239                         /// <param name="swapChain">When the method completes, contains the created swap chain instance.</param>\r
240                         /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
241                         static Result CreateWithSwapChain( DXGI::Adapter^ adapter, DeviceCreationFlags flags, array<Direct3D11::FeatureLevel>^ featureLevels, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
242 \r
243                         /// <summary>\r
244                         /// Initializes a new instance of the <see cref="Device"/> class along with a new <see cref="SlimDX::DXGI::SwapChain"/> used for rendering.\r
245                         /// </summary>\r
246                         /// <param name="driverType">The type of device to create.</param>\r
247                         /// <param name="flags">A list of runtime layers to enable.</param>\r
248                         /// <param name="swapChainDescription">Details used to create the swap chain.</param>\r
249                         /// <param name="device">When the method completes, contains the created device instance.</param>\r
250                         /// <param name="swapChain">When the method completes, contains the created swap chain instance.</param>\r
251                         /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
252                         static Result CreateWithSwapChain( DriverType driverType, DeviceCreationFlags flags, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
253                         \r
254                         /// <summary>\r
255                         /// Initializes a new instance of the <see cref="Device"/> class along with a new <see cref="SlimDX::DXGI::SwapChain"/> used for rendering.\r
256                         /// </summary>\r
257                         /// <param name="driverType">The type of device to create.</param>\r
258                         /// <param name="flags">A list of runtime layers to enable.</param>\r
259                         /// <param name="featureLevels">A list of feature levels which determine the order of feature levels to attempt to create.</param>\r
260                         /// <param name="swapChainDescription">Details used to create the swap chain.</param>\r
261                         /// <param name="device">When the method completes, contains the created device instance.</param>\r
262                         /// <param name="swapChain">When the method completes, contains the created swap chain instance.</param>\r
263                         /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>\r
264                         static Result CreateWithSwapChain( DriverType driverType, DeviceCreationFlags flags, array<Direct3D11::FeatureLevel>^ featureLevels, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
265 \r
266                         /// <summary>\r
267                         /// This overload has been deprecated. Use one of the alternatives that does not take both an adapter and a driver type.\r
268                         /// </summary>\r
269                         [System::Obsolete("This method is confusing because only one of the adapter/driverType parameters is valid during the call. Use one of the overloads that explicitly uses the parameter you wish to provide.")]\r
270                         static Result CreateWithSwapChain( DXGI::Adapter^ adapter, DriverType driverType, DeviceCreationFlags flags, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
271 \r
272                         /// <summary>\r
273                         /// This overload has been deprecated. Use one of the alternatives that does not take both an adapter and a driver type.\r
274                         /// </summary>\r
275                         [System::Obsolete("This method is confusing because only one of the adapter/driverType parameters is valid during the call. Use one of the overloads that explicitly uses the parameter you wish to provide.")]\r
276                         static Result CreateWithSwapChain( DXGI::Adapter^ adapter, DriverType driverType, DeviceCreationFlags flags, array<Direct3D11::FeatureLevel>^ featureLevels, DXGI::SwapChainDescription swapChainDescription, [Out] Device^ %device, [Out] DXGI::SwapChain^ %swapChain );\r
277                 };\r
278         }\r
279 };