dxgi.idl 14 KB

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