1 // Copyright © 2015; Connor Hilarides 2 // Licensed under the MIT License <LICENSE.md> 3 //! Mappings for the contents of dxgi.h 4 STRUCT!{struct DXGI_FRAME_STATISTICS { 5 PresentCount: ::UINT, 6 PresentRefreshCount: ::UINT, 7 SyncRefreshCount: ::UINT, 8 SyncQPCTime: ::LARGE_INTEGER, 9 SyncGPUTime: ::LARGE_INTEGER, 10 }} 11 STRUCT!{struct DXGI_MAPPED_RECT { 12 Pitch: ::INT, 13 pBits: *mut ::BYTE, 14 }} 15 STRUCT!{nodebug struct DXGI_ADAPTER_DESC { 16 Description: [::WCHAR; 128], 17 VectorId: ::UINT, 18 DeviceId: ::UINT, 19 SubSysId: ::UINT, 20 Revision: ::UINT, 21 DedicatedVideoMemory: ::SIZE_T, 22 DedicatedSystemMemory: ::SIZE_T, 23 SharedSystemMemory: ::SIZE_T, 24 AdapterLuid: ::LUID, 25 }} 26 STRUCT!{nodebug struct DXGI_OUTPUT_DESC { 27 DeviceName: [::WCHAR; 32], 28 DesktopCoordinates: ::RECT, 29 AttachedToDesktop: ::BOOL, 30 Rotation: ::DXGI_MODE_ROTATION, 31 Monitor: ::HMONITOR, 32 }} 33 STRUCT!{struct DXGI_SHARED_RESOURCE { 34 Handle: ::HANDLE, 35 }} 36 pub const DXGI_RESOURCE_PRIORITY_MINIMUM: ::DWORD = 0x28000000; 37 pub const DXGI_RESOURCE_PRIORITY_LOW: ::DWORD = 0x50000000; 38 pub const DXGI_RESOURCE_PRIORITY_NORMAL: ::DWORD = 0x78000000; 39 pub const DXGI_RESOURCE_PRIORITY_HIGH: ::DWORD = 0xa0000000; 40 pub const DXGI_RESOURCE_PRIORITY_MAXIMUM: ::DWORD = 0xc8000000; 41 ENUM!{enum DXGI_RESIDENCY { 42 DXGI_RESIDENCY_FULLY_RESIDENT = 1, 43 DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, 44 DXGI_RESIDENCY_EVICTED_TO_DISK = 3, 45 }} 46 STRUCT!{struct DXGI_SURFACE_DESC { 47 Width: ::UINT, 48 Height: ::UINT, 49 Format: ::DXGI_FORMAT, 50 SampleDesc: ::DXGI_SAMPLE_DESC, 51 }} 52 ENUM!{enum DXGI_SWAP_EFFECT { 53 DXGI_SWAP_EFFECT_DISCARD = 0, 54 DXGI_SWAP_EFFECT_SEQUENTIAL = 1, 55 DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL = 3, 56 }} 57 FLAGS!{enum DXGI_SWAP_CHAIN_FLAG { 58 DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1, 59 DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2, 60 DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4, 61 DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8, 62 DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16, 63 DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32, 64 DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT = 64, 65 DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, 66 DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, 67 DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, 68 }} 69 STRUCT!{struct DXGI_SWAP_CHAIN_DESC { 70 BufferDesc: ::DXGI_MODE_DESC, 71 SampleDesc: ::DXGI_SAMPLE_DESC, 72 BufferUsage: ::DXGI_USAGE, 73 BufferCount: ::UINT, 74 OutputWindow: ::HWND, 75 Windowed: ::BOOL, 76 SwapEffect: DXGI_SWAP_EFFECT, 77 Flags: ::UINT, 78 }} 79 RIDL!( 80 interface IDXGIObject(IDXGIObjectVtbl): IUnknown(IUnknownVtbl) { 81 fn SetPrivateData( 82 &mut self, Name: ::REFGUID, DataSize: ::UINT, pData: *const ::c_void 83 ) -> ::HRESULT, 84 fn SetPrivateDataInterface(&mut self, Name: ::REFGUID, pUnknown: *const ::IUnknown) -> ::HRESULT, 85 fn GetPrivateData( 86 &mut self, Name: ::REFGUID, pDataSize: *mut ::UINT, pData: *mut ::c_void 87 ) -> ::HRESULT, 88 fn GetParent( 89 &mut self, riid: ::REFIID, ppParent: *mut *mut ::c_void 90 ) -> ::HRESULT 91 }); 92 RIDL!( 93 interface IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl): IDXGIObject(IDXGIObjectVtbl) { 94 fn GetDevice(&mut self, riid: ::REFIID, ppDevice: *mut *mut ::c_void) -> ::HRESULT 95 }); 96 RIDL!( 97 interface IDXGIResource(IDXGIResourceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { 98 fn GetSharedHandle(&mut self, pSharedHandle: *mut ::HANDLE) -> ::HRESULT, 99 fn GetUsage(&mut self, pUsage: *mut ::DXGI_USAGE) -> ::HRESULT, 100 fn SetEvictionPriority(&mut self, EvictionPriority: ::UINT) -> ::HRESULT, 101 fn GetEvictionPriority(&mut self, pEvictionPriority: *mut ::UINT) -> ::HRESULT 102 }); 103 RIDL!( 104 interface IDXGIKeyedMutex(IDXGIKeyedMutexVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { 105 fn AcquireSync(&mut self, Key: ::UINT64, dwMilliseconds: ::DWORD) -> ::HRESULT, 106 fn ReleaseSync(&mut self, Key: ::UINT64) -> ::HRESULT 107 }); 108 RIDL!( 109 interface IDXGISurface(IDXGISurfaceVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { 110 fn GetDesc(&mut self, pDesc: *mut DXGI_SURFACE_DESC) -> ::HRESULT, 111 fn Map(&mut self, pLockedRect: *mut DXGI_MAPPED_RECT, MapFlags: ::UINT) -> ::HRESULT, 112 fn Unmap(&mut self) -> ::HRESULT 113 }); 114 RIDL!( 115 interface IDXGISurface1(IDXGISurface1Vtbl): IDXGISurface(IDXGISurfaceVtbl) { 116 fn GetDC(&mut self, Discard: ::BOOL, phdc: *mut ::HDC) -> ::HRESULT, 117 fn ReleaseDC(&mut self, pDirtyRect: *mut ::RECT) -> ::HRESULT 118 }); 119 RIDL!( 120 interface IDXGIAdapter(IDXGIAdapterVtbl): IDXGIObject(IDXGIObjectVtbl) { 121 fn EnumOutputs(&mut self, Output: ::UINT, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, 122 fn GetDesc(&mut self, pDesc: *mut DXGI_ADAPTER_DESC) -> ::HRESULT, 123 fn CheckInterfaceSupport( 124 &mut self, InterfaceName: ::REFGUID, pUMDVersion: *mut ::LARGE_INTEGER 125 ) -> ::HRESULT 126 }); 127 RIDL!( 128 interface IDXGIOutput(IDXGIOutputVtbl): IDXGIObject(IDXGIObjectVtbl) { 129 fn GetDesc(&mut self, pDesc: *mut DXGI_OUTPUT_DESC) -> ::HRESULT, 130 fn GetDisplayModeList( 131 &mut self, EnumFormat: ::DXGI_FORMAT, Flags: ::UINT, pNumModes: *mut ::UINT, 132 pDesc: *mut ::DXGI_MODE_DESC 133 ) -> ::HRESULT, 134 fn FindClosestMatchingMode( 135 &mut self, pModeToMatch: *const ::DXGI_MODE_DESC, pClosestMatch: *mut ::DXGI_MODE_DESC, 136 pConcernedDevice: *mut ::IUnknown 137 ) -> ::HRESULT, 138 fn WaitForVBlank(&mut self) -> ::HRESULT, 139 fn TakeOwnership(&mut self, pDevice: *mut ::IUnknown, Exclusive: ::BOOL) -> ::HRESULT, 140 fn ReleaseOwnership(&mut self) -> (), 141 fn GetGammaControlCapabilities( 142 &mut self, pGammaCaps: *mut ::DXGI_GAMMA_CONTROL_CAPABILITIES 143 ) -> ::HRESULT, 144 fn SetGammaControl(&mut self, pArray: *const ::DXGI_GAMMA_CONTROL) -> ::HRESULT, 145 fn GetGammaControl(&mut self, pArray: *mut ::DXGI_GAMMA_CONTROL) -> ::HRESULT, 146 fn SetDisplaySurface(&mut self, pScanoutSurface: *mut IDXGISurface) -> ::HRESULT, 147 fn GetDisplaySurfaceData(&mut self, pDestination: *mut IDXGISurface) -> ::HRESULT, 148 fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT 149 }); 150 pub const DXGI_MAX_SWAP_CHAIN_BUFFERS: ::DWORD = 16; 151 pub const DXGI_PRESENT_TEST: ::DWORD = 0x00000001; 152 pub const DXGI_PRESENT_DO_NOT_SEQUENCE: ::DWORD = 0x00000002; 153 pub const DXGI_PRESENT_RESTART: ::DWORD = 0x00000004; 154 pub const DXGI_PRESENT_DO_NOT_WAIT: ::DWORD = 0x00000008; 155 pub const DXGI_PRESENT_STEREO_PREFER_RIGHT: ::DWORD = 0x00000010; 156 pub const DXGI_PRESENT_STEREO_TEMPORARY_MONO: ::DWORD = 0x00000020; 157 pub const DXGI_PRESENT_RESTRICT_TO_OUTPUT: ::DWORD = 0x00000040; 158 pub const DXGI_PRESENT_USE_DURATION: ::DWORD = 0x00000100; 159 RIDL!( 160 interface IDXGISwapChain(IDXGISwapChainVtbl): IDXGIDeviceSubObject(IDXGIDeviceSubObjectVtbl) { 161 fn Present(&mut self, SyncInterval: ::UINT, Flags: ::UINT) -> ::HRESULT, 162 fn GetBuffer( 163 &mut self, Buffer: ::UINT, riid: ::REFIID, ppSurface: *mut *mut ::c_void 164 ) -> ::HRESULT, 165 fn SetFullscreenState(&mut self, Fullscreen: ::BOOL, pTarget: *mut IDXGIOutput) -> ::HRESULT, 166 fn GetFullscreenState( 167 &mut self, pFullscreen: *mut ::BOOL, ppTarget: *mut *mut IDXGIOutput 168 ) -> ::HRESULT, 169 fn GetDesc(&mut self, pDesc: *mut DXGI_SWAP_CHAIN_DESC) -> ::HRESULT, 170 fn ResizeBuffers( 171 &mut self, BufferCount: ::UINT, Width: ::UINT, Height: ::UINT, NewFormat: ::DXGI_FORMAT, 172 SwapChainFlags: ::UINT 173 ) -> ::HRESULT, 174 fn ResizeTarget(&mut self, pNewTargetParameters: *const ::DXGI_MODE_DESC) -> ::HRESULT, 175 fn GetContainingOutput(&mut self, ppOutput: *mut *mut IDXGIOutput) -> ::HRESULT, 176 fn GetFrameStatistics(&mut self, pStats: *mut DXGI_FRAME_STATISTICS) -> ::HRESULT, 177 fn GetLastPresentCount(&mut self, pLastPresentCount: *mut ::UINT) -> ::HRESULT 178 }); 179 RIDL!( 180 interface IDXGIFactory(IDXGIFactoryVtbl): IDXGIObject(IDXGIObjectVtbl) { 181 fn EnumAdapters(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, 182 fn MakeWindowAssociation(&mut self, WindowHandle: ::HWND, Flags: ::UINT) -> ::HRESULT, 183 fn GetWindowAssociation(&mut self, pWindowHandle: *mut ::HWND) -> ::HRESULT, 184 fn CreateSwapChain( 185 &mut self, pDevice: *mut ::IUnknown, pDesc: *mut DXGI_SWAP_CHAIN_DESC, 186 ppSwapChain: *mut *mut IDXGISwapChain 187 ) -> ::HRESULT, 188 fn CreateSoftwareAdapter( 189 &mut self, Module: ::HMODULE, ppAdapter: *mut *mut IDXGIAdapter 190 ) -> ::HRESULT 191 }); 192 RIDL!( 193 interface IDXGIDevice(IDXGIDeviceVtbl): IDXGIObject(IDXGIObjectVtbl) { 194 fn GetAdapter(&mut self, pAdapter: *mut *mut IDXGIAdapter) -> ::HRESULT, 195 fn CreateSurface( 196 &mut self, pDesc: *const DXGI_SURFACE_DESC, NumSurfaces: ::UINT, Usage: ::DXGI_USAGE, 197 pSharedResource: *const DXGI_SHARED_RESOURCE, ppSurface: *mut *mut IDXGISurface 198 ) -> ::HRESULT, 199 fn QueryResourceResidency( 200 &mut self, ppResources: *const *mut ::IUnknown, pResidencyStatus: *mut DXGI_RESIDENCY, 201 NumResources: ::UINT 202 ) -> ::HRESULT, 203 fn SetGPUThreadPriority(&mut self, Priority: ::INT) -> ::HRESULT, 204 fn GetGPUThreadPriority(&mut self, pPriority: *mut ::INT) -> ::HRESULT 205 }); 206 ENUM!{enum DXGI_ADAPTER_FLAG { 207 DXGI_ADAPTER_FLAG_NONE, 208 DXGI_ADAPTER_FLAG_REMOTE, 209 DXGI_ADAPTER_FLAG_SOFTWARE, 210 }} 211 STRUCT!{nodebug struct DXGI_ADAPTER_DESC1 { 212 Description: [::WCHAR; 128], 213 VendorId: ::UINT, 214 DeviceId: ::UINT, 215 SubSysId: ::UINT, 216 Revision: ::UINT, 217 DedicatedVideoMemory: ::SIZE_T, 218 DedicatedSystemMemory: ::SIZE_T, 219 SharedSystemMemory: ::SIZE_T, 220 AdapterLuid: ::LUID, 221 Flags: ::UINT, 222 }} 223 STRUCT!{struct DXGI_DISPLAY_COLOR_SPACE { 224 PrimaryCoordinates: [[::FLOAT; 2]; 8], 225 WhitePoints: [[::FLOAT; 2]; 16], 226 }} 227 RIDL!( 228 interface IDXGIFactory1(IDXGIFactory1Vtbl): IDXGIFactory(IDXGIFactoryVtbl) { 229 fn EnumAdapters1(&mut self, Adapter: ::UINT, ppAdapter: *mut *mut IDXGIAdapter1) -> ::HRESULT, 230 fn IsCurrent(&mut self) -> ::BOOL 231 }); 232 RIDL!( 233 interface IDXGIAdapter1(IDXGIAdapter1Vtbl): IDXGIAdapter(IDXGIAdapterVtbl) { 234 fn GetDesc1(&mut self, pDesc: *mut DXGI_ADAPTER_DESC1) -> ::HRESULT 235 }); 236 RIDL!( 237 interface IDXGIDevice1(IDXGIDevice1Vtbl): IDXGIDevice(IDXGIDeviceVtbl) { 238 fn SetMaximumFrameLatency(&mut self, MaxLatency: ::UINT) -> ::HRESULT, 239 fn GetMaximumFrameLatency(&mut self, pMaxLatency: *mut ::UINT) -> ::HRESULT 240 }); 241