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