summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/glapi/glapi.c67
1 files changed, 26 insertions, 41 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 70a122eca4..6800205530 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -286,14 +286,14 @@ _glapi_get_context(void)
/**
* Set the global or per-thread dispatch table pointer.
+ * If the dispatch parameter is NULL we'll plug in the no-op dispatch
+ * table (__glapi_noop_table).
*/
PUBLIC void
_glapi_set_dispatch(struct _glapi_table *dispatch)
{
#if defined(PTHREADS) || defined(GLX_USE_TLS)
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
-
pthread_once( & once_control, init_glapi_relocs );
#endif
@@ -326,7 +326,6 @@ PUBLIC struct _glapi_table *
_glapi_get_dispatch(void)
{
struct _glapi_table * api;
-
#if defined(GLX_USE_TLS)
api = _glapi_tls_Dispatch;
#elif defined(THREADS)
@@ -336,11 +335,16 @@ _glapi_get_dispatch(void)
#else
api = _glapi_Dispatch;
#endif
-
return api;
}
+
+/***
+ *** The rest of this file is pretty much concerned with GetProcAddress
+ *** functionality.
+ ***/
+
#if !defined( USE_X86_ASM ) && !defined( XFree86Server ) && !defined ( XGLServer )
#define NEED_FUNCTION_POINTER
#endif
@@ -357,13 +361,10 @@ static const glprocs_table_t *
find_entry( const char * n )
{
GLuint i;
-
for (i = 0; static_functions[i].Name_offset >= 0; i++) {
- const char * test_name;
-
- test_name = gl_string_table + static_functions[i].Name_offset;
- if (strcmp(test_name, n) == 0) {
- return & static_functions[i];
+ const char *testName = gl_string_table + static_functions[i].Name_offset;
+ if (strcmp(testName, n) == 0) {
+ return &static_functions[i];
}
}
return NULL;
@@ -378,15 +379,14 @@ static GLint
get_static_proc_offset(const char *funcName)
{
const glprocs_table_t * const f = find_entry( funcName );
-
- if ( f != NULL ) {
+ if (f) {
return f->Offset;
}
return -1;
}
-#if !defined( XFree86Server ) && !defined( XGLServer )
+#if !defined(XFree86Server) && !defined(XGLServer)
#ifdef USE_X86_ASM
#if defined( GLX_USE_TLS )
@@ -402,41 +402,32 @@ extern const GLubyte gl_dispatch_functions_start[];
# define X86_DISPATCH_FUNCTION_SIZE 16
# endif
+#endif /* USE_X86_ASM */
+
/**
- * Return dispatch function address the named static (built-in) function.
+ * Return dispatch function address for the named static (built-in) function.
* Return NULL if function not found.
*/
static const _glapi_proc
get_static_proc_address(const char *funcName)
{
const glprocs_table_t * const f = find_entry( funcName );
-
- if ( f != NULL ) {
+ if (f) {
+#ifdef USE_X86_ASM
return (_glapi_proc) (gl_dispatch_functions_start
+ (X86_DISPATCH_FUNCTION_SIZE * f->Offset));
+#else
+ return f->Address;
+#endif
}
else {
return NULL;
}
}
-#else
-
-
-/**
- * Return pointer to the named static (built-in) function.
- * \return NULL if function not found.
- */
-static const _glapi_proc
-get_static_proc_address(const char *funcName)
-{
- const glprocs_table_t * const f = find_entry( funcName );
- return ( f != NULL ) ? f->Address : NULL;
-}
+#endif /* !defined(XFree86Server) && !defined(XGLServer) */
-#endif /* USE_X86_ASM */
-#endif /* !defined( XFree86Server ) */
/**
@@ -447,7 +438,6 @@ static const char *
get_static_proc_name( GLuint offset )
{
GLuint i;
-
for (i = 0; static_functions[i].Name_offset >= 0; i++) {
if (static_functions[i].Offset == offset) {
return gl_string_table + static_functions[i].Name_offset;
@@ -577,7 +567,7 @@ generate_entrypoint(GLuint functionOffset)
0x81c0c000, /* jmpl %g3, %g0 */
0x01000000 /* nop */
};
-#endif
+#endif /* __arch64__ */
unsigned int *code = (unsigned int *) malloc(sizeof(insn_template));
unsigned long glapi_addr = (unsigned long) &_glapi_Dispatch;
if (code) {
@@ -599,7 +589,7 @@ generate_entrypoint(GLuint functionOffset)
__glapi_sparc_icache_flush(&code[0]);
code[2] |= (functionOffset * 4);
__glapi_sparc_icache_flush(&code[2]);
-#endif
+#endif /* __arch64__ */
}
return (_glapi_proc) code;
#else
@@ -619,7 +609,6 @@ fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
#if defined(USE_X86_ASM)
GLubyte * const code = (GLubyte *) entrypoint;
-
#if X86_DISPATCH_FUNCTION_SIZE == 32
*((unsigned int *)(code + 11)) = 4 * offset;
*((unsigned int *)(code + 22)) = 4 * offset;
@@ -809,13 +798,11 @@ _glapi_add_dispatch( const char * const * function_names,
}
}
-
if (offset == ~0) {
offset = next_dynamic_offset;
next_dynamic_offset++;
}
-
for ( i = 0 ; function_names[i] != NULL ; i++ ) {
if (! is_static[i] ) {
if (entry[i] == NULL) {
@@ -827,7 +814,6 @@ _glapi_add_dispatch( const char * const * function_names,
}
}
-
entry[i]->parameter_signature = str_dup(real_sig);
fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset);
entry[i]->dispatch_offset = offset;
@@ -851,7 +837,6 @@ _glapi_get_proc_offset(const char *funcName)
return ExtEntryTable[i].dispatch_offset;
}
}
-
/* search static functions */
return get_static_proc_offset(funcName);
}