~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/glapi/glapi.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
 
100
100
 
101
101
#define KEYWORD1 static
 
102
#define KEYWORD1_ALT static
102
103
#define KEYWORD2 GLAPIENTRY
103
104
#define NAME(func)  NoOp##func
104
105
 
356
357
 *** functionality.
357
358
 ***/
358
359
 
359
 
#if !defined( USE_X86_ASM ) && !defined( XFree86Server ) && !defined ( XGLServer )
360
 
#define NEED_FUNCTION_POINTER
 
360
#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
 
361
# define DISPATCH_FUNCTION_SIZE  16
 
362
#elif defined(USE_X86_ASM)
 
363
# if defined(THREADS) && !defined(GLX_USE_TLS)
 
364
#  define DISPATCH_FUNCTION_SIZE  32
 
365
# else
 
366
#  define DISPATCH_FUNCTION_SIZE  16
 
367
# endif
 
368
#endif
 
369
 
 
370
#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer)
 
371
# define NEED_FUNCTION_POINTER
361
372
#endif
362
373
 
363
374
/* The code in this file is auto-generated with Python */
407
418
extern const GLubyte gl_dispatch_functions_start[];
408
419
#endif
409
420
 
410
 
# if defined(THREADS) && !defined(GLX_USE_TLS)
411
 
#  define X86_DISPATCH_FUNCTION_SIZE  32
412
 
# else
413
 
#  define X86_DISPATCH_FUNCTION_SIZE  16
414
 
# endif
415
 
 
416
421
#endif /* USE_X86_ASM */
417
422
 
418
423
 
425
430
{
426
431
   const glprocs_table_t * const f = find_entry( funcName );
427
432
   if (f) {
428
 
#ifdef USE_X86_ASM
 
433
#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING)
 
434
      return (f->Address == NULL)
 
435
         ? (_glapi_proc) (gl_dispatch_functions_start
 
436
                          + (DISPATCH_FUNCTION_SIZE * f->Offset))
 
437
         : f->Address;
 
438
#elif defined(DISPATCH_FUNCTION_SIZE)
429
439
      return (_glapi_proc) (gl_dispatch_functions_start 
430
 
                            + (X86_DISPATCH_FUNCTION_SIZE * f->Offset));
 
440
                            + (DISPATCH_FUNCTION_SIZE * f->Offset));
431
441
#else
432
442
      return f->Address;
433
443
#endif
544
554
    * "jmp OFFSET*4(%eax)" can't be encoded in a single byte.
545
555
    */
546
556
   const GLubyte * const template_func = gl_dispatch_functions_start 
547
 
     + (X86_DISPATCH_FUNCTION_SIZE * 32);
548
 
   GLubyte * const code = (GLubyte *) malloc( X86_DISPATCH_FUNCTION_SIZE );
 
557
     + (DISPATCH_FUNCTION_SIZE * 32);
 
558
   GLubyte * const code = (GLubyte *) malloc(DISPATCH_FUNCTION_SIZE);
549
559
 
550
560
 
551
561
   if ( code != NULL ) {
552
 
      (void) memcpy( code, template_func, X86_DISPATCH_FUNCTION_SIZE );
 
562
      (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE);
553
563
      fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset );
554
564
   }
555
565
 
620
630
#if defined(USE_X86_ASM)
621
631
   GLubyte * const code = (GLubyte *) entrypoint;
622
632
 
623
 
#if X86_DISPATCH_FUNCTION_SIZE == 32
 
633
#if DISPATCH_FUNCTION_SIZE == 32
624
634
   *((unsigned int *)(code + 11)) = 4 * offset;
625
635
   *((unsigned int *)(code + 22)) = 4 * offset;
626
 
#elif X86_DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS )
 
636
#elif DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS )
627
637
   *((unsigned int *)(code +  8)) = 4 * offset;
628
 
#elif X86_DISPATCH_FUNCTION_SIZE == 16
 
638
#elif DISPATCH_FUNCTION_SIZE == 16
629
639
   *((unsigned int *)(code +  7)) = 4 * offset;
630
640
#else
631
 
# error Invalid X86_DISPATCH_FUNCTION_SIZE!
 
641
# error Invalid DISPATCH_FUNCTION_SIZE!
632
642
#endif
633
643
 
634
644
#elif defined(USE_SPARC_ASM)
988
998
      assert(blendColorOffset == offset);
989
999
   }
990
1000
   {
991
 
      GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT");
992
 
      char *istextureFunc = (char*) &table->IsTextureEXT;
993
 
      GLuint offset = (istextureFunc - (char *) table) / sizeof(void *);
994
 
      assert(istextureOffset == _gloffset_IsTextureEXT);
995
 
      assert(istextureOffset == offset);
996
 
   }
997
 
   {
998
1001
      GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
999
1002
      char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
1000
1003
      GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
1016
1019
      GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
1017
1020
      assert(setFenceOffset == _gloffset_SetFenceNV);
1018
1021
      assert(setFenceOffset == offset);
1019
 
      assert(_glapi_get_proc_address("glSetFenceNV") == (_glapi_proc) &glSetFenceNV);
1020
1022
   }
1021
1023
#else
1022
1024
   (void) table;
1041
1043
 
1042
1044
    while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
1043
1045
        (void) memcpy( curr_func, get_disp, 6 );
1044
 
        curr_func += X86_DISPATCH_FUNCTION_SIZE;
 
1046
        curr_func += DISPATCH_FUNCTION_SIZE;
1045
1047
    }
1046
1048
#endif /* defined( USE_X86_ASM ) && defined( GLX_USE_TLS ) */
1047
1049
}