summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/common/utils.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-07-28 00:29:51 +0000
committerIan Romanick <idr@us.ibm.com>2005-07-28 00:29:51 +0000
commit1585c234e0db4bfb7cd85c4111594f6da1582e6f (patch)
tree75ead6349c299291829a8a47fe437f6c22bc50da /src/mesa/drivers/dri/common/utils.c
parent9f23a3a1bff6c8af93e651273c9887bbf119f555 (diff)
Major rip-up of internal function insertion interface. The old
_glapi_add_entrypoint has been replaced by a new routine called _glapi_add_dispatch. This new routine dynamically assignes dispatch offsets to functions added. This allows IHVs to add support for extension functions that do not have assigned dispatch offsets. It also means that a driver has no idea what offset will be assigned to a function. The vast majority of the changes in this commit account for that. An additional table, driDispatchRemapTable, is added. Functions not in the Linux OpenGL ABI (i.e., anything not in GL 1.2 + ARB_multitexture) has a fixed offset in this new table. The entry in this table specifies the offset in of the function in the real dispatch table. The internal interface was also bumped from version 20050725 to 20050727. This has been tested with various programs in progs/demos on: radeon (Radeon Mobility M6) r128 (Rage 128 Pro) mga (G400)
Diffstat (limited to 'src/mesa/drivers/dri/common/utils.c')
-rw-r--r--src/mesa/drivers/dri/common/utils.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 41367b85d8..b6fb06ffac 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -34,6 +34,9 @@
#include "mtypes.h"
#include "extensions.h"
#include "utils.h"
+#include "dispatch.h"
+
+unsigned driDispatchRemapTable[ driDispatchRemapTable_size ];
#if defined(USE_X86_ASM)
#include "x86/common_x86_asm.h"
@@ -176,6 +179,30 @@ driGetRendererString( char * buffer, const char * hardware_name,
+#define need_GL_ARB_multisample
+#define need_GL_ARB_transpose_matrix
+#define need_GL_ARB_window_pos
+#define need_GL_EXT_compiled_vertex_array
+#define need_GL_EXT_polygon_offset
+#define need_GL_EXT_texture_object
+#define need_GL_EXT_vertex_array
+#define need_GL_MESA_window_pos
+
+#include "extension_helper.h"
+
+static const struct dri_extension all_mesa_extensions[] = {
+ { "GL_ARB_multisample", GL_ARB_multisample_functions },
+ { "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions },
+ { "GL_ARB_window_pos", GL_ARB_window_pos_functions },
+ { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions },
+ { "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions },
+ { "GL_EXT_texture_object", GL_EXT_texture_object_functions },
+ { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions },
+ { "GL_MESA_window_pos", GL_MESA_window_pos_functions },
+ { NULL, NULL }
+};
+
+
/**
* Enable extensions supported by the driver.
*
@@ -189,9 +216,15 @@ void driInitExtensions( GLcontext * ctx,
const struct dri_extension * extensions_to_enable,
GLboolean enable_imaging )
{
+ static int first_time = 1;
unsigned i;
- if ( enable_imaging ) {
+ if ( first_time ) {
+ first_time = 0;
+ driInitExtensions( ctx, all_mesa_extensions, GL_FALSE );
+ }
+
+ if ( (ctx != NULL) && enable_imaging ) {
_mesa_enable_imaging_extensions( ctx );
}
@@ -220,12 +253,14 @@ void driInitSingleExtension( GLcontext * ctx,
{
unsigned i;
+
if ( ext->functions != NULL ) {
for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) {
const char * functions[16];
const char * parameter_signature;
const char * str = ext->functions[i].strings;
unsigned j;
+ unsigned offset;
/* Separate the parameter signature from the rest of the string.
@@ -260,14 +295,23 @@ void driInitSingleExtension( GLcontext * ctx,
/* Add each entry-point to the dispatch table.
*/
- for ( j = 0 ; functions[j] != NULL ; j++ ) {
- _glapi_add_entrypoint( functions[j],
- ext->functions[i].offset );
+ offset = _glapi_add_dispatch( functions, parameter_signature );
+ if ( ext->functions[i].remap_index != -1 ) {
+ driDispatchRemapTable[ ext->functions[i].remap_index ] = offset;
+ }
+
+ if ( (ext->functions[i].offset != -1)
+ && (ext->functions[i].offset != offset) ) {
+ fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n", functions[0],
+ driDispatchRemapTable[ ext->functions[i].remap_index ],
+ ext->functions[i].offset);
}
}
}
- _mesa_enable_extension( ctx, ext->name );
+ if ( ctx != NULL ) {
+ _mesa_enable_extension( ctx, ext->name );
+ }
}