mesa: new _mesa_valid_to_render() function
[mesa.git] / src / mesa / glapi / glapi.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /*
27 * This file manages the OpenGL API dispatch layer.
28 * The dispatch table (struct _glapi_table) is basically just a list
29 * of function pointers.
30 * There are functions to set/get the current dispatch table for the
31 * current thread and to manage registration/dispatch of dynamically
32 * added extension functions.
33 *
34 * It's intended that this file and the other glapi*.[ch] files are
35 * flexible enough to be reused in several places: XFree86, DRI-
36 * based libGL.so, and perhaps the SGI SI.
37 *
38 * NOTE: There are no dependencies on Mesa in this code.
39 *
40 * Versions (API changes):
41 * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0
42 * 2001/01/16 - added dispatch override feature for Mesa 3.5
43 * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1.
44 * 2002/10/01 - _glapi_get_proc_address() will now generate new entrypoints
45 * itself (using offset ~0). _glapi_add_entrypoint() can be
46 * called afterward and it'll fill in the correct dispatch
47 * offset. This allows DRI libGL to avoid probing for DRI
48 * drivers! No changes to the public glapi interface.
49 */
50
51
52
53 #ifdef HAVE_DIX_CONFIG_H
54
55 #include <dix-config.h>
56 #define PUBLIC
57
58 #else
59
60 #include "main/glheader.h"
61
62 #endif
63
64 #include "main/compiler.h"
65
66 #include <stdlib.h>
67 #include <string.h>
68 #ifdef DEBUG
69 #include <assert.h>
70 #endif
71
72 #include "glapi.h"
73 #include "glapioffsets.h"
74 #include "glapitable.h"
75
76
77 /***** BEGIN NO-OP DISPATCH *****/
78
79 static GLboolean WarnFlag = GL_FALSE;
80 static _glapi_warning_func warning_func;
81
82 /*
83 * Enable/disable printing of warning messages.
84 */
85 PUBLIC void
86 _glapi_noop_enable_warnings(GLboolean enable)
87 {
88 WarnFlag = enable;
89 }
90
91 /*
92 * Register a callback function for reporting errors.
93 */
94 PUBLIC void
95 _glapi_set_warning_func( _glapi_warning_func func )
96 {
97 warning_func = func;
98 }
99
100 static GLboolean
101 warn(void)
102 {
103 #if !defined(_WIN32_WCE)
104 if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
105 && warning_func) {
106 return GL_TRUE;
107 }
108 else {
109 return GL_FALSE;
110 }
111 #else
112 return GL_FALSE;
113 #endif
114 }
115
116
117 #define KEYWORD1 static
118 #define KEYWORD1_ALT static
119 #define KEYWORD2 GLAPIENTRY
120 #define NAME(func) NoOp##func
121
122 #define F NULL
123
124 #define DISPATCH(func, args, msg) \
125 if (warn()) { \
126 warning_func(NULL, "GL User Error: called without context: %s", #func); \
127 }
128
129 #define RETURN_DISPATCH(func, args, msg) \
130 if (warn()) { \
131 warning_func(NULL, "GL User Error: called without context: %s", #func); \
132 } \
133 return 0
134
135 #define DISPATCH_TABLE_NAME __glapi_noop_table
136 #define UNUSED_TABLE_NAME __unused_noop_functions
137
138 #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
139
140 static GLint NoOpUnused(void)
141 {
142 if (warn()) {
143 warning_func(NULL, "GL User Error: calling extension function without a current context\n");
144 }
145 return 0;
146 }
147
148 #include "glapitemp.h"
149
150 /***** END NO-OP DISPATCH *****/
151
152
153
154 /**
155 * \name Current dispatch and current context control variables
156 *
157 * Depending on whether or not multithreading is support, and the type of
158 * support available, several variables are used to store the current context
159 * pointer and the current dispatch table pointer. In the non-threaded case,
160 * the variables \c _glapi_Dispatch and \c _glapi_Context are used for this
161 * purpose.
162 *
163 * In the "normal" threaded case, the variables \c _glapi_Dispatch and
164 * \c _glapi_Context will be \c NULL if an application is detected as being
165 * multithreaded. Single-threaded applications will use \c _glapi_Dispatch
166 * and \c _glapi_Context just like the case without any threading support.
167 * When \c _glapi_Dispatch and \c _glapi_Context are \c NULL, the thread state
168 * data \c _gl_DispatchTSD and \c ContextTSD are used. Drivers and the
169 * static dispatch functions access these variables via \c _glapi_get_dispatch
170 * and \c _glapi_get_context.
171 *
172 * There is a race condition in setting \c _glapi_Dispatch to \c NULL. It is
173 * possible for the original thread to be setting it at the same instant a new
174 * thread, perhaps running on a different processor, is clearing it. Because
175 * of that, \c ThreadSafe, which can only ever be changed to \c GL_TRUE, is
176 * used to determine whether or not the application is multithreaded.
177 *
178 * In the TLS case, the variables \c _glapi_Dispatch and \c _glapi_Context are
179 * hardcoded to \c NULL. Instead the TLS variables \c _glapi_tls_Dispatch and
180 * \c _glapi_tls_Context are used. Having \c _glapi_Dispatch and
181 * \c _glapi_Context be hardcoded to \c NULL maintains binary compatability
182 * between TLS enabled loaders and non-TLS DRI drivers.
183 */
184 /*@{*/
185 #if defined(GLX_USE_TLS)
186
187 PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch
188 __attribute__((tls_model("initial-exec")))
189 = (struct _glapi_table *) __glapi_noop_table;
190
191 PUBLIC __thread void * _glapi_tls_Context
192 __attribute__((tls_model("initial-exec")));
193
194 PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
195 PUBLIC const void *_glapi_Context = NULL;
196
197 #else
198
199 #if defined(THREADS)
200
201 static GLboolean ThreadSafe = GL_FALSE; /**< In thread-safe mode? */
202 _glthread_TSD _gl_DispatchTSD; /**< Per-thread dispatch pointer */
203 static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
204
205 #if defined(WIN32_THREADS)
206 void FreeTSD(_glthread_TSD *p);
207 void FreeAllTSD(void)
208 {
209 FreeTSD(&_gl_DispatchTSD);
210 FreeTSD(&ContextTSD);
211 }
212 #endif /* defined(WIN32_THREADS) */
213
214 #endif /* defined(THREADS) */
215
216 PUBLIC struct _glapi_table *_glapi_Dispatch =
217 (struct _glapi_table *) __glapi_noop_table;
218 PUBLIC void *_glapi_Context = NULL;
219
220 #endif /* defined(GLX_USE_TLS) */
221 /*@}*/
222
223
224
225
226 /**
227 * We should call this periodically from a function such as glXMakeCurrent
228 * in order to test if multiple threads are being used.
229 */
230 void
231 _glapi_check_multithread(void)
232 {
233 #if defined(THREADS) && !defined(GLX_USE_TLS)
234 if (!ThreadSafe) {
235 static unsigned long knownID;
236 static GLboolean firstCall = GL_TRUE;
237 if (firstCall) {
238 knownID = _glthread_GetID();
239 firstCall = GL_FALSE;
240 }
241 else if (knownID != _glthread_GetID()) {
242 ThreadSafe = GL_TRUE;
243 _glapi_set_dispatch(NULL);
244 _glapi_set_context(NULL);
245 }
246 }
247 else if (!_glapi_get_dispatch()) {
248 /* make sure that this thread's dispatch pointer isn't null */
249 _glapi_set_dispatch(NULL);
250 }
251 #endif
252 }
253
254
255
256 /**
257 * Set the current context pointer for this thread.
258 * The context pointer is an opaque type which should be cast to
259 * void from the real context pointer type.
260 */
261 PUBLIC void
262 _glapi_set_context(void *context)
263 {
264 (void) __unused_noop_functions; /* silence a warning */
265 #if defined(GLX_USE_TLS)
266 _glapi_tls_Context = context;
267 #elif defined(THREADS)
268 _glthread_SetTSD(&ContextTSD, context);
269 _glapi_Context = (ThreadSafe) ? NULL : context;
270 #else
271 _glapi_Context = context;
272 #endif
273 }
274
275
276
277 /**
278 * Get the current context pointer for this thread.
279 * The context pointer is an opaque type which should be cast from
280 * void to the real context pointer type.
281 */
282 PUBLIC void *
283 _glapi_get_context(void)
284 {
285 #if defined(GLX_USE_TLS)
286 return _glapi_tls_Context;
287 #elif defined(THREADS)
288 if (ThreadSafe) {
289 return _glthread_GetTSD(&ContextTSD);
290 }
291 else {
292 return _glapi_Context;
293 }
294 #else
295 return _glapi_Context;
296 #endif
297 }
298
299 #ifdef USE_X86_ASM
300
301 #if defined( GLX_USE_TLS )
302 extern GLubyte gl_dispatch_functions_start[];
303 extern GLubyte gl_dispatch_functions_end[];
304 #else
305 extern const GLubyte gl_dispatch_functions_start[];
306 #endif
307
308 #endif /* USE_X86_ASM */
309
310
311 #if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
312 # define DISPATCH_FUNCTION_SIZE 16
313 #elif defined(USE_X86_ASM)
314 # if defined(THREADS) && !defined(GLX_USE_TLS)
315 # define DISPATCH_FUNCTION_SIZE 32
316 # else
317 # define DISPATCH_FUNCTION_SIZE 16
318 # endif
319 #endif
320
321 #ifdef USE_SPARC_ASM
322 #ifdef GLX_USE_TLS
323 extern unsigned int __glapi_sparc_tls_stub;
324 #else
325 extern unsigned int __glapi_sparc_pthread_stub;
326 #endif
327 #endif
328
329 #if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer)
330 # define NEED_FUNCTION_POINTER
331 #endif
332
333 #if defined(PTHREADS) || defined(GLX_USE_TLS)
334 /**
335 * Perform platform-specific GL API entry-point fixups.
336 */
337 static void
338 init_glapi_relocs( void )
339 {
340 #if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
341 extern unsigned long _x86_get_dispatch(void);
342 char run_time_patch[] = {
343 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
344 };
345 GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
346 const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
347 GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
348
349 *offset = _x86_get_dispatch();
350 while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
351 (void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
352 curr_func += DISPATCH_FUNCTION_SIZE;
353 }
354 #endif
355 #ifdef USE_SPARC_ASM
356 extern void __glapi_sparc_icache_flush(unsigned int *);
357 static const unsigned int template[] = {
358 #ifdef GLX_USE_TLS
359 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
360 0x8730e00a, /* srl %g3, 10, %g3 */
361 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
362 #ifdef __arch64__
363 0xc259c002, /* ldx [%g7 + %g2], %g1 */
364 0xc2584003, /* ldx [%g1 + %g3], %g1 */
365 #else
366 0xc201c002, /* ld [%g7 + %g2], %g1 */
367 0xc2004003, /* ld [%g1 + %g3], %g1 */
368 #endif
369 0x81c04000, /* jmp %g1 */
370 0x01000000, /* nop */
371 #else
372 #ifdef __arch64__
373 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
374 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
375 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
376 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
377 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
378 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
379 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
380 #else
381 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
382 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
383 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
384 #endif
385 0x80a06000, /* --> cmp %g1, 0 */
386 0x02800005, /* --> be +4*5 */
387 0x01000000, /* --> nop */
388 #ifdef __arch64__
389 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */
390 #else
391 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */
392 #endif
393 0x81c04000, /* --> jmp %g1 */
394 0x01000000, /* --> nop */
395 #ifdef __arch64__
396 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */
397 #else
398 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */
399 #endif
400 0xa0100003, /* --> mov %g3, %l0 */
401 0x40000000, /* --> call _glapi_get_dispatch */
402 0x01000000, /* --> nop */
403 0x82100008, /* --> mov %o0, %g1 */
404 0x86100010, /* --> mov %l0, %g3 */
405 0x10bffff7, /* --> ba -4*9 */
406 0x81e80000, /* --> restore */
407 #endif
408 };
409 #ifdef GLX_USE_TLS
410 extern unsigned long __glapi_sparc_get_dispatch(void);
411 unsigned int *code = &__glapi_sparc_tls_stub;
412 unsigned long dispatch = __glapi_sparc_get_dispatch();
413 #else
414 unsigned int *code = &__glapi_sparc_pthread_stub;
415 unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
416 unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
417 int idx;
418 #endif
419
420 #if defined(GLX_USE_TLS)
421 code[0] = template[0] | (dispatch >> 10);
422 code[1] = template[1];
423 __glapi_sparc_icache_flush(&code[0]);
424 code[2] = template[2] | (dispatch & 0x3ff);
425 code[3] = template[3];
426 __glapi_sparc_icache_flush(&code[2]);
427 code[4] = template[4];
428 code[5] = template[5];
429 __glapi_sparc_icache_flush(&code[4]);
430 code[6] = template[6];
431 __glapi_sparc_icache_flush(&code[6]);
432 #else
433 #if defined(__arch64__)
434 code[0] = template[0] | (dispatch >> (32 + 10));
435 code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
436 __glapi_sparc_icache_flush(&code[0]);
437 code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
438 code[3] = template[3];
439 __glapi_sparc_icache_flush(&code[2]);
440 code[4] = template[4];
441 code[5] = template[5];
442 __glapi_sparc_icache_flush(&code[4]);
443 code[6] = template[6] | (dispatch & 0x3ff);
444 idx = 7;
445 #else
446 code[0] = template[0] | (dispatch >> 10);
447 code[1] = template[1];
448 __glapi_sparc_icache_flush(&code[0]);
449 code[2] = template[2] | (dispatch & 0x3ff);
450 idx = 3;
451 #endif
452 code[idx + 0] = template[idx + 0];
453 __glapi_sparc_icache_flush(&code[idx - 1]);
454 code[idx + 1] = template[idx + 1];
455 code[idx + 2] = template[idx + 2];
456 __glapi_sparc_icache_flush(&code[idx + 1]);
457 code[idx + 3] = template[idx + 3];
458 code[idx + 4] = template[idx + 4];
459 __glapi_sparc_icache_flush(&code[idx + 3]);
460 code[idx + 5] = template[idx + 5];
461 code[idx + 6] = template[idx + 6];
462 __glapi_sparc_icache_flush(&code[idx + 5]);
463 code[idx + 7] = template[idx + 7];
464 code[idx + 8] = template[idx + 8] |
465 (((call_dest - ((unsigned long) &code[idx + 8]))
466 >> 2) & 0x3fffffff);
467 __glapi_sparc_icache_flush(&code[idx + 7]);
468 code[idx + 9] = template[idx + 9];
469 code[idx + 10] = template[idx + 10];
470 __glapi_sparc_icache_flush(&code[idx + 9]);
471 code[idx + 11] = template[idx + 11];
472 code[idx + 12] = template[idx + 12];
473 __glapi_sparc_icache_flush(&code[idx + 11]);
474 code[idx + 13] = template[idx + 13];
475 __glapi_sparc_icache_flush(&code[idx + 13]);
476 #endif
477 #endif
478 }
479 #endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
480
481
482 /**
483 * Set the global or per-thread dispatch table pointer.
484 * If the dispatch parameter is NULL we'll plug in the no-op dispatch
485 * table (__glapi_noop_table).
486 */
487 PUBLIC void
488 _glapi_set_dispatch(struct _glapi_table *dispatch)
489 {
490 #if defined(PTHREADS) || defined(GLX_USE_TLS)
491 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
492 pthread_once( & once_control, init_glapi_relocs );
493 #endif
494
495 if (!dispatch) {
496 /* use the no-op functions */
497 dispatch = (struct _glapi_table *) __glapi_noop_table;
498 }
499 #ifdef DEBUG
500 else {
501 _glapi_check_table(dispatch);
502 }
503 #endif
504
505 #if defined(GLX_USE_TLS)
506 _glapi_tls_Dispatch = dispatch;
507 #elif defined(THREADS)
508 _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
509 _glapi_Dispatch = (ThreadSafe) ? NULL : dispatch;
510 #else /*THREADS*/
511 _glapi_Dispatch = dispatch;
512 #endif /*THREADS*/
513 }
514
515
516
517 /**
518 * Return pointer to current dispatch table for calling thread.
519 */
520 PUBLIC struct _glapi_table *
521 _glapi_get_dispatch(void)
522 {
523 struct _glapi_table * api;
524 #if defined(GLX_USE_TLS)
525 api = _glapi_tls_Dispatch;
526 #elif defined(THREADS)
527 api = (ThreadSafe)
528 ? (struct _glapi_table *) _glthread_GetTSD(&_gl_DispatchTSD)
529 : _glapi_Dispatch;
530 #else
531 api = _glapi_Dispatch;
532 #endif
533 return api;
534 }
535
536
537
538
539 /*
540 * The dispatch table size (number of entries) is the size of the
541 * _glapi_table struct plus the number of dynamic entries we can add.
542 * The extra slots can be filled in by DRI drivers that register new extension
543 * functions.
544 */
545 #define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
546
547
548 /**
549 * Return size of dispatch table struct as number of functions (or
550 * slots).
551 */
552 PUBLIC GLuint
553 _glapi_get_dispatch_table_size(void)
554 {
555 return DISPATCH_TABLE_SIZE;
556 }
557
558
559 /**
560 * Make sure there are no NULL pointers in the given dispatch table.
561 * Intended for debugging purposes.
562 */
563 void
564 _glapi_check_table(const struct _glapi_table *table)
565 {
566 #ifdef EXTRA_DEBUG
567 const GLuint entries = _glapi_get_dispatch_table_size();
568 const void **tab = (const void **) table;
569 GLuint i;
570 for (i = 1; i < entries; i++) {
571 assert(tab[i]);
572 }
573
574 /* Do some spot checks to be sure that the dispatch table
575 * slots are assigned correctly.
576 */
577 {
578 GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
579 char *BeginFunc = (char*) &table->Begin;
580 GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
581 assert(BeginOffset == _gloffset_Begin);
582 assert(BeginOffset == offset);
583 }
584 {
585 GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
586 char *viewportFunc = (char*) &table->Viewport;
587 GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
588 assert(viewportOffset == _gloffset_Viewport);
589 assert(viewportOffset == offset);
590 }
591 {
592 GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
593 char *VertexPointerFunc = (char*) &table->VertexPointer;
594 GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
595 assert(VertexPointerOffset == _gloffset_VertexPointer);
596 assert(VertexPointerOffset == offset);
597 }
598 {
599 GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
600 char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
601 GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
602 assert(ResetMinMaxOffset == _gloffset_ResetMinmax);
603 assert(ResetMinMaxOffset == offset);
604 }
605 {
606 GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
607 char *blendColorFunc = (char*) &table->BlendColor;
608 GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
609 assert(blendColorOffset == _gloffset_BlendColor);
610 assert(blendColorOffset == offset);
611 }
612 {
613 GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
614 char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
615 GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
616 assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT);
617 assert(secondaryColor3fOffset == offset);
618 }
619 {
620 GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
621 char *pointParameterivFunc = (char*) &table->PointParameterivNV;
622 GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
623 assert(pointParameterivOffset == _gloffset_PointParameterivNV);
624 assert(pointParameterivOffset == offset);
625 }
626 {
627 GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
628 char *setFenceFunc = (char*) &table->SetFenceNV;
629 GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
630 assert(setFenceOffset == _gloffset_SetFenceNV);
631 assert(setFenceOffset == offset);
632 }
633 #else
634 (void) table;
635 #endif
636 }