blob: 8df04143f36ca040a16117b6a15e0a51831b43bd [file] [log] [blame]
Karl Schultzd48382c2004-01-14 17:45:24 +00001#!/usr/bin/env python
2
Karl Schultzd48382c2004-01-14 17:45:24 +00003
4# Mesa 3-D graphics library
5# Version: 4.1
6#
7# Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8#
9# Permission is hereby granted, free of charge, to any person obtaining a
10# copy of this software and associated documentation files (the "Software"),
11# to deal in the Software without restriction, including without limitation
12# the rights to use, copy, modify, merge, publish, distribute, sublicense,
13# and/or sell copies of the Software, and to permit persons to whom the
14# Software is furnished to do so, subject to the following conditions:
15#
16# The above copyright notice and this permission notice shall be included
17# in all copies or substantial portions of the Software.
18#
19# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26
27# Generate the mesa.def file for Windows.
28#
29# Usage:
30# mesadef.py >mesa.def
31# Then copy to src/mesa/drivers/windows/gdi
32#
33# Dependencies:
34# The apispec file must be in the current directory.
35
36
37
38import apiparser
39import string
40
41
42def PrintHead():
43 print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
44 print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
45 print 'VERSION 6.0'
46 print ';'
47 print '; Module definition file for Mesa (OPENGL32.DLL)'
48 print ';'
49 print '; Note: The OpenGL functions use the STDCALL'
50 print '; function calling convention. Microsoft\'s'
51 print '; OPENGL32 uses this convention and so must the'
52 print '; Mesa OPENGL32 so that the Mesa DLL can be used'
53 print '; as a drop-in replacement.'
54 print ';'
55 print '; The linker exports STDCALL entry points with'
56 print '; \'decorated\' names; e.g., _glBegin@0, where the'
57 print '; trailing number is the number of bytes of '
58 print '; parameter data pushed onto the stack. The'
59 print '; callee is responsible for popping this data'
60 print '; off the stack, usually via a RETF n instruction.'
61 print ';'
62 print '; However, the Microsoft OPENGL32.DLL does not export'
63 print '; the decorated names, even though the calling convention'
64 print '; is STDCALL. So, this module definition file is'
65 print '; needed to force the Mesa OPENGL32.DLL to export the'
66 print '; symbols in the same manner as the Microsoft DLL.'
67 print '; Were it not for this problem, this file would not'
68 print '; be needed (for the gl* functions) since the entry'
69 print '; points are compiled with dllexport declspec.'
70 print ';'
71 print '; However, this file is still needed to export "internal"'
72 print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
73 print ';'
74 print 'EXPORTS'
75 return
76#enddef
77
78
79def PrintTail():
80 print ';'
81 print '; WGL API'
82 print '\twglChoosePixelFormat'
83 print '\twglCopyContext'
84 print '\twglCreateContext'
85 print '\twglCreateLayerContext'
86 print '\twglDeleteContext'
87 print '\twglDescribeLayerPlane'
88 print '\twglDescribePixelFormat'
89 print '\twglGetCurrentContext'
90 print '\twglGetCurrentDC'
Brian Paul166b0ff2006-01-25 15:05:36 +000091 print '\twglGetExtensionsStringARB'
Karl Schultzd48382c2004-01-14 17:45:24 +000092 print '\twglGetLayerPaletteEntries'
93 print '\twglGetPixelFormat'
94 print '\twglGetProcAddress'
95 print '\twglMakeCurrent'
96 print '\twglRealizeLayerPalette'
97 print '\twglSetLayerPaletteEntries'
98 print '\twglSetPixelFormat'
99 print '\twglShareLists'
100 print '\twglSwapBuffers'
101 print '\twglSwapLayerBuffers'
102 print '\twglUseFontBitmapsA'
103 print '\twglUseFontBitmapsW'
104 print '\twglUseFontOutlinesA'
105 print '\twglUseFontOutlinesW'
106 print ';'
107 print '; Mesa internals - mostly for OSMESA'
108 print '\t_ac_CreateContext'
109 print '\t_ac_DestroyContext'
110 print '\t_ac_InvalidateState'
111 print '\t_glapi_get_context'
112 print '\t_glapi_get_proc_address'
Karl Schultzd48382c2004-01-14 17:45:24 +0000113 print '\t_mesa_buffer_data'
114 print '\t_mesa_buffer_map'
115 print '\t_mesa_buffer_subdata'
116 print '\t_mesa_bzero'
117 print '\t_mesa_calloc'
118 print '\t_mesa_choose_tex_format'
119 print '\t_mesa_compressed_texture_size'
120 print '\t_mesa_create_framebuffer'
121 print '\t_mesa_create_visual'
122 print '\t_mesa_delete_buffer_object'
123 print '\t_mesa_delete_texture_object'
124 print '\t_mesa_destroy_framebuffer'
125 print '\t_mesa_destroy_visual'
126 print '\t_mesa_enable_1_3_extensions'
127 print '\t_mesa_enable_1_4_extensions'
128 print '\t_mesa_enable_1_5_extensions'
129 print '\t_mesa_enable_sw_extensions'
130 print '\t_mesa_error'
131 print '\t_mesa_free'
132 print '\t_mesa_free_context_data'
133 print '\t_mesa_get_current_context'
134 print '\t_mesa_init_default_imports'
135 print '\t_mesa_initialize_context'
136 print '\t_mesa_make_current'
137 print '\t_mesa_memcpy'
138 print '\t_mesa_memset'
139 print '\t_mesa_new_buffer_object'
140 print '\t_mesa_new_texture_object'
141 print '\t_mesa_problem'
142 print '\t_mesa_ResizeBuffersMESA'
143 print '\t_mesa_store_compressed_teximage1d'
144 print '\t_mesa_store_compressed_teximage2d'
145 print '\t_mesa_store_compressed_teximage3d'
146 print '\t_mesa_store_compressed_texsubimage1d'
147 print '\t_mesa_store_compressed_texsubimage2d'
148 print '\t_mesa_store_compressed_texsubimage3d'
149 print '\t_mesa_store_teximage1d'
150 print '\t_mesa_store_teximage2d'
151 print '\t_mesa_store_teximage3d'
152 print '\t_mesa_store_texsubimage1d'
153 print '\t_mesa_store_texsubimage2d'
154 print '\t_mesa_store_texsubimage3d'
Karl Schultzd48382c2004-01-14 17:45:24 +0000155 print '\t_mesa_test_proxy_teximage'
156 print '\t_mesa_Viewport'
Brian Paul32e4b6c2009-09-19 16:36:15 -0600157 print '\t_mesa_meta_CopyColorSubTable'
158 print '\t_mesa_meta_CopyColorTable'
159 print '\t_mesa_meta_CopyConvolutionFilter1D'
160 print '\t_mesa_meta_CopyConvolutionFilter2D'
Brian Paula9c64da2009-09-19 11:05:54 -0600161 print '\t_mesa_meta_CopyTexImage1D'
162 print '\t_mesa_meta_CopyTexImage2D'
163 print '\t_mesa_meta_CopyTexSubImage1D'
164 print '\t_mesa_meta_CopyTexSubImage2D'
165 print '\t_mesa_meta_CopyTexSubImage3D'
Karl Schultzd48382c2004-01-14 17:45:24 +0000166 print '\t_swrast_Accum'
167 print '\t_swrast_alloc_buffers'
168 print '\t_swrast_Bitmap'
169 print '\t_swrast_CopyPixels'
Karl Schultzd48382c2004-01-14 17:45:24 +0000170 print '\t_swrast_DrawPixels'
171 print '\t_swrast_GetDeviceDriverReference'
172 print '\t_swrast_Clear'
173 print '\t_swrast_choose_line'
174 print '\t_swrast_choose_triangle'
Karl Schultzd48382c2004-01-14 17:45:24 +0000175 print '\t_swrast_CreateContext'
176 print '\t_swrast_DestroyContext'
177 print '\t_swrast_InvalidateState'
178 print '\t_swrast_ReadPixels'
179 print '\t_swrast_zbuffer_address'
180 print '\t_swsetup_Wakeup'
181 print '\t_swsetup_CreateContext'
182 print '\t_swsetup_DestroyContext'
183 print '\t_swsetup_InvalidateState'
184 print '\t_tnl_CreateContext'
185 print '\t_tnl_DestroyContext'
186 print '\t_tnl_InvalidateState'
187 print '\t_tnl_MakeCurrent'
188 print '\t_tnl_run_pipeline'
189#enddef
190
191
192records = []
193
194def FindOffset(funcName):
195 for (name, alias, offset) in records:
196 if name == funcName:
197 return offset
198 #endif
199 #endfor
200 return -1
201#enddef
202
203
204def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
205 if alias == '':
206 dispatchName = name
207 else:
208 dispatchName = alias
209 if offset < 0:
210 offset = FindOffset(dispatchName)
211 if offset >= 0 and string.find(name, "unused") == -1:
212 print '\tgl%s' % (name)
213 # save this info in case we need to look up an alias later
214 records.append((name, dispatchName, offset))
215
216#enddef
217
218
219PrintHead()
220apiparser.ProcessSpecFile("APIspec", EmitEntry)
221PrintTail()