]> git.cworth.org Git - apitrace/blob - specs/dxgi.py
Define all D2D/DWRITE GUIDs
[apitrace] / specs / dxgi.py
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
26 from dxgitype import *
27
28 HMONITOR = Alias("HMONITOR", HANDLE)
29 _LUID = Struct("_LUID", [
30     (DWORD, "LowPart"),
31     (LONG, "HighPart"),
32 ])
33
34 DXGI_USAGE = Alias("DXGI_USAGE", UINT)
35 DXGI_SWAP_EFFECT = Enum("DXGI_SWAP_EFFECT", [
36     "DXGI_SWAP_EFFECT_DISCARD",
37     "DXGI_SWAP_EFFECT_SEQUENTIAL",
38 ])
39
40 DXGI_RESIDENCY = Enum("DXGI_RESIDENCY", [
41     "DXGI_RESIDENCY_FULLY_RESIDENT",
42     "DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY",
43     "DXGI_RESIDENCY_EVICTED_TO_DISK",
44 ])
45
46 DXGI_SURFACE_DESC = Struct("DXGI_SURFACE_DESC", [
47     (UINT, "Width"),
48     (UINT, "Height"),
49     (DXGI_FORMAT, "Format"),
50     (DXGI_SAMPLE_DESC, "SampleDesc"),
51 ])
52
53 DXGI_MAPPED_RECT = Struct("DXGI_MAPPED_RECT", [
54     (INT, "Pitch"),
55     (OpaquePointer(BYTE), "pBits"),
56 ])
57
58 DXGI_OUTPUT_DESC = Struct("DXGI_OUTPUT_DESC", [
59     (WString, "DeviceName"),
60     (RECT, "DesktopCoordinates"),
61     (BOOL, "AttachedToDesktop"),
62     (DXGI_MODE_ROTATION, "Rotation"),
63     (HMONITOR, "Monitor"),
64 ])
65
66 DXGI_FRAME_STATISTICS = Struct("DXGI_FRAME_STATISTICS", [
67     (UINT, "PresentCount"),
68     (UINT, "PresentRefreshCount"),
69     (UINT, "SyncRefreshCount"),
70     (LARGE_INTEGER, "SyncQPCTime"),
71     (LARGE_INTEGER, "SyncGPUTime"),
72 ])
73
74 DXGI_ADAPTER_DESC = Struct("DXGI_ADAPTER_DESC", [
75     (WString, "Description"),
76     (UINT, "VendorId"),
77     (UINT, "DeviceId"),
78     (UINT, "SubSysId"),
79     (UINT, "Revision"),
80     (SIZE_T, "DedicatedVideoMemory"),
81     (SIZE_T, "DedicatedSystemMemory"),
82     (SIZE_T, "SharedSystemMemory"),
83     (LUID, "AdapterLuid"),
84 ])
85
86 DXGI_SWAP_CHAIN_FLAG = Enum("DXGI_SWAP_CHAIN_FLAG", [
87     "DXGI_SWAP_CHAIN_FLAG_NONPREROTATED",
88     "DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH",
89     "DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE",
90 ])
91
92 DXGI_SWAP_CHAIN_DESC = Struct("DXGI_SWAP_CHAIN_DESC", [
93     (DXGI_MODE_DESC, "BufferDesc"),
94     (DXGI_SAMPLE_DESC, "SampleDesc"),
95     (DXGI_USAGE, "BufferUsage"),
96     (UINT, "BufferCount"),
97     (HWND, "OutputWindow"),
98     (BOOL, "Windowed"),
99     (DXGI_SWAP_EFFECT, "SwapEffect"),
100     (UINT, "Flags"),
101 ])
102
103 DXGI_SHARED_RESOURCE = Struct("DXGI_SHARED_RESOURCE", [
104     (HANDLE, "Handle"),
105 ])
106
107 IDXGIObject = Interface("IDXGIObject", IUnknown)
108 IDXGIObject.methods += [
109     Method(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "data_size"), (OpaquePointer(Const(Void)), "data")]),
110     Method(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "object")]),
111     Method(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "data_size"), Out(OpaquePointer(Void), "data")]),
112     Method(HRESULT, "GetParent", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "parent")]),
113 ]
114
115 IDXGIDeviceSubObject = Interface("IDXGIDeviceSubObject", IDXGIObject)
116 IDXGIDeviceSubObject.methods += [
117     Method(HRESULT, "GetDevice", [(REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "device")]),
118 ]
119
120 IDXGISurface = Interface("IDXGISurface", IDXGIDeviceSubObject)
121 IDXGISurface.methods += [
122     Method(HRESULT, "GetDesc", [Out(Pointer(DXGI_SURFACE_DESC), "desc")]),
123     Method(HRESULT, "Map", [Out(Pointer(DXGI_MAPPED_RECT), "mapped_rect"), (UINT, "flags")]),
124     Method(HRESULT, "Unmap", []),
125 ]
126
127 IDXGIOutput = Interface("IDXGIOutput", IDXGIObject)
128 IDXGIOutput.methods += [
129     Method(HRESULT, "GetDesc", [Out(Pointer(DXGI_OUTPUT_DESC), "desc")]),
130     Method(HRESULT, "GetDisplayModeList", [(DXGI_FORMAT, "format"), (UINT, "flags"), Out(Pointer(UINT), "mode_count"), Out(Array(DXGI_MODE_DESC, "*mode_count"), "desc")]),
131     Method(HRESULT, "FindClosestMatchingMode", [(Pointer(Const(DXGI_MODE_DESC)), "mode"), Out(Pointer(DXGI_MODE_DESC), "closest_match"), (Pointer(IUnknown), "device")]),
132     Method(HRESULT, "WaitForVBlank", []),
133     Method(HRESULT, "TakeOwnership", [(Pointer(IUnknown), "device"), (BOOL, "exclusive")]),
134     Method(Void, "ReleaseOwnership", []),
135     Method(HRESULT, "GetGammaControlCapabilities", [Out(Pointer(DXGI_GAMMA_CONTROL_CAPABILITIES), "gamma_caps")]),
136     Method(HRESULT, "SetGammaControl", [(Pointer(Const(DXGI_GAMMA_CONTROL)), "gamma_control")]),
137     Method(HRESULT, "GetGammaControl", [Out(Pointer(DXGI_GAMMA_CONTROL), "gamma_control")]),
138     Method(HRESULT, "SetDisplaySurface", [(Pointer(IDXGISurface), "surface")]),
139     Method(HRESULT, "GetDisplaySurfaceData", [(Pointer(IDXGISurface), "surface")]),
140     Method(HRESULT, "GetFrameStatistics", [Out(Pointer(DXGI_FRAME_STATISTICS), "stats")]),
141 ]
142
143 IDXGIAdapter = Interface("IDXGIAdapter", IDXGIObject)
144 IDXGIAdapter.methods += [
145     Method(HRESULT, "EnumOutputs", [(UINT, "output_idx"), Out(Pointer(Pointer(IDXGIOutput)), "output")]),
146     Method(HRESULT, "GetDesc", [Out(Pointer(DXGI_ADAPTER_DESC), "desc")]),
147     Method(HRESULT, "CheckInterfaceSupport", [(REFGUID, "guid"), Out(Pointer(LARGE_INTEGER), "umd_version")]),
148 ]
149
150 IDXGISwapChain = Interface("IDXGISwapChain", IDXGIDeviceSubObject)
151 IDXGISwapChain.methods += [
152     Method(HRESULT, "Present", [(UINT, "sync_interval"), (UINT, "flags")]),
153     Method(HRESULT, "GetBuffer", [(UINT, "buffer_idx"), (REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "surface")]),
154     Method(HRESULT, "SetFullscreenState", [(BOOL, "fullscreen"), (Pointer(IDXGIOutput), "target")]),
155     Method(HRESULT, "GetFullscreenState", [Out(Pointer(BOOL), "fullscreen"), Out(Pointer(Pointer(IDXGIOutput)), "target")]),
156     Method(HRESULT, "GetDesc", [Out(Pointer(DXGI_SWAP_CHAIN_DESC), "desc")]),
157     Method(HRESULT, "ResizeBuffers", [(UINT, "buffer_count"), (UINT, "width"), (UINT, "height"), (DXGI_FORMAT, "format"), (UINT, "flags")]),
158     Method(HRESULT, "ResizeTarget", [(Pointer(Const(DXGI_MODE_DESC)), "target_mode_desc")]),
159     Method(HRESULT, "GetContainingOutput", [Out(Pointer(Pointer(IDXGIOutput)), "output")]),
160     Method(HRESULT, "GetFrameStatistics", [Out(Pointer(DXGI_FRAME_STATISTICS), "stats")]),
161     Method(HRESULT, "GetLastPresentCount", [Out(Pointer(UINT), "last_present_count")]),
162 ]
163
164 IDXGIFactory = Interface("IDXGIFactory", IDXGIObject)
165 IDXGIFactory.methods += [
166     Method(HRESULT, "EnumAdapters", [(UINT, "adapter_idx"), Out(Pointer(Pointer(IDXGIAdapter)), "adapter")]),
167     Method(HRESULT, "MakeWindowAssociation", [(HWND, "window"), (UINT, "flags")]),
168     Method(HRESULT, "GetWindowAssociation", [Out(Pointer(HWND), "window")]),
169     Method(HRESULT, "CreateSwapChain", [(Pointer(IUnknown), "device"), (Pointer(DXGI_SWAP_CHAIN_DESC), "desc"), Out(Pointer(Pointer(IDXGISwapChain)), "swapchain")]),
170     Method(HRESULT, "CreateSoftwareAdapter", [(HMODULE, "swrast"), Out(Pointer(Pointer(IDXGIAdapter)), "adapter")]),
171 ]
172
173 #StdFunction(HRESULT, "CreateDXGIFactory", [(REFIID, "riid"), (Pointer(OpaquePointer(Void)), "factory")]),
174
175 IDXGIDevice = Interface("IDXGIDevice", IDXGIObject)
176 IDXGIDevice.methods += [
177     Method(HRESULT, "GetAdapter", [Out(Pointer(Pointer(IDXGIAdapter)), "adapter")]),
178     Method(HRESULT, "CreateSurface", [(Pointer(Const(DXGI_SURFACE_DESC)), "desc"), (UINT, "surface_count"), (DXGI_USAGE, "usage"), (Pointer(Const(DXGI_SHARED_RESOURCE)), "shared_resource"), Out(Pointer(Pointer(IDXGISurface)), "surface")]),
179     Method(HRESULT, "QueryResourceResidency", [(Array(Const(OpaquePointer(IUnknown)), "resource_count"), "resources"), Out(Array(DXGI_RESIDENCY, "resource_count"), "residency"), (UINT, "resource_count")]),
180     Method(HRESULT, "SetGPUThreadPriority", [(INT, "priority")]),
181     Method(HRESULT, "GetGPUThreadPriority", [Out(Pointer(INT), "priority")]),
182 ]
183