f1329d5760fbf1013980039cd665763df9929973
3 # (C) Copyright IBM Corporation 2004, 2005
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # on the rights to use, copy, modify, merge, publish, distribute, sub
10 # license, and/or sell copies of the Software, and to permit persons to whom
11 # the Software is furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice (including the next
14 # paragraph) shall be included in all copies or substantial portions of the
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 # IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 # Ian Romanick <idr@us.ibm.com>
28 from xml
.sax
import saxutils
29 from xml
.sax
import make_parser
30 from xml
.sax
.handler
import feature_namespaces
35 import sys
, getopt
, copy
37 def hash_pixel_function(func
):
38 """Generate a 'unique' key for a pixel function. The key is based on
39 the parameters written in the command packet. This includes any
40 padding that might be added for the original function and the 'NULL
43 [dim
, junk
, junk
, junk
, junk
] = func
.dimensions()
46 h
= "%uD%uD_" % (d
- 1, d
)
48 for p
in func
.parameterIterator(1, 1):
49 h
= "%s%u" % (h
, p
.size())
54 if func
.image
.img_null_flag
:
57 n
= func
.name
.replace("%uD" % (dim
), "")
58 n
= "__glx_%s_%uD%uD" % (n
, d
- 1, d
)
62 class glXPixelFunctionUtility(glX_XML
.glXFunction
):
63 """Dummy class used to generate pixel "utility" functions that are
64 shared by multiple dimension image functions. For example, these
65 objects are used to generate shared functions used to send GLX
66 protocol for TexImage1D and TexImage2D, TexSubImage1D and
67 TexSubImage2D, etc."""
69 def __init__(self
, func
, name
):
70 # The parameters to the utility function are the same as the
71 # parameters to the real function except for the added "pad"
75 self
.image
= copy
.copy(func
.image
)
76 self
.fn_parameters
= []
77 for p
in gl_XML
.glFunction
.parameterIterator(func
):
78 self
.fn_parameters
.append(p
)
80 pad_name
= func
.pad_after(p
)
84 self
.fn_parameters
.append(pad
)
87 if self
.image
.height
== None:
88 self
.image
.height
= "height"
90 if self
.image
.img_yoff
== None:
91 self
.image
.img_yoff
= "yoffset"
94 if self
.image
.extent
== None:
95 self
.image
.extent
= "extent"
97 if self
.image
.img_woff
== None:
98 self
.image
.img_woff
= "woffset"
101 self
.set_return_type( func
.fn_return_type
)
103 self
.can_be_large
= func
.can_be_large
104 self
.count_parameters
= func
.count_parameters
105 self
.counter
= func
.counter
109 class PrintGlxProtoStubs(glX_XML
.GlxProto
):
111 glX_XML
.GlxProto
.__init
__(self
)
112 self
.last_category
= ""
113 self
.license
= license
.bsd_license_template
% ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
114 self
.generic_sizes
= [3, 4, 6, 8, 12, 16, 24, 32]
115 self
.pixel_stubs
= {}
118 def printRealHeader(self
):
120 print '#include <GL/gl.h>'
121 print '#include "indirect.h"'
122 print '#include "glxclient.h"'
123 print '#include "indirect_size.h"'
124 print '#include <GL/glxproto.h>'
126 print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
128 glX_XML
.printFastcall()
129 glX_XML
.printNoinline()
131 print '#if !defined __GNUC__ || __GNUC__ < 3'
132 print '# define __builtin_expect(x, y) x'
135 print '/* If the size and opcode values are known at compile-time, this will, on'
136 print ' * x86 at least, emit them with a single instruction.'
138 print '#define emit_header(dest, op, size) \\'
139 print ' do { union { short s[2]; int i; } temp; \\'
140 print ' temp.s[0] = (size); temp.s[1] = (op); \\'
141 print ' *((int *)(dest)) = temp.i; } while(0)'
143 print """static NOINLINE CARD32
144 read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array )
146 xGLXSingleReply reply;
148 (void) _XReply(dpy, (xReply *) & reply, 0, False);
150 if ((reply.length > 0) || reply_is_always_array) {
151 const GLint bytes = (reply_is_always_array)
152 ? (4 * reply.length) : (reply.size * size);
153 const GLint extra = 4 - (bytes & 3);
155 _XRead(dpy, dest, bytes);
157 _XEatData(dpy, extra);
161 (void) memcpy( dest, &(reply.pad3), size);
168 #define X_GLXSingle 0
170 static NOINLINE FASTCALL GLubyte *
171 setup_single_request( __GLXcontext * gc, GLint sop, GLint cmdlen )
174 Display * const dpy = gc->currentDpy;
176 (void) __glXFlushRenderBuffer(gc, gc->pc);
178 GetReqExtra(GLXSingle, cmdlen, req);
179 req->reqType = gc->majorOpcode;
180 req->contextTag = gc->currentContextTag;
182 return (GLubyte *)(req) + sz_xGLXSingleReq;
185 static NOINLINE FASTCALL GLubyte *
186 setup_vendor_request( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
188 xGLXVendorPrivateReq * req;
189 Display * const dpy = gc->currentDpy;
191 (void) __glXFlushRenderBuffer(gc, gc->pc);
193 GetReqExtra(GLXVendorPrivate, cmdlen, req);
194 req->reqType = gc->majorOpcode;
196 req->vendorCode = vop;
197 req->contextTag = gc->currentContextTag;
198 return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
201 const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
203 #define zero (__glXDefaultPixelStore+0)
204 #define one (__glXDefaultPixelStore+8)
205 #define default_pixel_store_1D (__glXDefaultPixelStore+4)
206 #define default_pixel_store_1D_size 20
207 #define default_pixel_store_2D (__glXDefaultPixelStore+4)
208 #define default_pixel_store_2D_size 20
209 #define default_pixel_store_3D (__glXDefaultPixelStore+0)
210 #define default_pixel_store_3D_size 36
211 #define default_pixel_store_4D (__glXDefaultPixelStore+0)
212 #define default_pixel_store_4D_size 36
215 for size
in self
.generic_sizes
:
216 self
.print_generic_function(size
)
219 def printFunction(self
, f
):
220 if f
.fn_offset
< 0 or f
.handcode
or f
.ignore
: return
222 if f
.glx_rop
!= 0 or f
.vectorequiv
!= None:
224 self
.printPixelFunction(f
)
226 self
.printRenderFunction(f
)
227 elif f
.glx_sop
!= 0 or f
.glx_vendorpriv
!= 0:
228 self
.printSingleFunction(f
)
230 print "/* Missing GLX protocol for %s. */" % (f
.name
)
232 def print_generic_function(self
, n
):
234 print """static FASTCALL NOINLINE void
235 generic_%u_byte( GLint rop, const void * ptr )
237 __GLXcontext * const gc = __glXGetCurrentContext();
238 const GLuint cmdlen = %u;
240 emit_header(gc->pc, rop, cmdlen);
241 (void) memcpy((void *)(gc->pc + 4), ptr, %u);
243 if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
245 """ % (n
, size
+ 4, size
)
248 def common_emit_one_arg(self
, p
, offset
, pc
, indent
, adjust
):
253 src_ptr
= "&" + p
.name
255 print '%s (void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
256 % (indent
, pc
, offset
+ adjust
, src_ptr
, p
.size_string() )
258 def common_emit_args(self
, f
, pc
, indent
, adjust
, skip_vla
):
266 for p
in f
.parameterIterator(1, r
):
267 self
.common_emit_one_arg(p
, offset
, pc
, indent
, adjust
)
273 def pixel_emit_args(self
, f
, pc
, indent
, adjust
, dim
, large
):
274 """Emit the arguments for a pixel function. This differs from
275 common_emit_args in that pixel functions may require padding
276 be inserted (i.e., for the missing width field for
277 TexImage1D), and they may also require a 'NULL image' flag
278 be inserted before the image data."""
281 for p
in f
.parameterIterator(1, 1):
282 self
.common_emit_one_arg(p
, offset
, pc
, indent
, adjust
)
286 print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent
, pc
, offset
+ adjust
)
289 if f
.image
.img_null_flag
:
291 print '%s (void) memcpy((void *)(%s + %u), zero, 4);' % (indent
, pc
, offset
+ adjust
)
293 print '%s (void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (indent
, pc
, offset
+ adjust
, f
.image
.name
)
300 def large_emit_begin(self
, indent
, f
, op_name
= None):
302 op_name
= f
.opcode_real_name()
304 print '%s const GLint op = %s;' % (indent
, op_name
)
305 print '%s const GLuint cmdlenLarge = cmdlen + 4;' % (indent
)
306 print '%s GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);' % (indent
)
307 print '%s (void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);' % (indent
)
308 print '%s (void) memcpy((void *)(pc + 4), (void *)(&op), 4);' % (indent
)
312 def common_func_print_just_header(self
, f
):
313 print '#define %s %d' % (f
.opcode_name(), f
.opcode_value())
315 print '%s' % (f
.fn_return_type
)
316 print '__indirect_gl%s(%s)' % (f
.name
, f
.get_parameter_string())
320 def common_func_print_just_start(self
, f
):
321 print ' __GLXcontext * const gc = __glXGetCurrentContext();'
323 # The only reason that single and vendor private commands need
324 # a variable called 'dpy' is becuase they use the SyncHandle
325 # macro. For whatever brain-dead reason, that macro is hard-
326 # coded to use a variable called 'dpy' instead of taking a
330 print ' Display * const dpy = gc->currentDpy;'
331 skip_condition
= "dpy != NULL"
333 skip_condition
= "gc->currentDpy != NULL"
335 skip_condition
= None
338 if f
.fn_return_type
!= 'void':
339 print ' %s retval = (%s) 0;' % (f
.fn_return_type
, f
.fn_return_type
)
341 if f
.count_parameters
!= None:
342 print ' const GLuint compsize = __gl%s_size(%s);' % (f
.name
, f
.count_parameters
)
344 [dim
, w
, h
, d
, junk
] = f
.dimensions()
346 compsize
= '__glImageSize(%s, %s, %s, %s, %s, %s)' % (w
, h
, d
, f
.image
.img_format
, f
.image
.img_type
, f
.image
.img_target
)
347 if not f
.image
.img_send_null
:
348 compsize
= '(%s != NULL) ? %s : 0' % (f
.image
.name
, compsize
)
350 print ' const GLuint compsize = %s;' % (compsize
)
353 print ' const GLuint cmdlen = %s;' % (f
.command_length())
357 skip_condition
= "(%s >= 0) && (%s)" % (f
.counter
, skip_condition
)
359 skip_condition
= "%s >= 0" % (f
.counter
)
363 print ' if (__builtin_expect(%s, 1)) {' % (skip_condition
)
369 def common_func_print_header(self
, f
):
370 self
.common_func_print_just_header(f
)
371 return self
.common_func_print_just_start(f
)
375 def printSingleFunction(self
, f
):
376 self
.common_func_print_header(f
)
378 if f
.fn_parameters
!= []:
379 pc_decl
= "GLubyte const * pc ="
383 if f
.glx_vendorpriv
!= 0:
384 print ' %s setup_vendor_request(gc, %s, %s, cmdlen);' % (pc_decl
, f
.opcode_real_name(), f
.opcode_name())
386 print ' %s setup_single_request(gc, %s, cmdlen);' % (pc_decl
, f
.opcode_name())
388 self
.common_emit_args(f
, "pc", " ", 0, 0)
392 output_size
= f
.output
.p_type
.size
393 output_str
= f
.output
.name
398 if f
.fn_return_type
!= 'void':
399 return_str
= " retval = (%s)" % (f
.fn_return_type
)
401 return_str
= " (void)"
403 if f
.reply_always_array
:
408 print " %s read_reply(dpy, %s, %s, %s);" % (return_str
, output_size
, output_str
, aa
)
410 print ' UnlockDisplay(dpy); SyncHandle();'
412 print ' %s' % f
.return_string()
418 def printPixelFunction(self
, f
):
419 """This function could use some major refactoring. :("""
421 # There is a code-space optimization that we can do here.
422 # Functions that are marked img_pad_dimensions have a version
423 # with an odd number of dimensions and an even number of
424 # dimensions. TexSubImage1D and TexSubImage2D are examples.
425 # We can emit a single function that does both, and have the
426 # real functions call the utility function with the correct
429 # The only quirk to this is that utility funcitons will be
430 # generated for 3D and 4D functions, but 4D (e.g.,
431 # GL_SGIS_texture4D) isn't typically supported. This is
432 # probably not an issue. However, it would be possible to
433 # look at the total set of functions and determine if there
434 # is another function that would actually use the utility
435 # function. If not, then fallback to the normal way of
438 if f
.image
.img_pad_dimensions
:
439 # Determine the hash key and the name for the utility
440 # function that is used to implement the real
443 [h
, n
] = hash_pixel_function(f
)
446 # If the utility function is not yet known, generate
449 if not self
.pixel_stubs
.has_key(h
):
450 self
.pixel_stubs
[h
] = n
451 pixel_func
= glXPixelFunctionUtility(f
, n
)
454 print '%s( unsigned opcode, unsigned dim, %s )' % (n
, pixel_func
.get_parameter_string())
457 if self
.common_func_print_just_start(pixel_func
):
465 if pixel_func
.can_be_large
:
466 print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent
)
467 print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent
)
468 print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent
)
469 print '%s }' % (indent
)
472 [dim
, width
, height
, depth
, extent
] = pixel_func
.dimensions()
473 adjust
= pixel_func
.offset_of_first_parameter() + 4
475 print '%s emit_header(gc->pc, opcode, cmdlen);' % (indent
)
477 offset
= self
.pixel_emit_args(pixel_func
, "gc->pc", indent
, adjust
, dim
, 0)
479 s
= pixel_func
.command_fixed_length()
481 pixHeaderPtr
= "gc->pc + 4"
482 pcPtr
= "gc->pc + %u" % (s
+ 4)
484 if pixel_func
.image
.img_send_null
:
485 condition
= '(compsize > 0) && (%s != NULL)' % (pixel_func
.image
.name
)
487 condition
= 'compsize > 0'
489 print '%s if (%s) {' % (indent
, condition
)
490 print '%s (*gc->fillImage)(gc, dim, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent
, width
, height
, depth
, pixel_func
.image
.img_format
, pixel_func
.image
.img_type
, pixel_func
.image
.name
, pcPtr
, pixHeaderPtr
)
491 print '%s }' % (indent
)
492 print '%s else {' % (indent
)
493 print '%s (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (indent
, pixHeaderPtr
, dim
, dim
)
494 print '%s }' % (indent
)
496 print '%s gc->pc += cmdlen;' % (indent
)
497 print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent
)
502 print '%s}' % (indent
)
503 print '%selse {' % (indent
)
505 self
.large_emit_begin(indent
, pixel_func
, "opcode")
506 offset
= self
.pixel_emit_args(pixel_func
, "pc", indent
, adjust
, dim
, 1)
508 pixHeaderPtr
= "pc + 8"
509 pcPtr
= "pc + %u" % (s
+ 8)
511 print '%s __glXSendLargeImage(gc, compsize, dim, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent
, width
, height
, depth
, f
.image
.img_format
, f
.image
.img_type
, f
.image
.name
, pcPtr
, pixHeaderPtr
)
513 print '%s}' % (indent
)
515 if trailer
: print trailer
521 # Generate the real function as a call to the
524 self
.common_func_print_just_header(f
)
526 [dim
, junk
, junk
, junk
, junk
] = f
.dimensions()
529 for p
in gl_XML
.glFunction
.parameterIterator(f
):
530 p_string
+= ", " + p
.name
535 print ' %s(%s, %u%s );' % (n
, f
.opcode_name(), dim
, p_string
)
541 if self
.common_func_print_header(f
):
550 print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent
)
551 print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent
)
552 print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent
)
553 print '%s }' % (indent
)
556 [dim
, width
, height
, depth
, extent
] = f
.dimensions()
557 adjust
= f
.offset_of_first_parameter() + 4
559 print '%s emit_header(gc->pc, %s, cmdlen);' % (indent
, f
.opcode_real_name())
561 offset
= self
.pixel_emit_args(f
, "gc->pc", indent
, adjust
, dim
, 0)
563 s
= f
.command_fixed_length()
565 pixHeaderPtr
= "gc->pc + 4"
566 pcPtr
= "gc->pc + %u" % (s
+ 4)
568 if f
.image
.img_send_null
:
569 condition
= '(compsize > 0) && (%s != NULL)' % (f
.image
.name
)
571 condition
= 'compsize > 0'
573 print '%s if (%s) {' % (indent
, condition
)
574 print '%s (*gc->fillImage)(gc, %u, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent
, dim
, width
, height
, depth
, f
.image
.img_format
, f
.image
.img_type
, f
.image
.name
, pcPtr
, pixHeaderPtr
)
575 print '%s }' % (indent
)
576 print '%s else {' % (indent
)
577 print '%s (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (indent
, pixHeaderPtr
, dim
, dim
)
578 print '%s }' % (indent
)
580 print '%s gc->pc += cmdlen;' % (indent
)
581 print '%s if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent
)
586 print '%s}' % (indent
)
587 print '%selse {' % (indent
)
589 self
.large_emit_begin(indent
, f
)
590 offset
= self
.pixel_emit_args(f
, "pc", indent
, adjust
, dim
, 1)
592 pixHeaderPtr
= "pc + 8"
593 pcPtr
= "pc + %u" % (s
+ 8)
595 print '%s __glXSendLargeImage(gc, compsize, %u, %s, %s, %s, %s, %s, %s, %s, %s);' % (indent
, dim
, width
, height
, depth
, f
.image
.img_format
, f
.image
.img_type
, f
.image
.name
, pcPtr
, pixHeaderPtr
)
597 print '%s}' % (indent
)
599 if trailer
: print trailer
605 def printRenderFunction(self
, f
):
606 # There is a class of GL functions that take a single pointer
607 # as a parameter. This pointer points to a fixed-size chunk
608 # of data, and the protocol for this functions is very
609 # regular. Since they are so regular and there are so many
610 # of them, special case them with generic functions. On
611 # x86, this saves about 26KB in the libGL.so binary.
613 if f
.variable_length_parameter() == None and len(f
.fn_parameters
) == 1:
614 p
= f
.fn_parameters
[0]
616 cmdlen
= f
.command_fixed_length()
617 if cmdlen
in self
.generic_sizes
:
618 self
.common_func_print_just_header(f
)
619 print ' generic_%u_byte( %s, %s );' % (cmdlen
, f
.opcode_real_name(), p
.name
)
624 if self
.common_func_print_header(f
):
632 print '%s if (cmdlen <= gc->maxSmallRenderCommandSize) {' % (indent
)
633 print '%s if ( (gc->pc + cmdlen) > gc->bufEnd ) {' % (indent
)
634 print '%s (void) __glXFlushRenderBuffer(gc, gc->pc);' % (indent
)
635 print '%s }' % (indent
)
638 print '%s emit_header(gc->pc, %s, cmdlen);' % (indent
, f
.opcode_real_name())
640 self
.common_emit_args(f
, "gc->pc", indent
, 4, 0)
641 print '%s gc->pc += cmdlen;' % (indent
)
642 print '%s if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }' % (indent
)
645 print '%s}' % (indent
)
646 print '%selse {' % (indent
)
648 self
.large_emit_begin(indent
, f
)
649 offset
= self
.common_emit_args(f
, "pc", indent
, 8, 1)
651 p
= f
.variable_length_parameter()
652 print '%s __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (indent
, offset
+ 8, p
.name
, p
.size_string())
653 print '%s}' % (indent
)
655 if trailer
: print trailer
661 class PrintGlxProtoInit_c(glX_XML
.GlxProto
):
663 glX_XML
.GlxProto
.__init
__(self
)
664 self
.last_category
= ""
665 self
.license
= license
.bsd_license_template
% ( \
666 """Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
667 (C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
670 def printRealHeader(self
):
672 * \\file indirect_init.c
673 * Initialize indirect rendering dispatch table.
675 * \\author Kevin E. Martin <kevin@precisioninsight.com>
676 * \\author Brian Paul <brian@precisioninsight.com>
677 * \\author Ian Romanick <idr@us.ibm.com>
680 #include "indirect_init.h"
681 #include "indirect.h"
686 * No-op function used to initialize functions that have no GLX protocol
689 static int NoOp(void)
695 * Create and initialize a new GL dispatch table. The table is initialized
696 * with GLX indirect rendering protocol functions.
698 __GLapi * __glXNewIndirectAPI( void )
703 entries = _glapi_get_dispatch_table_size();
704 glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
706 /* first, set all entries to point to no-op functions */
709 void **dispatch = (void **) glAPI;
710 for (i = 0; i < entries; i++) {
711 dispatch[i] = (void *) NoOp;
715 /* now, initialize the entries we understand */"""
717 def printRealFooter(self
):
723 def printFunction(self
, f
):
724 if f
.fn_offset
< 0 or f
.ignore
: return
726 if f
.category
!= self
.last_category
:
727 self
.last_category
= f
.category
729 print ' /* %s */' % (self
.last_category
)
732 print ' glAPI->%s = __indirect_gl%s;' % (f
.name
, f
.name
)
735 class PrintGlxProtoInit_h(glX_XML
.GlxProto
):
737 glX_XML
.GlxProto
.__init
__(self
)
738 self
.last_category
= ""
739 self
.license
= license
.bsd_license_template
% ( \
740 """Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
741 (C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
744 def printRealHeader(self
):
748 * Prototypes for indirect rendering functions.
750 * \\author Kevin E. Martin <kevin@precisioninsight.com>
751 * \\author Ian Romanick <idr@us.ibm.com>
754 #if !defined( _INDIRECT_H_ )
755 # define _INDIRECT_H_
758 glX_XML
.printVisibility( "HIDDEN", "hidden" )
761 def printRealFooter(self
):
762 print "# undef HIDDEN"
763 print "#endif /* !defined( _INDIRECT_H_ ) */"
765 def printFunction(self
, f
):
766 if f
.fn_offset
< 0 or f
.ignore
: return
767 print 'extern HIDDEN %s __indirect_gl%s(%s);' % (f
.fn_return_type
, f
.name
, f
.get_parameter_string())
771 print "Usage: %s [-f input_file_name] [-m output_mode]" % sys
.argv
[0]
775 if __name__
== '__main__':
776 file_name
= "gl_API.xml"
779 (args
, trail
) = getopt
.getopt(sys
.argv
[1:], "f:m:")
784 for (arg
,val
) in args
:
791 dh
= PrintGlxProtoStubs()
792 elif mode
== "init_c":
793 dh
= PrintGlxProtoInit_c()
794 elif mode
== "init_h":
795 dh
= PrintGlxProtoInit_h()
799 parser
= make_parser()
800 parser
.setFeature(feature_namespaces
, 0)
801 parser
.setContentHandler(dh
)