José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 1 | ########################################################################## |
| 2 | # |
| 3 | # Copyright 2011 Jose Fonseca |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | # of this software and associated documentation files (the "Software"), to deal |
| 8 | # in the Software without restriction, including without limitation the rights |
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | # copies of the Software, and to permit persons to whom the Software is |
| 11 | # furnished to do so, subject to the following conditions: |
| 12 | # |
| 13 | # The above copyright notice and this permission notice shall be included in |
| 14 | # all copies or substantial portions of the Software. |
| 15 | # |
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | # THE SOFTWARE. |
| 23 | # |
| 24 | ##########################################################################/ |
| 25 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 26 | |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 27 | from dxgitype import * |
| 28 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 29 | |
| 30 | IDXGIObject = Interface("IDXGIObject", IUnknown) |
| 31 | IDXGIDeviceSubObject = Interface("IDXGIDeviceSubObject", IDXGIObject) |
| 32 | IDXGIResource = Interface("IDXGIResource", IDXGIDeviceSubObject) |
| 33 | IDXGIKeyedMutex = Interface("IDXGIKeyedMutex", IDXGIDeviceSubObject) |
| 34 | IDXGISurface = Interface("IDXGISurface", IDXGIDeviceSubObject) |
| 35 | IDXGISurface1 = Interface("IDXGISurface1", IDXGISurface) |
| 36 | IDXGIAdapter = Interface("IDXGIAdapter", IDXGIObject) |
| 37 | IDXGIOutput = Interface("IDXGIOutput", IDXGIObject) |
| 38 | IDXGISwapChain = Interface("IDXGISwapChain", IDXGIDeviceSubObject) |
| 39 | IDXGIFactory = Interface("IDXGIFactory", IDXGIObject) |
| 40 | IDXGIDevice = Interface("IDXGIDevice", IDXGIObject) |
| 41 | IDXGIFactory1 = Interface("IDXGIFactory1", IDXGIFactory) |
| 42 | IDXGIAdapter1 = Interface("IDXGIAdapter1", IDXGIAdapter) |
| 43 | IDXGIDevice1 = Interface("IDXGIDevice1", IDXGIDevice) |
Jeff Muizelaar | 4d57f31 | 2013-11-19 15:18:31 -0500 | [diff] [blame^] | 44 | IDXGIFactory2 = Interface("IDXGIFactory2", IDXGIFactory1) |
| 45 | IDXGISwapChain1 = Interface("IDXGISwapChain1", IDXGISwapChain) |
| 46 | IDXGIDevice2 = Interface("IDXGIDevice2", IDXGIDevice1) |
| 47 | IDXGIAdapter2 = Interface("IDXGIAdapter2", IDXGIAdapter1) |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 48 | |
| 49 | |
| 50 | DXGI_USAGE = Flags(UINT, [ |
José Fonseca | 467a42a | 2012-05-04 11:49:19 +0100 | [diff] [blame] | 51 | "DXGI_CPU_ACCESS_NONE", # 0 |
| 52 | "DXGI_CPU_ACCESS_SCRATCH", # 3 |
| 53 | "DXGI_CPU_ACCESS_DYNAMIC", # 1 |
| 54 | "DXGI_CPU_ACCESS_READ_WRITE", # 2 |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 55 | "DXGI_USAGE_SHADER_INPUT", |
| 56 | "DXGI_USAGE_RENDER_TARGET_OUTPUT", |
| 57 | "DXGI_USAGE_BACK_BUFFER", |
| 58 | "DXGI_USAGE_SHARED", |
| 59 | "DXGI_USAGE_READ_ONLY", |
| 60 | "DXGI_USAGE_DISCARD_ON_PRESENT", |
| 61 | "DXGI_USAGE_UNORDERED_ACCESS", |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 62 | ]) |
| 63 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 64 | DXGI_FRAME_STATISTICS = Struct("DXGI_FRAME_STATISTICS", [ |
| 65 | (UINT, "PresentCount"), |
| 66 | (UINT, "PresentRefreshCount"), |
| 67 | (UINT, "SyncRefreshCount"), |
| 68 | (LARGE_INTEGER, "SyncQPCTime"), |
| 69 | (LARGE_INTEGER, "SyncGPUTime"), |
| 70 | ]) |
| 71 | |
| 72 | DXGI_MAPPED_RECT = Struct("DXGI_MAPPED_RECT", [ |
| 73 | (INT, "Pitch"), |
José Fonseca | fc047bb | 2013-05-29 19:28:03 +0100 | [diff] [blame] | 74 | (LinearPointer(BYTE, "_MappedSize"), "pBits"), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 75 | ]) |
| 76 | |
| 77 | DXGI_ADAPTER_DESC = Struct("DXGI_ADAPTER_DESC", [ |
| 78 | (WString, "Description"), |
| 79 | (UINT, "VendorId"), |
| 80 | (UINT, "DeviceId"), |
| 81 | (UINT, "SubSysId"), |
| 82 | (UINT, "Revision"), |
| 83 | (SIZE_T, "DedicatedVideoMemory"), |
| 84 | (SIZE_T, "DedicatedSystemMemory"), |
| 85 | (SIZE_T, "SharedSystemMemory"), |
| 86 | (LUID, "AdapterLuid"), |
| 87 | ]) |
| 88 | |
| 89 | DXGI_OUTPUT_DESC = Struct("DXGI_OUTPUT_DESC", [ |
| 90 | (WString, "DeviceName"), |
| 91 | (RECT, "DesktopCoordinates"), |
| 92 | (BOOL, "AttachedToDesktop"), |
| 93 | (DXGI_MODE_ROTATION, "Rotation"), |
| 94 | (HMONITOR, "Monitor"), |
| 95 | ]) |
| 96 | |
| 97 | DXGI_SHARED_RESOURCE = Struct("DXGI_SHARED_RESOURCE", [ |
| 98 | (HANDLE, "Handle"), |
| 99 | ]) |
| 100 | |
| 101 | DXGI_RESOURCE_PRIORITY = FakeEnum(UINT, [ |
| 102 | "DXGI_RESOURCE_PRIORITY_MINIMUM", |
| 103 | "DXGI_RESOURCE_PRIORITY_LOW", |
| 104 | "DXGI_RESOURCE_PRIORITY_NORMAL", |
| 105 | "DXGI_RESOURCE_PRIORITY_HIGH", |
| 106 | "DXGI_RESOURCE_PRIORITY_MAXIMUM", |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 107 | ]) |
| 108 | |
| 109 | DXGI_RESIDENCY = Enum("DXGI_RESIDENCY", [ |
| 110 | "DXGI_RESIDENCY_FULLY_RESIDENT", |
| 111 | "DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY", |
| 112 | "DXGI_RESIDENCY_EVICTED_TO_DISK", |
| 113 | ]) |
| 114 | |
| 115 | DXGI_SURFACE_DESC = Struct("DXGI_SURFACE_DESC", [ |
| 116 | (UINT, "Width"), |
| 117 | (UINT, "Height"), |
| 118 | (DXGI_FORMAT, "Format"), |
| 119 | (DXGI_SAMPLE_DESC, "SampleDesc"), |
| 120 | ]) |
| 121 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 122 | DXGI_SWAP_EFFECT = Enum("DXGI_SWAP_EFFECT", [ |
| 123 | "DXGI_SWAP_EFFECT_DISCARD", |
| 124 | "DXGI_SWAP_EFFECT_SEQUENTIAL", |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 125 | ]) |
| 126 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 127 | DXGI_SWAP_CHAIN_FLAG = Flags(UINT, [ |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 128 | "DXGI_SWAP_CHAIN_FLAG_NONPREROTATED", |
| 129 | "DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH", |
| 130 | "DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE", |
| 131 | ]) |
| 132 | |
| 133 | DXGI_SWAP_CHAIN_DESC = Struct("DXGI_SWAP_CHAIN_DESC", [ |
| 134 | (DXGI_MODE_DESC, "BufferDesc"), |
| 135 | (DXGI_SAMPLE_DESC, "SampleDesc"), |
| 136 | (DXGI_USAGE, "BufferUsage"), |
| 137 | (UINT, "BufferCount"), |
| 138 | (HWND, "OutputWindow"), |
| 139 | (BOOL, "Windowed"), |
| 140 | (DXGI_SWAP_EFFECT, "SwapEffect"), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 141 | (DXGI_SWAP_CHAIN_FLAG, "Flags"), |
| 142 | ]) |
| 143 | |
Jeff Muizelaar | 4d57f31 | 2013-11-19 15:18:31 -0500 | [diff] [blame^] | 144 | DXGI_SCALING = Enum("DXGI_SCALING", [ |
| 145 | "DXGI_SCALING_STRETCH", |
| 146 | "DXGI_SCALING_NONE", |
| 147 | ]) |
| 148 | |
| 149 | DXGI_ALPHA_MODE = Enum("DXGI_ALPHA_MODE", [ |
| 150 | "DXGI_ALPHA_MODE_UNSPECIFIED", |
| 151 | "DXGI_ALPHA_MODE_PREMULTIPLIED", |
| 152 | "DXGI_ALPHA_MODE_STRAIGHT", |
| 153 | "DXGI_ALPHA_MODE_IGNORE", |
| 154 | ]) |
| 155 | |
| 156 | DXGI_SWAP_CHAIN_DESC1 = Struct("DXGI_SWAP_CHAIN_DESC1", [ |
| 157 | (UINT, "Width"), |
| 158 | (UINT, "Height"), |
| 159 | (DXGI_FORMAT, "Format"), |
| 160 | (BOOL, "Stereo"), |
| 161 | (DXGI_SAMPLE_DESC, "SampleDesc"), |
| 162 | (DXGI_USAGE, "BufferUsage"), |
| 163 | (UINT, "BufferCount"), |
| 164 | (DXGI_SCALING, "Scaling"), |
| 165 | (DXGI_SWAP_EFFECT, "SwapEffect"), |
| 166 | (DXGI_ALPHA_MODE, "AlphaMode"), |
| 167 | (UINT, "Flags"), |
| 168 | ]) |
| 169 | |
| 170 | DXGI_SWAP_CHAIN_FULLSCREEN_DESC = Struct("DXGI_SWAP_CHAIN_FULLSCREEN_DESC", [ |
| 171 | (DXGI_RATIONAL, "RefreshRate"), |
| 172 | (DXGI_MODE_SCANLINE_ORDER, "ScanlineOrdering"), |
| 173 | (DXGI_MODE_SCALING, "Scaling"), |
| 174 | (BOOL, "Windowed"), |
| 175 | ]) |
| 176 | |
| 177 | DXGI_PRESENT_PARAMETERS = Struct("DXGI_PRESENT_PARAMETERS", [ |
| 178 | (UINT, "DirtyRectsCount"), |
| 179 | (Pointer(RECT), "pDirtyRects"), |
| 180 | (Pointer(RECT), "pScrollRect"), |
| 181 | (Pointer(POINT), "pScrollOffset"), |
| 182 | ]) |
| 183 | |
| 184 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 185 | IDXGIObject.methods += [ |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 186 | StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "Name"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")], sideeffects=False), |
| 187 | StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "Name"), (OpaquePointer(Const(IUnknown)), "pUnknown")], sideeffects=False), |
| 188 | StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "Name"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 189 | StdMethod(HRESULT, "GetParent", [(REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppParent")]), |
| 190 | ] |
| 191 | |
| 192 | IDXGIDeviceSubObject.methods += [ |
| 193 | StdMethod(HRESULT, "GetDevice", [(REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppDevice")]), |
| 194 | ] |
| 195 | |
| 196 | IDXGIResource.methods += [ |
| 197 | StdMethod(HRESULT, "GetSharedHandle", [Out(Pointer(HANDLE), "pSharedHandle")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 198 | StdMethod(HRESULT, "GetUsage", [Out(Pointer(DXGI_USAGE), "pUsage")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 199 | StdMethod(HRESULT, "SetEvictionPriority", [(DXGI_RESOURCE_PRIORITY, "EvictionPriority")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 200 | StdMethod(HRESULT, "GetEvictionPriority", [Out(Pointer(DXGI_RESOURCE_PRIORITY), "pEvictionPriority")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 201 | ] |
| 202 | |
Jeff Muizelaar | cd3f69e | 2013-03-11 15:56:30 -0400 | [diff] [blame] | 203 | DXGI_SHARED_RESOURCE_FLAG = Flags(DWORD, [ |
| 204 | "DXGI_SHARED_RESOURCE_READ", |
| 205 | "DXGI_SHARED_RESOURCE_WRITE", |
| 206 | ]) |
| 207 | |
| 208 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 209 | IDXGIKeyedMutex.methods += [ |
| 210 | StdMethod(HRESULT, "AcquireSync", [(UINT64, "Key"), (DWORD, "dwMilliseconds")]), |
| 211 | StdMethod(HRESULT, "ReleaseSync", [(UINT64, "Key")]), |
| 212 | ] |
| 213 | |
| 214 | DXGI_MAP = Flags(UINT, [ |
| 215 | "DXGI_MAP_READ", |
| 216 | "DXGI_MAP_WRITE", |
| 217 | "DXGI_MAP_DISCARD", |
| 218 | ]) |
| 219 | |
| 220 | IDXGISurface.methods += [ |
José Fonseca | 3f17437 | 2012-05-08 12:09:42 +0100 | [diff] [blame] | 221 | StdMethod(HRESULT, "GetDesc", [Out(Pointer(DXGI_SURFACE_DESC), "pDesc")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 222 | StdMethod(HRESULT, "Map", [Out(Pointer(DXGI_MAPPED_RECT), "pLockedRect"), (DXGI_MAP, "MapFlags")]), |
| 223 | StdMethod(HRESULT, "Unmap", []), |
| 224 | ] |
| 225 | |
| 226 | IDXGISurface1.methods += [ |
| 227 | StdMethod(HRESULT, "GetDC", [(BOOL, "Discard"), Out(Pointer(HDC), "phdc")]), |
| 228 | StdMethod(HRESULT, "ReleaseDC", [(Pointer(RECT), "pDirtyRect")]), |
| 229 | ] |
| 230 | |
| 231 | IDXGIAdapter.methods += [ |
| 232 | StdMethod(HRESULT, "EnumOutputs", [(UINT, "Output"), Out(Pointer(ObjPointer(IDXGIOutput)), "ppOutput")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 233 | StdMethod(HRESULT, "GetDesc", [Out(Pointer(DXGI_ADAPTER_DESC), "pDesc")], sideeffects=False), |
| 234 | StdMethod(HRESULT, "CheckInterfaceSupport", [(REFGUID, "InterfaceName"), Out(Pointer(LARGE_INTEGER), "pUMDVersion")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 235 | ] |
| 236 | |
| 237 | DXGI_ENUM_MODES = Flags(UINT, [ |
| 238 | "DXGI_ENUM_MODES_INTERLACED", |
| 239 | "DXGI_ENUM_MODES_SCALING", |
| 240 | ]) |
| 241 | |
| 242 | IDXGIOutput.methods += [ |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 243 | StdMethod(HRESULT, "GetDesc", [Out(Pointer(DXGI_OUTPUT_DESC), "pDesc")], sideeffects=False), |
| 244 | StdMethod(HRESULT, "GetDisplayModeList", [(DXGI_FORMAT, "EnumFormat"), (DXGI_ENUM_MODES, "Flags"), Out(Pointer(UINT), "pNumModes"), Out(Array(DXGI_MODE_DESC, "*pNumModes"), "pDesc")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 245 | StdMethod(HRESULT, "FindClosestMatchingMode", [(Pointer(Const(DXGI_MODE_DESC)), "pModeToMatch"), Out(Pointer(DXGI_MODE_DESC), "pClosestMatch"), (ObjPointer(IUnknown), "pConcernedDevice")]), |
| 246 | StdMethod(HRESULT, "WaitForVBlank", []), |
| 247 | StdMethod(HRESULT, "TakeOwnership", [(ObjPointer(IUnknown), "pDevice"), (BOOL, "Exclusive")]), |
| 248 | StdMethod(Void, "ReleaseOwnership", []), |
| 249 | StdMethod(HRESULT, "GetGammaControlCapabilities", [Out(Pointer(DXGI_GAMMA_CONTROL_CAPABILITIES), "pGammaCaps")]), |
| 250 | StdMethod(HRESULT, "SetGammaControl", [(Pointer(Const(DXGI_GAMMA_CONTROL)), "pArray")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 251 | StdMethod(HRESULT, "GetGammaControl", [Out(Pointer(DXGI_GAMMA_CONTROL), "pArray")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 252 | StdMethod(HRESULT, "SetDisplaySurface", [(ObjPointer(IDXGISurface), "pScanoutSurface")]), |
| 253 | StdMethod(HRESULT, "GetDisplaySurfaceData", [(ObjPointer(IDXGISurface), "pDestination")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 254 | StdMethod(HRESULT, "GetFrameStatistics", [Out(Pointer(DXGI_FRAME_STATISTICS), "pStats")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 255 | ] |
| 256 | |
| 257 | DXGI_PRESENT = Flags(UINT, [ |
| 258 | "DXGI_PRESENT_TEST", |
| 259 | "DXGI_PRESENT_DO_NOT_SEQUENCE", |
| 260 | "DXGI_PRESENT_RESTART", |
| 261 | ]) |
| 262 | |
| 263 | IDXGISwapChain.methods += [ |
| 264 | StdMethod(HRESULT, "Present", [(UINT, "SyncInterval"), (DXGI_PRESENT, "Flags")]), |
| 265 | StdMethod(HRESULT, "GetBuffer", [(UINT, "Buffer"), (REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppSurface")]), |
| 266 | StdMethod(HRESULT, "SetFullscreenState", [(BOOL, "Fullscreen"), (ObjPointer(IDXGIOutput), "pTarget")]), |
| 267 | StdMethod(HRESULT, "GetFullscreenState", [Out(Pointer(BOOL), "pFullscreen"), Out(Pointer(ObjPointer(IDXGIOutput)), "ppTarget")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 268 | StdMethod(HRESULT, "GetDesc", [Out(Pointer(DXGI_SWAP_CHAIN_DESC), "pDesc")], sideeffects=False), |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 269 | StdMethod(HRESULT, "ResizeBuffers", [(UINT, "BufferCount"), (UINT, "Width"), (UINT, "Height"), (DXGI_FORMAT, "NewFormat"), (DXGI_SWAP_CHAIN_FLAG, "SwapChainFlags")]), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 270 | StdMethod(HRESULT, "ResizeTarget", [(Pointer(Const(DXGI_MODE_DESC)), "pNewTargetParameters")]), |
| 271 | StdMethod(HRESULT, "GetContainingOutput", [Out(Pointer(ObjPointer(IDXGIOutput)), "ppOutput")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 272 | StdMethod(HRESULT, "GetFrameStatistics", [Out(Pointer(DXGI_FRAME_STATISTICS), "pStats")], sideeffects=False), |
| 273 | StdMethod(HRESULT, "GetLastPresentCount", [Out(Pointer(UINT), "pLastPresentCount")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 274 | ] |
| 275 | |
| 276 | DXGI_MWA = Flags(UINT, [ |
| 277 | "DXGI_MWA_NO_WINDOW_CHANGES", |
| 278 | "DXGI_MWA_NO_ALT_ENTER", |
| 279 | "DXGI_MWA_NO_PRINT_SCREEN", |
| 280 | "DXGI_MWA_VALID", |
| 281 | ]) |
| 282 | |
| 283 | IDXGIFactory.methods += [ |
| 284 | StdMethod(HRESULT, "EnumAdapters", [(UINT, "Adapter"), Out(Pointer(ObjPointer(IDXGIAdapter)), "ppAdapter")]), |
| 285 | StdMethod(HRESULT, "MakeWindowAssociation", [(HWND, "WindowHandle"), (DXGI_MWA, "Flags")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 286 | StdMethod(HRESULT, "GetWindowAssociation", [Out(Pointer(HWND), "pWindowHandle")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 287 | StdMethod(HRESULT, "CreateSwapChain", [(ObjPointer(IUnknown), "pDevice"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pDesc"), Out(Pointer(ObjPointer(IDXGISwapChain)), "ppSwapChain")]), |
| 288 | StdMethod(HRESULT, "CreateSoftwareAdapter", [(HMODULE, "Module"), Out(Pointer(ObjPointer(IDXGIAdapter)), "ppAdapter")]), |
| 289 | ] |
| 290 | |
| 291 | IDXGIDevice.methods += [ |
| 292 | StdMethod(HRESULT, "GetAdapter", [Out(Pointer(ObjPointer(IDXGIAdapter)), "pAdapter")]), |
| 293 | StdMethod(HRESULT, "CreateSurface", [(Pointer(Const(DXGI_SURFACE_DESC)), "pDesc"), (UINT, "NumSurfaces"), (DXGI_USAGE, "Usage"), (Pointer(Const(DXGI_SHARED_RESOURCE)), "pSharedResource"), Out(Pointer(ObjPointer(IDXGISurface)), "ppSurface")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 294 | StdMethod(HRESULT, "QueryResourceResidency", [(Array(Const(ObjPointer(IUnknown)), "NumResources"), "ppResources"), Out(Array(DXGI_RESIDENCY, "NumResources"), "pResidencyStatus"), (UINT, "NumResources")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 295 | StdMethod(HRESULT, "SetGPUThreadPriority", [(INT, "Priority")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 296 | StdMethod(HRESULT, "GetGPUThreadPriority", [Out(Pointer(INT), "pPriority")], sideeffects=False), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 297 | ] |
| 298 | |
| 299 | DXGI_ADAPTER_FLAG = Enum("DXGI_ADAPTER_FLAG", [ |
| 300 | "DXGI_ADAPTER_FLAG_NONE", |
| 301 | "DXGI_ADAPTER_FLAG_REMOTE", |
| 302 | ]) |
| 303 | |
| 304 | DXGI_ADAPTER_DESC1 = Struct("DXGI_ADAPTER_DESC1", [ |
| 305 | (WString, "Description"), |
| 306 | (UINT, "VendorId"), |
| 307 | (UINT, "DeviceId"), |
| 308 | (UINT, "SubSysId"), |
| 309 | (UINT, "Revision"), |
| 310 | (SIZE_T, "DedicatedVideoMemory"), |
| 311 | (SIZE_T, "DedicatedSystemMemory"), |
| 312 | (SIZE_T, "SharedSystemMemory"), |
| 313 | (LUID, "AdapterLuid"), |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 314 | (UINT, "Flags"), |
| 315 | ]) |
| 316 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 317 | DXGI_DISPLAY_COLOR_SPACE = Struct("DXGI_DISPLAY_COLOR_SPACE", [ |
| 318 | (Array(Array(FLOAT, 8), 2), "PrimaryCoordinates"), |
| 319 | (Array(Array(FLOAT, 16), 2), "WhitePoints"), |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 320 | ]) |
| 321 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 322 | IDXGIFactory1.methods += [ |
| 323 | StdMethod(HRESULT, "EnumAdapters1", [(UINT, "Adapter"), Out(Pointer(ObjPointer(IDXGIAdapter1)), "ppAdapter")]), |
| 324 | StdMethod(BOOL, "IsCurrent", []), |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 325 | ] |
| 326 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 327 | IDXGIAdapter1.methods += [ |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 328 | StdMethod(HRESULT, "GetDesc1", [Out(Pointer(DXGI_ADAPTER_DESC1), "pDesc")], sideeffects=False), |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 329 | ] |
| 330 | |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 331 | IDXGIDevice1.methods += [ |
| 332 | StdMethod(HRESULT, "SetMaximumFrameLatency", [(UINT, "MaxLatency")]), |
José Fonseca | 45fff9c | 2012-05-08 09:07:27 +0100 | [diff] [blame] | 333 | StdMethod(HRESULT, "GetMaximumFrameLatency", [Out(Pointer(UINT), "pMaxLatency")], sideeffects=False), |
José Fonseca | af7d231 | 2011-07-07 10:16:57 +0100 | [diff] [blame] | 334 | ] |
| 335 | |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 336 | |
| 337 | IDXGIFactoryDWM = Interface("IDXGIFactoryDWM", IUnknown) |
| 338 | IDXGISwapChainDWM = Interface("IDXGISwapChainDWM", IDXGIDeviceSubObject) |
| 339 | |
| 340 | IDXGIFactoryDWM.methods += [ |
| 341 | StdMethod(HRESULT, "CreateSwapChain", [(ObjPointer(IUnknown), "pDevice"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pDesc"), (ObjPointer(IDXGIOutput), "pOutput"), Out(Pointer(ObjPointer(IDXGISwapChainDWM)), "ppSwapChain")]), |
| 342 | ] |
| 343 | |
José Fonseca | b2f773d | 2014-02-28 14:46:23 +0000 | [diff] [blame] | 344 | # http://shchetinin.blogspot.co.uk/2012/04/dwm-graphics-directx-win8win7.html |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 345 | IDXGISwapChainDWM.methods += [ |
| 346 | StdMethod(HRESULT, "Present", [(UINT, "SyncInterval"), (DXGI_PRESENT, "Flags")]), |
| 347 | StdMethod(HRESULT, "GetBuffer", [(UINT, "Buffer"), (REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppSurface")]), |
| 348 | StdMethod(HRESULT, "GetDesc", [Out(Pointer(DXGI_SWAP_CHAIN_DESC), "pDesc")], sideeffects=False), |
| 349 | StdMethod(HRESULT, "ResizeBuffers", [(UINT, "BufferCount"), (UINT, "Width"), (UINT, "Height"), (DXGI_FORMAT, "NewFormat"), (DXGI_SWAP_CHAIN_FLAG, "SwapChainFlags")]), |
| 350 | StdMethod(HRESULT, "ResizeTarget", [(Pointer(Const(DXGI_MODE_DESC)), "pNewTargetParameters")]), |
| 351 | StdMethod(HRESULT, "GetContainingOutput", [Out(Pointer(ObjPointer(IDXGIOutput)), "ppOutput")]), |
José Fonseca | b2f773d | 2014-02-28 14:46:23 +0000 | [diff] [blame] | 352 | StdMethod(HRESULT, "GetFrameStatistics", [Out(Pointer(DXGI_FRAME_STATISTICS), "pStats")], sideeffects=False), |
| 353 | StdMethod(HRESULT, "GetLastPresentCount", [Out(Pointer(UINT), "pLastPresentCount")], sideeffects=False), |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 354 | StdMethod(HRESULT, "SetFullscreenState", [(BOOL, "Fullscreen"), (ObjPointer(IDXGIOutput), "pTarget")]), |
| 355 | StdMethod(HRESULT, "GetFullscreenState", [Out(Pointer(BOOL), "pFullscreen"), Out(Pointer(ObjPointer(IDXGIOutput)), "ppTarget")]), |
| 356 | ] |
| 357 | |
Jeff Muizelaar | 4d57f31 | 2013-11-19 15:18:31 -0500 | [diff] [blame^] | 358 | IDXGIFactory2.methods += [ |
| 359 | StdMethod(BOOL, "IsWindowedStereoEnabled", []), |
| 360 | StdMethod(HRESULT, "CreateSwapChainForHwnd", [(ObjPointer(IUnknown), "pDevice"), (HWND, "WindowHandle"), (Pointer(Const(DXGI_SWAP_CHAIN_DESC1)), "pDesc"), (Pointer(Const(DXGI_SWAP_CHAIN_FULLSCREEN_DESC)), "pFullscreenDesc"), (ObjPointer(IDXGIOutput), "pRestrictToOutput"), Out(Pointer(ObjPointer(IDXGISwapChain1)), "ppSwapChain")]), |
| 361 | StdMethod(HRESULT, "CreateSwapChainForCoreWindow", [(ObjPointer(IUnknown), "pDevice"), (ObjPointer(IUnknown), "pWindow"), (Pointer(Const(DXGI_SWAP_CHAIN_DESC1)), "pDesc"), (ObjPointer(IDXGIOutput), "pRestrictToOutput"), Out(Pointer(ObjPointer(IDXGISwapChain1)), "ppSwapChain")]), |
| 362 | StdMethod(HRESULT, "CreateSwapChainForComposition", [(ObjPointer(IUnknown), "pDevice"), (Pointer(Const(DXGI_SWAP_CHAIN_DESC1)), "pDesc"), (ObjPointer(IDXGIOutput), "pRestrictToOutput"), Out(Pointer(ObjPointer(IDXGISwapChain1)), "ppSwapChain")]), |
| 363 | StdMethod(HRESULT, "GetSharedResourceAdapterLuid", [(HANDLE, "hResource"), Out(Pointer(LUID), "pLuid")]), |
| 364 | StdMethod(HRESULT, "RegisterStereoStatusWindow", [(HWND, "WindowHandle"), (UINT, "wMsg"), Out(Pointer(DWORD), "pdwCookie")]), |
| 365 | StdMethod(HRESULT, "RegisterStereoStatusEvent", [(HANDLE, "hEvent"), Out(Pointer(DWORD), "pdwCookie")]), |
| 366 | StdMethod(Void, "UnregisterStereoStatus", [(DWORD, "dwCookie")]), |
| 367 | StdMethod(HRESULT, "RegisterOcclusionStatusWindow", [(HWND, "WindowHandle"), (UINT, "wMsg"), Out(Pointer(DWORD), "pdwCookie")]), |
| 368 | StdMethod(HRESULT, "RegisterOcclusionStatusEvent", [(HANDLE, "hEvent"), Out(Pointer(DWORD), "pdwCookie")]), |
| 369 | StdMethod(Void, "UnregisterOcclusionStatus", [(DWORD, "dwCookie")]), |
| 370 | ] |
| 371 | |
| 372 | IDXGISwapChain1.methods += [ |
| 373 | StdMethod(HRESULT, "GetBackgroundColor", [(Out(Pointer(DXGI_RGBA), "pColor"))]), |
| 374 | StdMethod(HRESULT, "GetCoreWindow", [(REFIID, "riid"), (Out(Pointer(ObjPointer(Void)), "ppUnk"))]), |
| 375 | StdMethod(HRESULT, "GetDesc1", [(Out(Pointer(DXGI_SWAP_CHAIN_DESC1), "pDesc"))]), |
| 376 | StdMethod(HRESULT, "GetFullscreenDesc", [(Out(Pointer(DXGI_SWAP_CHAIN_FULLSCREEN_DESC), "pDesc"))]), |
| 377 | StdMethod(HRESULT, "GetHwnd", [(Out(Pointer(HWND), "pHwnd"))]), |
| 378 | StdMethod(HRESULT, "GetRestrictToOutput", [(Out(Pointer(ObjPointer(IDXGIOutput)), "ppRestrictToOutput"))]), |
| 379 | StdMethod(HRESULT, "GetRotation", [(Out(Pointer(DXGI_MODE_ROTATION), "ppRestrictToOutput"))]), |
| 380 | StdMethod(BOOL, "IsTemporaryMonoSupported", []), |
| 381 | StdMethod(HRESULT, "Present1", [(UINT, "SyncInterval"), (UINT, "Flags"), (Pointer(Const(DXGI_PRESENT_PARAMETERS)), "pPresentParameters")]), |
| 382 | StdMethod(HRESULT, "SetBackgroundColor", [(Pointer(Const(DXGI_RGBA)), "pColor")]), |
| 383 | StdMethod(HRESULT, "SetRotation", [(DXGI_MODE_ROTATION, "Rotation")]), |
| 384 | ] |
| 385 | |
| 386 | DXGI_OFFER_RESOURCE_PRIORITY = Enum("DXGI_OFFER_RESOURCE_PRIORITY", [ |
| 387 | "DXGI_OFFER_RESOURCE_PRIORITY_LOW", |
| 388 | "DXGI_OFFER_RESOURCE_PRIORITY_NORMAL", |
| 389 | "DXGI_OFFER_RESOURCE_PRIORITY_HIGH", |
| 390 | ]) |
| 391 | |
| 392 | IDXGIDevice2.methods += [ |
| 393 | StdMethod(HRESULT, "OfferResources", [(UINT, "NumResources"), (Array(Const(ObjPointer(IDXGIResource)), "NumResources"), "ppResources"), (DXGI_OFFER_RESOURCE_PRIORITY, "Priority")]), |
| 394 | StdMethod(HRESULT, "ReclaimResources", [(UINT, "NumResources"), (Array(Const(ObjPointer(IDXGIResource)), "NumResources"), "ppResources"), Out(Pointer(BOOL), "pDiscarded")]), |
| 395 | StdMethod(HRESULT, "EnqueueSetEvent", [(HANDLE, "hEvent")]), |
| 396 | ] |
| 397 | |
| 398 | DXGI_GRAPHICS_PREEMPTION_GRANULARITY = Enum("DXGI_GRAPHICS_PREEMPTION_GRANULARITY", [ |
| 399 | "DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY", |
| 400 | "DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY", |
| 401 | "DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY", |
| 402 | "DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY", |
| 403 | "DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY", |
| 404 | ]) |
| 405 | |
| 406 | DXGI_COMPUTE_PREEMPTION_GRANULARITY = Enum("DXGI_COMPUTE_PREEMPTION_GRANULARITY", [ |
| 407 | "DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY", |
| 408 | "DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY", |
| 409 | "DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY", |
| 410 | "DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY", |
| 411 | "DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY", |
| 412 | ]) |
| 413 | |
| 414 | DXGI_ADAPTER_DESC2 = Struct("DXGI_ADAPTER_DESC2", [ |
| 415 | (WString, "Description"), |
| 416 | (UINT, "VendorId"), |
| 417 | (UINT, "DeviceId"), |
| 418 | (UINT, "SubSysId"), |
| 419 | (UINT, "Revision"), |
| 420 | (SIZE_T, "DedicatedVideoMemory"), |
| 421 | (SIZE_T, "DedicatedSystemMemory"), |
| 422 | (SIZE_T, "SharedSystemMemory"), |
| 423 | (LUID, "AdapterLuid"), |
| 424 | (UINT, "Flags"), |
| 425 | (DXGI_GRAPHICS_PREEMPTION_GRANULARITY, "GraphicsPreemptionGranularity"), |
| 426 | (DXGI_COMPUTE_PREEMPTION_GRANULARITY, "ComputePreemptionGranularity"), |
| 427 | ]) |
| 428 | |
| 429 | IDXGIAdapter2.methods += [ |
| 430 | StdMethod(HRESULT, "GetDesc2", [Out(Pointer(DXGI_ADAPTER_DESC2), "pDesc")], sideeffects=False), |
| 431 | ] |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 432 | |
José Fonseca | 8130193 | 2012-11-11 00:10:20 +0000 | [diff] [blame] | 433 | dxgi = Module('dxgi') |
José Fonseca | cdefc48 | 2012-11-16 20:06:20 +0000 | [diff] [blame] | 434 | dxgi.addInterfaces([ |
Jeff Muizelaar | 4d57f31 | 2013-11-19 15:18:31 -0500 | [diff] [blame^] | 435 | IDXGIFactory2, |
José Fonseca | f450d8b | 2012-11-20 14:48:31 +0000 | [diff] [blame] | 436 | IDXGIFactoryDWM, |
Jeff Muizelaar | 4d57f31 | 2013-11-19 15:18:31 -0500 | [diff] [blame^] | 437 | IDXGIAdapter2, |
José Fonseca | cdefc48 | 2012-11-16 20:06:20 +0000 | [diff] [blame] | 438 | ]) |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 439 | dxgi.addFunctions([ |
José Fonseca | 82715be | 2012-11-04 23:54:27 +0000 | [diff] [blame] | 440 | StdFunction(HRESULT, "CreateDXGIFactory", [(REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppFactory")]), |
| 441 | StdFunction(HRESULT, "CreateDXGIFactory1", [(REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppFactory")]), |
José Fonseca | ca55d16 | 2012-04-16 13:05:47 +0100 | [diff] [blame] | 442 | ]) |