1/* 2 * Copyright 2007 Andras Kovacs 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19import "oaidl.idl"; 20import "ocidl.idl"; 21import "dxgitype.idl"; 22 23const UINT _FACDXGI = 0x87a; 24 25cpp_quote("#define MAKE_DXGI_STATUS(x) MAKE_HRESULT(0, _FACDXGI, x)") 26cpp_quote("#define MAKE_DXGI_HRESULT(x) MAKE_HRESULT(1, _FACDXGI, x)") 27 28cpp_quote("#if 0") 29typedef HANDLE HMONITOR; 30typedef struct _LUID { 31 DWORD LowPart; 32 LONG HighPart; 33} LUID, *PLUID; 34cpp_quote("#endif") 35 36typedef UINT DXGI_USAGE; 37const DXGI_USAGE DXGI_USAGE_SHADER_INPUT = 0x10L; 38const DXGI_USAGE DXGI_USAGE_RENDER_TARGET_OUTPUT = 0x20L; 39const DXGI_USAGE DXGI_USAGE_BACK_BUFFER = 0x40L; 40const DXGI_USAGE DXGI_USAGE_SHARED = 0x80L; 41const DXGI_USAGE DXGI_USAGE_READ_ONLY = 0x100L; 42const DXGI_USAGE DXGI_USAGE_DISCARD_ON_PRESENT = 0x200L; 43const DXGI_USAGE DXGI_USAGE_UNORDERED_ACCESS = 0x400L; 44 45const UINT DXGI_ENUM_MODES_INTERLACED = 1; 46const UINT DXGI_ENUM_MODES_SCALING = 2; 47 48const UINT DXGI_RESOURCE_PRIORITY_MINIMUM = 0x28000000; 49const UINT DXGI_RESOURCE_PRIORITY_LOW = 0x50000000; 50const UINT DXGI_RESOURCE_PRIORITY_NORMAL = 0x78000000; 51const UINT DXGI_RESOURCE_PRIORITY_HIGH = 0xa0000000; 52const UINT DXGI_RESOURCE_PRIORITY_MAXIMUM = 0xc8000000; 53 54const UINT DXGI_MAP_READ = 0x1; 55const UINT DXGI_MAP_WRITE = 0x2; 56const UINT DXGI_MAP_DISCARD = 0x4; 57 58typedef enum DXGI_SWAP_EFFECT { 59 DXGI_SWAP_EFFECT_DISCARD = 0, 60 DXGI_SWAP_EFFECT_SEQUENTIAL = 1, 61 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, 62 DXGI_SWAP_EFFECT_FLIP_DISCARD = 4 63} DXGI_SWAP_EFFECT; 64 65typedef enum DXGI_RESIDENCY { 66 DXGI_RESIDENCY_FULLY_RESIDENT = 1, 67 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, 68 DXGI_RESIDENCY_EVICTED_TO_DISK = 3, 69} DXGI_RESIDENCY; 70 71typedef struct DXGI_SURFACE_DESC { 72 UINT Width; 73 UINT Height; 74 DXGI_FORMAT Format; 75 DXGI_SAMPLE_DESC SampleDesc; 76} DXGI_SURFACE_DESC; 77 78typedef struct DXGI_MAPPED_RECT { 79 INT Pitch; 80 BYTE *pBits; 81} DXGI_MAPPED_RECT; 82 83typedef struct DXGI_OUTPUT_DESC { 84 WCHAR DeviceName[32]; 85 RECT DesktopCoordinates; 86 BOOL AttachedToDesktop; 87 DXGI_MODE_ROTATION Rotation; 88 HMONITOR Monitor; 89} DXGI_OUTPUT_DESC; 90 91typedef struct DXGI_FRAME_STATISTICS { 92 UINT PresentCount; 93 UINT PresentRefreshCount; 94 UINT SyncRefreshCount; 95 LARGE_INTEGER SyncQPCTime; 96 LARGE_INTEGER SyncGPUTime; 97} DXGI_FRAME_STATISTICS; 98 99typedef struct DXGI_ADAPTER_DESC { 100 WCHAR Description[128]; 101 UINT VendorId; 102 UINT DeviceId; 103 UINT SubSysId; 104 UINT Revision; 105 SIZE_T DedicatedVideoMemory; 106 SIZE_T DedicatedSystemMemory; 107 SIZE_T SharedSystemMemory; 108 LUID AdapterLuid; 109} DXGI_ADAPTER_DESC; 110 111typedef enum DXGI_SWAP_CHAIN_FLAG 112{ 113 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 0x0001, 114 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 0x0002, 115 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 0x0004, 116 DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTEXT = 0x0008, 117 DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 0x0010, 118 DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 0x0020, 119 DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 0x0040, 120 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 0x0080, 121 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 0x0100, 122 DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 0x0200, 123 DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 0x0400, 124 DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 0x0800, 125 DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 0x1000, 126} DXGI_SWAP_CHAIN_FLAG; 127 128typedef struct DXGI_SWAP_CHAIN_DESC { 129 DXGI_MODE_DESC BufferDesc; 130 DXGI_SAMPLE_DESC SampleDesc; 131 DXGI_USAGE BufferUsage; 132 UINT BufferCount; 133 HWND OutputWindow; 134 BOOL Windowed; 135 DXGI_SWAP_EFFECT SwapEffect; 136 UINT Flags; 137} DXGI_SWAP_CHAIN_DESC; 138 139typedef struct DXGI_SHARED_RESOURCE { 140 HANDLE Handle; 141} DXGI_SHARED_RESOURCE; 142 143[ 144 object, 145 local, 146 uuid(aec22fb8-76f3-4639-9be0-28eb43a67a2e) 147] 148interface IDXGIObject : IUnknown 149{ 150 HRESULT SetPrivateData( 151 [in] REFGUID guid, 152 [in] UINT data_size, 153 [in] const void *data 154 ); 155 HRESULT SetPrivateDataInterface( 156 [in] REFGUID guid, 157 [in] const IUnknown *object 158 ); 159 HRESULT GetPrivateData( 160 [in] REFGUID guid, 161 [in, out] UINT *data_size, 162 [out] void *data 163 ); 164 HRESULT GetParent( 165 [in] REFIID riid, 166 [out] void **parent 167 ); 168} 169 170[ 171 object, 172 local, 173 uuid(3d3e0379-f9de-4d58-bb6c-18d62992f1a6) 174] 175interface IDXGIDeviceSubObject : IDXGIObject 176{ 177 HRESULT GetDevice( 178 [in] REFIID riid, 179 [out] void **device 180 ); 181} 182 183[ 184 object, 185 uuid(035f3ab4-482e-4e50-b41f-8a7f8bd8960b), 186 local, 187 pointer_default(unique) 188] 189interface IDXGIResource : IDXGIDeviceSubObject 190{ 191 HRESULT GetSharedHandle([out] HANDLE *pSharedHandle); 192 HRESULT GetUsage([out] DXGI_USAGE *pUsage); 193 HRESULT SetEvictionPriority([in] UINT EvictionPriority); 194 HRESULT GetEvictionPriority([out, retval] UINT *pEvictionPriority); 195} 196 197[ 198 object, 199 uuid(9d8e1289-d7b3-465f-8126-250e349af85d), 200 local, 201 pointer_default(unique) 202] 203interface IDXGIKeyedMutex : IDXGIDeviceSubObject 204{ 205 HRESULT AcquireSync([in] UINT64 Key, [in] DWORD dwMilliseconds); 206 HRESULT ReleaseSync([in] UINT64 Key); 207} 208 209[ 210 object, 211 local, 212 uuid(cafcb56c-6ac3-4889-bf47-9e23bbd260ec) 213] 214interface IDXGISurface : IDXGIDeviceSubObject 215{ 216 HRESULT GetDesc( 217 [out] DXGI_SURFACE_DESC *desc 218 ); 219 HRESULT Map( 220 [out] DXGI_MAPPED_RECT *mapped_rect, 221 [in] UINT flags 222 ); 223 HRESULT Unmap( 224 ); 225} 226 227[ 228 object, 229 local, 230 uuid(4ae63092-6327-4c1b-80ae-bfe12ea32b86) 231] 232interface IDXGISurface1 : IDXGISurface 233{ 234 HRESULT GetDC( 235 [in] BOOL discard, 236 [out] HDC *hdc 237 ); 238 HRESULT ReleaseDC( 239 [in] RECT *dirty_rect 240 ); 241} 242 243[ 244 object, 245 local, 246 uuid(ae02eedb-c735-4690-8d52-5a8dc20213aa) 247] 248interface IDXGIOutput : IDXGIObject 249{ 250 HRESULT GetDesc( 251 [out] DXGI_OUTPUT_DESC *desc 252 ); 253 HRESULT GetDisplayModeList( 254 [in] DXGI_FORMAT format, 255 [in] UINT flags, 256 [in, out] UINT *mode_count, 257 [out] DXGI_MODE_DESC *desc 258 ); 259 HRESULT FindClosestMatchingMode( 260 [in] const DXGI_MODE_DESC *mode, 261 [out] DXGI_MODE_DESC *closest_match, 262 [in] IUnknown *device 263 ); 264 HRESULT WaitForVBlank( 265 ); 266 HRESULT TakeOwnership( 267 [in] IUnknown *device, 268 [in] BOOL exclusive 269 ); 270 void ReleaseOwnership( 271 ); 272 HRESULT GetGammaControlCapabilities( 273 [out] DXGI_GAMMA_CONTROL_CAPABILITIES *gamma_caps 274 ); 275 HRESULT SetGammaControl( 276 [in] const DXGI_GAMMA_CONTROL *gamma_control 277 ); 278 HRESULT GetGammaControl( 279 [out] DXGI_GAMMA_CONTROL *gamma_control 280 ); 281 HRESULT SetDisplaySurface( 282 [in] IDXGISurface *surface 283 ); 284 HRESULT GetDisplaySurfaceData( 285 [in] IDXGISurface *surface 286 ); 287 HRESULT GetFrameStatistics( 288 [out] DXGI_FRAME_STATISTICS *stats 289 ); 290} 291 292[ 293 object, 294 local, 295 uuid(2411e7e1-12ac-4ccf-bd14-9798e8534dc0) 296] 297interface IDXGIAdapter : IDXGIObject 298{ 299 HRESULT EnumOutputs( 300 [in] UINT output_idx, 301 [in, out] IDXGIOutput **output 302 ); 303 HRESULT GetDesc( 304 [out] DXGI_ADAPTER_DESC *desc 305 ); 306 HRESULT CheckInterfaceSupport( 307 [in] REFGUID guid, 308 [out] LARGE_INTEGER *umd_version 309 ); 310} 311 312cpp_quote("#define DXGI_MAX_SWAP_CHAIN_BUFFERS (16)") 313 314cpp_quote("#define DXGI_PRESENT_TEST __MSABI_LONG(0x00000001U)") 315cpp_quote("#define DXGI_PRESENT_DO_NOT_SEQUENCE __MSABI_LONG(0x00000002U)") 316cpp_quote("#define DXGI_PRESENT_RESTART __MSABI_LONG(0x00000004U)") 317cpp_quote("#define DXGI_PRESENT_DO_NOT_WAIT __MSABI_LONG(0x00000008U)") 318cpp_quote("#define DXGI_PRESENT_STEREO_PREFER_RIGHT __MSABI_LONG(0x00000010U)") 319cpp_quote("#define DXGI_PRESENT_STEREO_TEMPORARY_MONO __MSABI_LONG(0x00000020U)") 320cpp_quote("#define DXGI_PRESENT_RESTRICT_TO_OUTPUT __MSABI_LONG(0x00000040U)") 321cpp_quote("#define DXGI_PRESENT_USE_DURATION __MSABI_LONG(0x00000100U)") 322cpp_quote("#define DXGI_PRESENT_ALLOW_TEARING __MSABI_LONG(0x00000200U)") 323 324[ 325 object, 326 local, 327 uuid(310d36a0-d2e7-4c0a-aa04-6a9d23b8886a) 328] 329interface IDXGISwapChain : IDXGIDeviceSubObject 330{ 331 HRESULT Present( 332 [in] UINT sync_interval, 333 [in] UINT flags 334 ); 335 HRESULT GetBuffer( 336 [in] UINT buffer_idx, 337 [in] REFIID riid, 338 [in, out] void **surface 339 ); 340 HRESULT SetFullscreenState( 341 [in] BOOL fullscreen, 342 [in] IDXGIOutput *target 343 ); 344 HRESULT GetFullscreenState( 345 [out] BOOL *fullscreen, 346 [out] IDXGIOutput **target 347 ); 348 HRESULT GetDesc( 349 [out] DXGI_SWAP_CHAIN_DESC *desc 350 ); 351 HRESULT ResizeBuffers( 352 [in] UINT buffer_count, 353 [in] UINT width, 354 [in] UINT height, 355 [in] DXGI_FORMAT format, 356 [in] UINT flags 357 ); 358 HRESULT ResizeTarget( 359 [in] const DXGI_MODE_DESC *target_mode_desc 360 ); 361 HRESULT GetContainingOutput( 362 [out] IDXGIOutput **output 363 ); 364 HRESULT GetFrameStatistics( 365 [out] DXGI_FRAME_STATISTICS *stats 366 ); 367 HRESULT GetLastPresentCount( 368 [out] UINT *last_present_count 369 ); 370} 371 372cpp_quote("#define DXGI_MWA_NO_WINDOW_CHANGES 0x1") 373cpp_quote("#define DXGI_MWA_NO_ALT_ENTER 0x2") 374cpp_quote("#define DXGI_MWA_NO_PRINT_SCREEN 0x4") 375cpp_quote("#define DXGI_MWA_VALID 0x7") 376 377[ 378 object, 379 local, 380 uuid(7b7166ec-21c7-44ae-b21a-c9ae321ae369) 381] 382interface IDXGIFactory : IDXGIObject 383{ 384 HRESULT EnumAdapters( 385 [in] UINT adapter_idx, 386 [out] IDXGIAdapter **adapter 387 ); 388 HRESULT MakeWindowAssociation( 389 [in] HWND window, 390 [in] UINT flags 391 ); 392 HRESULT GetWindowAssociation( 393 [in] HWND *window 394 ); 395 HRESULT CreateSwapChain( 396 [in] IUnknown *device, 397 [in] DXGI_SWAP_CHAIN_DESC *desc, 398 [out] IDXGISwapChain **swapchain 399 ); 400 HRESULT CreateSoftwareAdapter( 401 [in] HMODULE swrast, 402 [out] IDXGIAdapter **adapter 403 ); 404} 405 406[local] HRESULT __stdcall CreateDXGIFactory(REFIID riid, void **factory); 407[local] HRESULT __stdcall CreateDXGIFactory1(REFIID riid, void **factory); 408 409[ 410 object, 411 local, 412 uuid(54ec77fa-1377-44e6-8c32-88fd5f44c84c) 413] 414interface IDXGIDevice : IDXGIObject 415{ 416 HRESULT GetAdapter( 417 [out] IDXGIAdapter **adapter 418 ); 419 HRESULT CreateSurface( 420 [in] const DXGI_SURFACE_DESC *desc, 421 [in] UINT surface_count, 422 [in] DXGI_USAGE usage, 423 [in] const DXGI_SHARED_RESOURCE *shared_resource, 424 [out] IDXGISurface **surface 425 ); 426 HRESULT QueryResourceResidency( 427 [in] IUnknown *const *resources, 428 [out] DXGI_RESIDENCY *residency, 429 [in] UINT resource_count 430 ); 431 HRESULT SetGPUThreadPriority( 432 [in] INT priority 433 ); 434 HRESULT GetGPUThreadPriority( 435 [out] INT *priority 436 ); 437} 438 439typedef enum DXGI_ADAPTER_FLAG { 440 DXGI_ADAPTER_FLAG_NONE = 0, 441 DXGI_ADAPTER_FLAG_REMOTE = 1, 442 DXGI_ADAPTER_FLAG_FORCE_DWORD = 0xFFFFFFFF 443} DXGI_ADAPTER_FLAG; 444 445typedef struct DXGI_ADAPTER_DESC1 { 446 WCHAR Description[128]; 447 UINT VendorId; 448 UINT DeviceId; 449 UINT SubSysId; 450 UINT Revision; 451 SIZE_T DedicatedVideoMemory; 452 SIZE_T DedicatedSystemMemory; 453 SIZE_T SharedSystemMemory; 454 LUID AdapterLuid; 455 UINT Flags; 456} DXGI_ADAPTER_DESC1; 457 458[ 459 object, 460 uuid(29038f61-3839-4626-91fd-086879011a05), 461 local, 462 pointer_default(unique) 463] 464interface IDXGIAdapter1 : IDXGIAdapter 465{ 466 HRESULT GetDesc1([out] DXGI_ADAPTER_DESC1 *pDesc); 467} 468 469[ 470 object, 471 uuid(77db970f-6276-48ba-ba28-070143b4392c), 472 local, 473 pointer_default(unique) 474] 475interface IDXGIDevice1 : IDXGIDevice 476{ 477 HRESULT SetMaximumFrameLatency([in] UINT MaxLatency); 478 HRESULT GetMaximumFrameLatency([out] UINT *pMaxLatency); 479} 480 481[ 482 object, 483 uuid(770aae78-f26f-4dba-a829-253c83d1b387), 484 local, 485 pointer_default(unique) 486 ] 487interface IDXGIFactory1 : IDXGIFactory 488{ 489 HRESULT EnumAdapters1([in] UINT Adapter, [out] IDXGIAdapter1 **ppAdapter); 490 BOOL IsCurrent(); 491} 492