1 /* $Id: glapi.c,v 1.67 2002/10/29 15:03:14 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
29 * This file manages the OpenGL API dispatch layer.
30 * The dispatch table (struct _glapi_table) is basically just a list
31 * of function pointers.
32 * There are functions to set/get the current dispatch table for the
33 * current thread and to manage registration/dispatch of dynamically
34 * added extension functions.
36 * It's intended that this file and the other glapi*.[ch] files are
37 * flexible enough to be reused in several places: XFree86, DRI-
38 * based libGL.so, and perhaps the SGI SI.
40 * NOTE: There are no dependencies on Mesa in this code.
42 * Versions (API changes):
43 * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0
44 * 2001/01/16 - added dispatch override feature for Mesa 3.5
45 * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1.
46 * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints
47 * itself (using offset ~0). _glapi_add_entrypoint() can be
48 * called afterward and it'll fill in the correct dispatch
49 * offset. This allows DRI libGL to avoid probing for DRI
50 * drivers! No changes to the public glapi interface.
57 #include "glapioffsets.h"
58 #include "glapitable.h"
61 /***** BEGIN NO-OP DISPATCH *****/
63 static GLboolean WarnFlag
= GL_FALSE
;
64 static _glapi_warning_func warning_func
;
68 * Enable/disable printing of warning messages.
71 _glapi_noop_enable_warnings(GLboolean enable
)
77 * Register a callback function for reporting errors.
80 _glapi_set_warning_func( _glapi_warning_func func
)
88 if ((WarnFlag
|| getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
98 #define KEYWORD1 static
100 #define NAME(func) NoOp##func
104 #define DISPATCH(func, args, msg) \
106 warning_func(NULL, "GL User Error: called without context:"); \
110 #define RETURN_DISPATCH(func, args, msg) \
112 warning_func(NULL, "GL User Error: called without context:"); \
117 #define DISPATCH_TABLE_NAME __glapi_noop_table
118 #define UNUSED_TABLE_NAME __usused_noop_functions
120 #define TABLE_ENTRY(name) (void *) NoOp##name
122 static int NoOpUnused(void)
125 warning_func(NULL
, "GL User Error: calling extension function without a current context\n");
130 #include "glapitemp.h"
132 /***** END NO-OP DISPATCH *****/
136 /***** BEGIN THREAD-SAFE DISPATCH *****/
137 /* if we support thread-safety, build a special dispatch table for use
138 * in thread-safety mode (ThreadSafe == GL_TRUE). Each entry in the
139 * dispatch table will call _glthread_GetTSD() to get the actual dispatch
140 * table bound to the current thread, then jump through that table.
145 static GLboolean ThreadSafe
= GL_FALSE
; /* In thread-safe mode? */
146 static _glthread_TSD DispatchTSD
; /* Per-thread dispatch pointer */
147 static _glthread_TSD RealDispatchTSD
; /* only when using override */
148 static _glthread_TSD ContextTSD
; /* Per-thread context pointer */
151 #define KEYWORD1 static
152 #define KEYWORD2 GLAPIENTRY
153 #define NAME(func) _ts_##func
155 #define DISPATCH(FUNC, ARGS, MESSAGE) \
156 struct _glapi_table *dispatch; \
157 dispatch = (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); \
159 dispatch = (struct _glapi_table *) __glapi_noop_table; \
160 (dispatch->FUNC) ARGS
162 #define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
163 struct _glapi_table *dispatch; \
164 dispatch = (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD); \
166 dispatch = (struct _glapi_table *) __glapi_noop_table; \
167 return (dispatch->FUNC) ARGS
169 #define DISPATCH_TABLE_NAME __glapi_threadsafe_table
170 #define UNUSED_TABLE_NAME __usused_threadsafe_functions
172 #define TABLE_ENTRY(name) (void *) _ts_##name
174 static int _ts_Unused(void)
179 #include "glapitemp.h"
183 /***** END THREAD-SAFE DISPATCH *****/
187 struct _glapi_table
*_glapi_Dispatch
= (struct _glapi_table
*) __glapi_noop_table
;
188 struct _glapi_table
*_glapi_RealDispatch
= (struct _glapi_table
*) __glapi_noop_table
;
190 /* Used when thread safety disabled */
191 void *_glapi_Context
= NULL
;
194 static GLboolean DispatchOverride
= GL_FALSE
;
198 /* strdup() is actually not a standard ANSI C or POSIX routine.
199 * Irix will not define it if ANSI mode is in effect.
202 str_dup(const char *str
)
205 copy
= (char*) malloc(strlen(str
) + 1);
215 * We should call this periodically from a function such as glXMakeCurrent
216 * in order to test if multiple threads are being used.
219 _glapi_check_multithread(void)
223 static unsigned long knownID
;
224 static GLboolean firstCall
= GL_TRUE
;
226 knownID
= _glthread_GetID();
227 firstCall
= GL_FALSE
;
229 else if (knownID
!= _glthread_GetID()) {
230 ThreadSafe
= GL_TRUE
;
234 /* make sure that this thread's dispatch pointer isn't null */
235 if (!_glapi_get_dispatch()) {
236 _glapi_set_dispatch(NULL
);
245 * Set the current context pointer for this thread.
246 * The context pointer is an opaque type which should be cast to
247 * void from the real context pointer type.
250 _glapi_set_context(void *context
)
253 _glthread_SetTSD(&ContextTSD
, context
);
255 _glapi_Context
= NULL
;
257 _glapi_Context
= context
;
259 _glapi_Context
= context
;
266 * Get the current context pointer for this thread.
267 * The context pointer is an opaque type which should be cast from
268 * void to the real context pointer type.
271 _glapi_get_context(void)
275 return _glthread_GetTSD(&ContextTSD
);
278 return _glapi_Context
;
281 return _glapi_Context
;
288 * Set the global or per-thread dispatch table pointer.
291 _glapi_set_dispatch(struct _glapi_table
*dispatch
)
294 /* use the no-op functions */
295 dispatch
= (struct _glapi_table
*) __glapi_noop_table
;
299 _glapi_check_table(dispatch
);
304 if (DispatchOverride
) {
305 _glthread_SetTSD(&RealDispatchTSD
, (void *) dispatch
);
307 _glapi_RealDispatch
= (struct _glapi_table
*) __glapi_threadsafe_table
;
309 _glapi_RealDispatch
= dispatch
;
312 /* normal operation */
313 _glthread_SetTSD(&DispatchTSD
, (void *) dispatch
);
315 _glapi_Dispatch
= (struct _glapi_table
*) __glapi_threadsafe_table
;
317 _glapi_Dispatch
= dispatch
;
320 if (DispatchOverride
) {
321 _glapi_RealDispatch
= dispatch
;
324 _glapi_Dispatch
= dispatch
;
332 * Return pointer to current dispatch table for calling thread.
334 struct _glapi_table
*
335 _glapi_get_dispatch(void)
339 if (DispatchOverride
) {
340 return (struct _glapi_table
*) _glthread_GetTSD(&RealDispatchTSD
);
343 return (struct _glapi_table
*) _glthread_GetTSD(&DispatchTSD
);
347 if (DispatchOverride
) {
348 assert(_glapi_RealDispatch
);
349 return _glapi_RealDispatch
;
352 assert(_glapi_Dispatch
);
353 return _glapi_Dispatch
;
357 return _glapi_Dispatch
;
363 * Notes on dispatch overrride:
365 * Dispatch override allows an external agent to hook into the GL dispatch
366 * mechanism before execution goes into the core rendering library. For
367 * example, a trace mechanism would insert itself as an overrider, print
368 * logging info for each GL function, then dispatch to the real GL function.
370 * libGLS (GL Stream library) is another agent that might use override.
372 * We don't allow more than one layer of overriding at this time.
373 * In the future we may allow nested/layered override. In that case
374 * _glapi_begin_dispatch_override() will return an override layer,
375 * _glapi_end_dispatch_override(layer) will remove an override layer
376 * and _glapi_get_override_dispatch(layer) will return the dispatch
377 * table for a given override layer. layer = 0 will be the "real"
382 * Return: dispatch override layer number.
385 _glapi_begin_dispatch_override(struct _glapi_table
*override
)
387 struct _glapi_table
*real
= _glapi_get_dispatch();
389 assert(!DispatchOverride
); /* can't nest at this time */
390 DispatchOverride
= GL_TRUE
;
392 _glapi_set_dispatch(real
);
395 _glthread_SetTSD(&DispatchTSD
, (void *) override
);
397 _glapi_Dispatch
= (struct _glapi_table
*) __glapi_threadsafe_table
;
399 _glapi_Dispatch
= override
;
401 _glapi_Dispatch
= override
;
408 _glapi_end_dispatch_override(int layer
)
410 struct _glapi_table
*real
= _glapi_get_dispatch();
412 DispatchOverride
= GL_FALSE
;
413 _glapi_set_dispatch(real
);
414 /* the rest of this isn't needed, just play it safe */
416 _glthread_SetTSD(&RealDispatchTSD
, NULL
);
418 _glapi_RealDispatch
= NULL
;
422 struct _glapi_table
*
423 _glapi_get_override_dispatch(int layer
)
426 return _glapi_get_dispatch();
429 if (DispatchOverride
) {
431 return (struct _glapi_table
*) _glthread_GetTSD(&DispatchTSD
);
433 return _glapi_Dispatch
;
443 struct name_address_offset
{
450 /* The code in this file is auto-generated with Python */
456 * Return dispatch table offset of the named static (built-in) function.
457 * Return -1 if function not found.
460 get_static_proc_offset(const char *funcName
)
463 for (i
= 0; static_functions
[i
].Name
; i
++) {
464 if (strcmp(static_functions
[i
].Name
, funcName
) == 0) {
465 return static_functions
[i
].Offset
;
473 * Return dispatch function address the named static (built-in) function.
474 * Return NULL if function not found.
477 get_static_proc_address(const char *funcName
)
480 for (i
= 0; static_functions
[i
].Name
; i
++) {
481 if (strcmp(static_functions
[i
].Name
, funcName
) == 0) {
482 return static_functions
[i
].Address
;
490 /**********************************************************************
491 * Extension function management.
495 * Number of extension functions which we can dynamically add at runtime.
497 #define MAX_EXTENSION_FUNCS 300
501 * The disptach table size (number of entries) is the sizeof the
502 * _glapi_table struct plus the number of dynamic entries we can add.
503 * The extra slots can be filled in by DRI drivers that register new extension
506 #define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
509 static struct name_address_offset ExtEntryTable
[MAX_EXTENSION_FUNCS
];
510 static GLuint NumExtEntryPoints
= 0;
513 extern void __glapi_sparc_icache_flush(unsigned int *);
517 * Generate a dispatch function (entrypoint) which jumps through
518 * the given slot number (offset) in the current dispatch table.
519 * We need assembly language in order to accomplish this.
522 generate_entrypoint(GLuint functionOffset
)
524 #if defined(USE_X86_ASM)
526 * This x86 code contributed by Josh Vanderhoof.
528 * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax
530 * 5: 85 c0 testl %eax,%eax
532 * 7: 74 06 je f <entrypoint+0xf>
534 * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax)
536 * f: e8 fc ff ff ff call __glapi_get_dispatch
538 * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax)
541 static const unsigned char insn_template
[] = {
542 0xa1, 0x00, 0x00, 0x00, 0x00,
545 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00,
546 0xe8, 0x00, 0x00, 0x00, 0x00,
547 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
549 unsigned char *code
= (unsigned char *) malloc(sizeof(insn_template
));
550 unsigned int next_insn
;
552 memcpy(code
, insn_template
, sizeof(insn_template
));
554 *(unsigned int *)(code
+ 0x01) = (unsigned int)&_glapi_Dispatch
;
555 *(unsigned int *)(code
+ 0x0b) = (unsigned int)functionOffset
* 4;
556 next_insn
= (unsigned int)(code
+ 0x14);
557 *(unsigned int *)(code
+ 0x10) = (unsigned int)_glapi_get_dispatch
- next_insn
;
558 *(unsigned int *)(code
+ 0x16) = (unsigned int)functionOffset
* 4;
561 #elif defined(USE_SPARC_ASM)
564 static const unsigned int insn_template
[] = {
565 0x05000000, /* sethi %uhi(_glapi_Dispatch), %g2 */
566 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
567 0x8410a000, /* or %g2, %ulo(_glapi_Dispatch), %g2 */
568 0x82106000, /* or %g1, %lo(_glapi_Dispatch), %g1 */
569 0x8528b020, /* sllx %g2, 32, %g2 */
570 0xc2584002, /* ldx [%g1 + %g2], %g1 */
571 0x05000000, /* sethi %hi(8 * glapioffset), %g2 */
572 0x8410a000, /* or %g2, %lo(8 * glapioffset), %g2 */
573 0xc6584002, /* ldx [%g1 + %g2], %g3 */
574 0x81c0c000, /* jmpl %g3, %g0 */
578 static const unsigned int insn_template
[] = {
579 0x03000000, /* sethi %hi(_glapi_Dispatch), %g1 */
580 0xc2006000, /* ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
581 0xc6006000, /* ld [%g1 + %lo(4*glapioffset)], %g3 */
582 0x81c0c000, /* jmpl %g3, %g0 */
586 unsigned int *code
= (unsigned int *) malloc(sizeof(insn_template
));
587 unsigned long glapi_addr
= (unsigned long) &_glapi_Dispatch
;
589 memcpy(code
, insn_template
, sizeof(insn_template
));
592 code
[0] |= (glapi_addr
>> (32 + 10));
593 code
[1] |= ((glapi_addr
& 0xffffffff) >> 10);
594 __glapi_sparc_icache_flush(&code
[0]);
595 code
[2] |= ((glapi_addr
>> 32) & ((1 << 10) - 1));
596 code
[3] |= (glapi_addr
& ((1 << 10) - 1));
597 __glapi_sparc_icache_flush(&code
[2]);
598 code
[6] |= ((functionOffset
* 8) >> 10);
599 code
[7] |= ((functionOffset
* 8) & ((1 << 10) - 1));
600 __glapi_sparc_icache_flush(&code
[6]);
602 code
[0] |= (glapi_addr
>> 10);
603 code
[1] |= (glapi_addr
& ((1 << 10) - 1));
604 __glapi_sparc_icache_flush(&code
[0]);
605 code
[2] |= (functionOffset
* 4);
606 __glapi_sparc_icache_flush(&code
[2]);
612 #endif /* USE_*_ASM */
617 * This function inserts a new dispatch offset into the assembly language
618 * stub that was generated with the preceeding function.
621 fill_in_entrypoint_offset(void *entrypoint
, GLuint offset
)
623 #if defined(USE_X86_ASM)
625 unsigned char *code
= (unsigned char *) entrypoint
;
626 *(unsigned int *)(code
+ 0x0b) = offset
* 4;
627 *(unsigned int *)(code
+ 0x16) = offset
* 4;
629 #elif defined(USE_SPARC_ASM)
631 /* XXX this hasn't been tested! */
632 unsigned int *code
= (unsigned int *) entrypoint
;
634 code
[6] = 0x05000000; /* sethi %hi(8 * glapioffset), %g2 */
635 code
[7] = 0x8410a000; /* or %g2, %lo(8 * glapioffset), %g2 */
636 code
[6] |= ((offset
* 8) >> 10);
637 code
[7] |= ((offset
* 8) & ((1 << 10) - 1));
638 __glapi_sparc_icache_flush(&code
[6]);
639 #else /* __sparc_v9__ */
640 code
[2] = 0xc6006000; /* ld [%g1 + %lo(4*glapioffset)], %g3 */
641 code
[2] |= (offset
* 4);
642 __glapi_sparc_icache_flush(&code
[2]);
643 #endif /* __sparc_v9__ */
645 #endif /* USE_*_ASM */
650 * Add a new extension function entrypoint.
651 * Return: GL_TRUE = success or GL_FALSE = failure
654 _glapi_add_entrypoint(const char *funcName
, GLuint offset
)
656 /* trivial rejection test */
657 if (!funcName
|| funcName
[0] != 'g' || funcName
[1] != 'l')
660 /* first check if the named function is already statically present */
662 GLint index
= get_static_proc_offset(funcName
);
664 return (GLboolean
) ((GLuint
) index
== offset
); /* bad offset! */
668 /* See if this function has already been dynamically added */
671 for (i
= 0; i
< NumExtEntryPoints
; i
++) {
672 if (strcmp(ExtEntryTable
[i
].Name
, funcName
) == 0) {
673 /* function already registered */
674 if (ExtEntryTable
[i
].Offset
== offset
) {
675 return GL_TRUE
; /* offsets match */
677 else if (ExtEntryTable
[i
].Offset
== ~0
678 && offset
< DISPATCH_TABLE_SIZE
) {
679 /* need to patch-up the dispatch code */
681 fill_in_entrypoint_offset(ExtEntryTable
[i
].Address
, offset
);
682 ExtEntryTable
[i
].Offset
= offset
;
687 return GL_FALSE
; /* bad offset! */
693 /* This is a new function, try to add it. */
694 if (NumExtEntryPoints
>= MAX_EXTENSION_FUNCS
||
695 offset
>= DISPATCH_TABLE_SIZE
) {
700 void *entrypoint
= generate_entrypoint(offset
);
702 return GL_FALSE
; /* couldn't generate assembly */
705 ExtEntryTable
[NumExtEntryPoints
].Name
= str_dup(funcName
);
706 ExtEntryTable
[NumExtEntryPoints
].Offset
= offset
;
707 ExtEntryTable
[NumExtEntryPoints
].Address
= entrypoint
;
710 return GL_TRUE
; /* success */
713 /* should never get here, silence compiler warnings */
719 * Return offset of entrypoint for named function within dispatch table.
722 _glapi_get_proc_offset(const char *funcName
)
724 /* search extension functions first */
726 for (i
= 0; i
< NumExtEntryPoints
; i
++) {
727 if (strcmp(ExtEntryTable
[i
].Name
, funcName
) == 0) {
728 return ExtEntryTable
[i
].Offset
;
732 /* search static functions */
733 return get_static_proc_offset(funcName
);
739 * Return entrypoint for named function.
742 _glapi_get_proc_address(const char *funcName
)
744 /* search extension functions first */
746 for (i
= 0; i
< NumExtEntryPoints
; i
++) {
747 if (strcmp(ExtEntryTable
[i
].Name
, funcName
) == 0) {
748 return ExtEntryTable
[i
].Address
;
752 /* search static functions */
754 const GLvoid
*func
= get_static_proc_address(funcName
);
759 /* generate new entrypoint - use a temporary dispatch offset of
760 * ~0 (i.e. -1). Later, when the driver calls _glapi_add_entrypoint()
761 * we'll put in the proper offset. If that never happens, and the
762 * user calls this function, he'll segfault. That's what you get
763 * when you try calling a GL function that doesn't really exist.
765 if (NumExtEntryPoints
< MAX_EXTENSION_FUNCS
) {
766 GLvoid
*entrypoint
= generate_entrypoint(~0);
770 ExtEntryTable
[NumExtEntryPoints
].Name
= str_dup(funcName
);
771 ExtEntryTable
[NumExtEntryPoints
].Offset
= ~0;
772 ExtEntryTable
[NumExtEntryPoints
].Address
= entrypoint
;
778 /* no space for new functions! */
786 * Return the name of the function at the given dispatch offset.
787 * This is only intended for debugging.
790 _glapi_get_proc_name(GLuint offset
)
792 const GLuint n
= sizeof(static_functions
) / sizeof(struct name_address_offset
);
795 /* search built-in functions */
796 for (i
= 0; i
< n
; i
++) {
797 if (static_functions
[i
].Offset
== offset
)
798 return static_functions
[i
].Name
;
801 /* search added extension functions */
802 for (i
= 0; i
< NumExtEntryPoints
; i
++) {
803 if (ExtEntryTable
[i
].Offset
== offset
) {
804 return ExtEntryTable
[i
].Name
;
813 * Return size of dispatch table struct as number of functions (or
817 _glapi_get_dispatch_table_size(void)
819 return DISPATCH_TABLE_SIZE
;
825 * Get API dispatcher version string.
828 _glapi_get_version(void)
830 return "20021001"; /* YYYYMMDD */
836 * Make sure there are no NULL pointers in the given dispatch table.
837 * Intended for debugging purposes.
840 _glapi_check_table(const struct _glapi_table
*table
)
843 const GLuint entries
= _glapi_get_dispatch_table_size();
844 const void **tab
= (const void **) table
;
846 for (i
= 1; i
< entries
; i
++) {
850 /* Do some spot checks to be sure that the dispatch table
851 * slots are assigned correctly.
854 GLuint BeginOffset
= _glapi_get_proc_offset("glBegin");
855 char *BeginFunc
= (char*) &table
->Begin
;
856 GLuint offset
= (BeginFunc
- (char *) table
) / sizeof(void *);
857 assert(BeginOffset
== _gloffset_Begin
);
858 assert(BeginOffset
== offset
);
861 GLuint viewportOffset
= _glapi_get_proc_offset("glViewport");
862 char *viewportFunc
= (char*) &table
->Viewport
;
863 GLuint offset
= (viewportFunc
- (char *) table
) / sizeof(void *);
864 assert(viewportOffset
== _gloffset_Viewport
);
865 assert(viewportOffset
== offset
);
868 GLuint VertexPointerOffset
= _glapi_get_proc_offset("glVertexPointer");
869 char *VertexPointerFunc
= (char*) &table
->VertexPointer
;
870 GLuint offset
= (VertexPointerFunc
- (char *) table
) / sizeof(void *);
871 assert(VertexPointerOffset
== _gloffset_VertexPointer
);
872 assert(VertexPointerOffset
== offset
);
875 GLuint ResetMinMaxOffset
= _glapi_get_proc_offset("glResetMinmax");
876 char *ResetMinMaxFunc
= (char*) &table
->ResetMinmax
;
877 GLuint offset
= (ResetMinMaxFunc
- (char *) table
) / sizeof(void *);
878 assert(ResetMinMaxOffset
== _gloffset_ResetMinmax
);
879 assert(ResetMinMaxOffset
== offset
);
882 GLuint blendColorOffset
= _glapi_get_proc_offset("glBlendColor");
883 char *blendColorFunc
= (char*) &table
->BlendColor
;
884 GLuint offset
= (blendColorFunc
- (char *) table
) / sizeof(void *);
885 assert(blendColorOffset
== _gloffset_BlendColor
);
886 assert(blendColorOffset
== offset
);
889 GLuint istextureOffset
= _glapi_get_proc_offset("glIsTextureEXT");
890 char *istextureFunc
= (char*) &table
->IsTextureEXT
;
891 GLuint offset
= (istextureFunc
- (char *) table
) / sizeof(void *);
892 assert(istextureOffset
== _gloffset_IsTextureEXT
);
893 assert(istextureOffset
== offset
);
896 GLuint secondaryColor3fOffset
= _glapi_get_proc_offset("glSecondaryColor3fEXT");
897 char *secondaryColor3fFunc
= (char*) &table
->SecondaryColor3fEXT
;
898 GLuint offset
= (secondaryColor3fFunc
- (char *) table
) / sizeof(void *);
899 assert(secondaryColor3fOffset
== _gloffset_SecondaryColor3fEXT
);
900 assert(secondaryColor3fOffset
== offset
);
901 assert(_glapi_get_proc_address("glSecondaryColor3fEXT") == (void *) &glSecondaryColor3fEXT
);
904 GLuint pointParameterivOffset
= _glapi_get_proc_offset("glPointParameterivNV");
905 char *pointParameterivFunc
= (char*) &table
->PointParameterivNV
;
906 GLuint offset
= (pointParameterivFunc
- (char *) table
) / sizeof(void *);
907 assert(pointParameterivOffset
== _gloffset_PointParameterivNV
);
908 assert(pointParameterivOffset
== offset
);
909 assert(_glapi_get_proc_address("glPointParameterivNV") == (void *) &glPointParameterivNV
);
912 GLuint setFenceOffset
= _glapi_get_proc_offset("glSetFenceNV");
913 char *setFenceFunc
= (char*) &table
->SetFenceNV
;
914 GLuint offset
= (setFenceFunc
- (char *) table
) / sizeof(void *);
915 assert(setFenceOffset
== _gloffset_SetFenceNV
);
916 assert(setFenceOffset
== offset
);
917 assert(_glapi_get_proc_address("glSetFenceNV") == (void *) &glSetFenceNV
);