summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-08-05 18:13:37 +0000
committerIan Romanick <[email protected]>2005-08-05 18:13:37 +0000
commit126c89e35fb5179fe077f7593f31ea874c89dd65 (patch)
treecd9daa0454bd2968044376698bfe517b75889066 /src/mesa/drivers/dri/common
parent33f5e47faf4ee545ac1f7755da652c7e003d0589 (diff)
Fix recent problems with display lists and other parts of the code.
CALL_by_offset, SET_by_offset, and GET_by_offset all had various problems. The core issue is that parts of the device-independent code in Mesa assumes that all functions have slots in the dispatch table. This is especially true in the display list code. It will merrilly try to set dispatch pointers for glVertexAttrib1fARB even if GL_ARB_vertex_program is not supported. When the GET/SET/CALL macros are invoked, they would read a 0 from the remap table. The problem is that 0 is the dispatch offset for glNewList! One change is that the remap table is now initialized to be full of -1 values. In addtion, all of the *_by_offset marcos misbehave in an obvious way if the specified offset is -1. SET_by_offset will do nothing, GET_by_offset will return NULL, and CALL_by_offset, since it uses GET_by_offset, will segfault. I also had to add GL_EXT_blend_func_separate to the list of default extensions in all_mesa_extensions (src/mesa/drivers/dri/common/utils.c). Even though many drivers do not export this extension, glBlendFunc is internally implemented by calling glBlendFuncSeparate. Without this addition, glBlendFunc stopped working on drivers (such as mga) that do not export GL_EXT_blend_func_separate. There are still a few assertions / crashes in GL_ARB_vertex_program tests, but I don't think that these are related to any of my changes.
Diffstat (limited to 'src/mesa/drivers/dri/common')
-rw-r--r--src/mesa/drivers/dri/common/utils.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index b6fb06ffac9..7ae7f284ee9 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -36,7 +36,7 @@
#include "utils.h"
#include "dispatch.h"
-unsigned driDispatchRemapTable[ driDispatchRemapTable_size ];
+int driDispatchRemapTable[ driDispatchRemapTable_size ];
#if defined(USE_X86_ASM)
#include "x86/common_x86_asm.h"
@@ -188,12 +188,18 @@ driGetRendererString( char * buffer, const char * hardware_name,
#define need_GL_EXT_vertex_array
#define need_GL_MESA_window_pos
+/* This is needed in *all* drivers because Mesa internally implements
+ * glBlendFunc by calling glBlendFuncSeparateEXT.
+ */
+#define need_GL_EXT_blend_func_separate
+
#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_blend_func_separate", GL_EXT_blend_func_separate_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 },
@@ -220,6 +226,10 @@ void driInitExtensions( GLcontext * ctx,
unsigned i;
if ( first_time ) {
+ for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) {
+ driDispatchRemapTable[i] = -1;
+ }
+
first_time = 0;
driInitExtensions( ctx, all_mesa_extensions, GL_FALSE );
}