]> git.cworth.org Git - apitrace/blob - wglapi.py
More complete WGL enums.
[apitrace] / wglapi.py
1 ##########################################################################
2 #
3 # Copyright 2008-2010 VMware, Inc.
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
27 """WGL API description"""
28
29
30 from glapi import *
31 from winapi import *
32 from wglenum import *
33
34
35 wglapi = API("WGL")
36 wglapi.add_functions(glapi.functions)
37
38
39 HGLRC = Alias("HGLRC", HANDLE)
40 PROC = Opaque("PROC")
41
42 PFD = Flags(DWORD, [
43     "PFD_DOUBLEBUFFER",
44     "PFD_STEREO",
45     "PFD_DRAW_TO_WINDOW",
46     "PFD_DRAW_TO_BITMAP",
47     "PFD_SUPPORT_GDI",
48     "PFD_SUPPORT_OPENGL",
49     "PFD_GENERIC_FORMAT",
50     "PFD_NEED_PALETTE",
51     "PFD_NEED_SYSTEM_PALETTE",
52     "PFD_SWAP_EXCHANGE",
53     "PFD_SWAP_COPY",
54     "PFD_SWAP_LAYER_BUFFERS",
55     "PFD_GENERIC_ACCELERATED",
56     "PFD_SUPPORT_DIRECTDRAW",
57     "PFD_SUPPORT_COMPOSITION",
58     "PFD_DEPTH_DONTCARE",
59     "PFD_DOUBLEBUFFER_DONTCARE",
60     "PFD_STEREO_DONTCARE",
61 ])
62
63 PIXELFORMATDESCRIPTOR = Struct("PIXELFORMATDESCRIPTOR", [
64     (WORD, "nSize"),
65     (WORD, "nVersion"),
66     (PFD, "dwFlags"),
67     (BYTE, "iPixelType"),
68     (BYTE, "cColorBits"),
69     (BYTE, "cRedBits"),
70     (BYTE, "cRedShift"),
71     (BYTE, "cGreenBits"),
72     (BYTE, "cGreenShift"),
73     (BYTE, "cBlueBits"),
74     (BYTE, "cBlueShift"),
75     (BYTE, "cAlphaBits"),
76     (BYTE, "cAlphaShift"),
77     (BYTE, "cAccumBits"),
78     (BYTE, "cAccumRedBits"),
79     (BYTE, "cAccumGreenBits"),
80     (BYTE, "cAccumBlueBits"),
81     (BYTE, "cAccumAlphaBits"),
82     (BYTE, "cDepthBits"),
83     (BYTE, "cStencilBits"),
84     (BYTE, "cAuxBuffers"),
85     (BYTE, "iLayerType"),
86     (BYTE, "bReserved"),
87     (DWORD, "dwLayerMask"),
88     (DWORD, "dwVisibleMask"),
89     (DWORD, "dwDamageMask"),
90 ])
91
92 POINTFLOAT = Struct("POINTFLOAT", [
93     (FLOAT, "x"),
94     (FLOAT, "y"),
95 ])
96
97 GLYPHMETRICSFLOAT = Struct("GLYPHMETRICSFLOAT", [
98     (FLOAT, "gmfBlackBoxX"),
99     (FLOAT, "gmfBlackBoxY"),
100     (POINTFLOAT, "gmfptGlyphOrigin"),
101     (FLOAT, "gmfCellIncX"),
102     (FLOAT, "gmfCellIncY"),
103 ])
104 LPGLYPHMETRICSFLOAT = Pointer(GLYPHMETRICSFLOAT)
105
106 COLORREF = Alias("COLORREF", DWORD)
107
108
109 LAYERPLANEDESCRIPTOR = Struct("LAYERPLANEDESCRIPTOR", [
110     (WORD, "nSize"),
111     (WORD, "nVersion"),
112     (DWORD, "dwFlags"),
113     (BYTE, "iPixelType"),
114     (BYTE, "cColorBits"),
115     (BYTE, "cRedBits"),
116     (BYTE, "cRedShift"),
117     (BYTE, "cGreenBits"),
118     (BYTE, "cGreenShift"),
119     (BYTE, "cBlueBits"),
120     (BYTE, "cBlueShift"),
121     (BYTE, "cAlphaBits"),
122     (BYTE, "cAlphaShift"),
123     (BYTE, "cAccumBits"),
124     (BYTE, "cAccumRedBits"),
125     (BYTE, "cAccumGreenBits"),
126     (BYTE, "cAccumBlueBits"),
127     (BYTE, "cAccumAlphaBits"),
128     (BYTE, "cDepthBits"),
129     (BYTE, "cStencilBits"),
130     (BYTE, "cAuxBuffers"),
131     (BYTE, "iLayerPlane"),
132     (BYTE, "bReserved"),
133     (COLORREF, "crTransparent"),
134 ])
135 LPLAYERPLANEDESCRIPTOR = Pointer(LAYERPLANEDESCRIPTOR)
136
137 WGLSWAP = Struct("WGLSWAP", [
138     (HDC, "hdc"),
139     (UINT, "uiFlags"),
140 ])
141
142 HPBUFFERARB = Alias("HPBUFFERARB", HANDLE)
143
144
145 wglapi.add_functions([
146     # WGL
147     StdFunction(HGLRC, "wglCreateContext", [(HDC, "hdc")]),
148     StdFunction(BOOL, "wglDeleteContext", [(HGLRC, "hglrc")]),
149     StdFunction(HGLRC, "wglGetCurrentContext", [], sideeffects=False),
150     StdFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]),
151     StdFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]),
152     StdFunction(Int, "wglChoosePixelFormat", [(HDC, "hdc"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]), 
153     StdFunction(Int, "wglDescribePixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (UINT, "nBytes"), Out(Pointer(PIXELFORMATDESCRIPTOR), "ppfd")]),
154     StdFunction(HDC, "wglGetCurrentDC", [], sideeffects=False),
155     StdFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")], sideeffects=False),
156     StdFunction(Int, "wglGetPixelFormat", [(HDC, "hdc")], sideeffects=False),
157     StdFunction(BOOL, "wglSetPixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
158     StdFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]),
159     StdFunction(BOOL, "wglShareLists", [(HGLRC, "hglrc1"), (HGLRC, "hglrc2")]),
160     StdFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]),
161     StdFunction(BOOL, "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]),
162     StdFunction(Int, "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]),
163     StdFunction(Int, "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")], sideeffects=False),
164     StdFunction(BOOL, "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]),
165     StdFunction(BOOL, "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]),
166     StdFunction(BOOL, "wglUseFontBitmapsA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
167     StdFunction(BOOL, "wglUseFontBitmapsW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
168     StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
169     StdFunction(BOOL, "wglUseFontOutlinesA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
170     StdFunction(BOOL, "wglUseFontOutlinesW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
171
172     # WGL_ARB_buffer_region
173     StdFunction(HANDLE, "wglCreateBufferRegionARB", [(HDC, "hDC"), (Int, "iLayerPlane"), (UINT, "uType")]),
174     StdFunction(VOID, "wglDeleteBufferRegionARB", [(HANDLE, "hRegion")]),
175     StdFunction(BOOL, "wglSaveBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height")]),
176     StdFunction(BOOL, "wglRestoreBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height"), (Int, "xSrc"), (Int, "ySrc")]),
177
178     # WGL_ARB_extensions_string
179     StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
180
181     # WGL_ARB_pixel_format
182     StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
183     StdFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
184     StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Const(Array(WGLenum, "__AttribList_size(piAttribIList)")), "piAttribIList"), (Const(Array(FLOAT, "__AttribList_size(pfAttribFList)")), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "(*nNumFormats)"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
185
186     # WGL_ARB_make_current_read
187     StdFunction(BOOL, "wglMakeContextCurrentARB", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
188     StdFunction(HDC, "wglGetCurrentReadDCARB", [], sideeffects=False),
189
190     # WGL_ARB_pbuffer
191     StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Const(Array(WGLenum, "__AttribList_size(piAttribList)")), "piAttribList")]),
192     StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")], sideeffects=False),
193     StdFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]),
194     StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]),
195     StdFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (WGLenum, "iAttribute"), Out(Pointer(Int), "piValue")]),
196
197     # WGL_ARB_render_texture
198     StdFunction(BOOL, "wglBindTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
199     StdFunction(BOOL, "wglReleaseTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
200     StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Const(Array(WGLenum, "__AttribList_size(piAttribList)")), "piAttribList")]),
201
202     # WGL_ARB_create_context
203     StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Const(Array(WGLenum, "__AttribList_size(attribList)")), "attribList")]),
204
205     # WGL_EXT_extensions_string
206     StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False),
207
208     # WGL_EXT_make_current_read
209     StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
210     StdFunction(HDC, "wglGetCurrentReadDCEXT", [], sideeffects=False),
211
212     # WGL_EXT_pixel_format
213     StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
214     StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
215     StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(WGLenum)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
216
217     # WGL_EXT_swap_control
218     StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),
219     StdFunction(Int, "wglGetSwapIntervalEXT", [], sideeffects=False),
220
221     # WGL_NV_vertex_array_range
222     StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
223     StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
224
225     # GL_WIN_swap_hint
226     StdFunction(Void, "glAddSwapHintRectWIN", [(GLint, "x"), (GLint, "y"), (GLsizei, "width"), (GLsizei, "height")]),
227
228     # must be last
229     StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),
230 ])