glcore: tree sharing for DRI and XMesa
authorGeorge Sapountzis <gsap7@yahoo.gr>
Fri, 18 Apr 2008 14:34:45 +0000 (17:34 +0300)
committerGeorge Sapountzis <gsap7@yahoo.gr>
Wed, 23 Apr 2008 08:12:30 +0000 (11:12 +0300)
configs/freebsd-dri
configs/linux-dri
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/xorg/Makefile

index 9d9215483d95ee548ab204e3bfe06002b2d162e4..bb8fb4a3b4a859a88b6e61611138bddc69b053d6 100644 (file)
@@ -34,6 +34,7 @@ LIBDRM_LIB = `pkg-config --libs libdrm`
 DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
 GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
        -lm -pthread $(LIBDRM_LIB)
+GLCORE_LIB_DEPS = -lm -pthread
 
 GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
 GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
index 0133eac95de46c0fe97fff59c11033ab40654737..b4889d0176d011c329e32580c4dfdd17914760d9 100644 (file)
@@ -47,8 +47,8 @@ LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
 LIBDRM_LIB = `pkg-config --libs libdrm`
 DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
 GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-               -lm -lpthread -ldl \
-                $(LIBDRM_LIB)
+               -lm -lpthread -ldl $(LIBDRM_LIB)
+GLCORE_LIB_DEPS = -lm -lpthread -ldl
 
 
 # This is now 0 by default since it seems to confuse the hell out of people
index e606bb1191da542c59578cd3439dfc83cd1fb74d..894181753176bb66100c7dbcc18fbf59d0db4b24 100644 (file)
@@ -1303,6 +1303,67 @@ xmesa_convert_from_x_visual_type( int visualType )
 /**********************************************************************/
 
 
+#ifdef IN_DRI_DRIVER
+#define need_GL_VERSION_1_3
+#define need_GL_VERSION_1_4
+#define need_GL_VERSION_1_5
+#define need_GL_VERSION_2_0
+
+/* sw extensions for imaging */
+#define need_GL_EXT_blend_color
+#define need_GL_EXT_blend_minmax
+#define need_GL_EXT_convolution
+#define need_GL_EXT_histogram
+#define need_GL_SGI_color_table
+
+/* sw extensions not associated with some GL version */
+#define need_GL_ARB_shader_objects
+#define need_GL_ARB_vertex_program
+#define need_GL_APPLE_vertex_array_object
+#define need_GL_ATI_fragment_shader
+#define need_GL_EXT_depth_bounds_test
+#define need_GL_EXT_framebuffer_object
+#define need_GL_EXT_framebuffer_blit
+#define need_GL_EXT_gpu_program_parameters
+#define need_GL_EXT_paletted_texture
+#define need_GL_IBM_multimode_draw_arrays
+#define need_GL_MESA_resize_buffers
+#define need_GL_NV_vertex_program
+#define need_GL_NV_fragment_program
+
+#include "extension_helper.h"
+#include "utils.h"
+
+const struct dri_extension card_extensions[] =
+{
+   { "GL_VERSION_1_3",                 GL_VERSION_1_3_functions },
+   { "GL_VERSION_1_4",                 GL_VERSION_1_4_functions },
+   { "GL_VERSION_1_5",                 GL_VERSION_1_5_functions },
+   { "GL_VERSION_2_0",                 GL_VERSION_2_0_functions },
+
+   { "GL_EXT_blend_color",             GL_EXT_blend_color_functions },
+   { "GL_EXT_blend_minmax",            GL_EXT_blend_minmax_functions },
+   { "GL_EXT_convolution",             GL_EXT_convolution_functions },
+   { "GL_EXT_histogram",               GL_EXT_histogram_functions },
+   { "GL_SGI_color_table",             GL_SGI_color_table_functions },
+
+   { "GL_ARB_shader_objects",          GL_ARB_shader_objects_functions },
+   { "GL_ARB_vertex_program",          GL_ARB_vertex_program_functions },
+   { "GL_APPLE_vertex_array_object",   GL_APPLE_vertex_array_object_functions },
+   { "GL_ATI_fragment_shader",         GL_ATI_fragment_shader_functions },
+   { "GL_EXT_depth_bounds_test",       GL_EXT_depth_bounds_test_functions },
+   { "GL_EXT_framebuffer_object",      GL_EXT_framebuffer_object_functions },
+   { "GL_EXT_framebuffer_blit",                GL_EXT_framebuffer_blit_functions },
+   { "GL_EXT_gpu_program_parameters",  GL_EXT_gpu_program_parameters_functions },
+   { "GL_EXT_paletted_texture",                GL_EXT_paletted_texture_functions },
+   { "GL_IBM_multimode_draw_arrays",   GL_IBM_multimode_draw_arrays_functions },
+   { "GL_MESA_resize_buffers",         GL_MESA_resize_buffers_functions },
+   { "GL_NV_vertex_program",           GL_NV_vertex_program_functions },
+   { "GL_NV_fragment_program",         GL_NV_fragment_program_functions },
+   { NULL,                             NULL }
+};
+#endif
+
 /*
  * Create a new X/Mesa visual.
  * Input:  display - X11 display
@@ -1348,6 +1409,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
    XMesaVisual v;
    GLint red_bits, green_bits, blue_bits, alpha_bits;
 
+#ifdef IN_DRI_DRIVER
+   /* driInitExtensions() should be called once per screen to setup extension
+    * indices.  There is no need to call it when the context is created since
+    * XMesa enables mesa sw extensions on its own.
+    */
+   driInitExtensions( NULL, card_extensions, GL_FALSE );
+#endif
+
 #ifndef XFree86Server
    /* For debugging only */
    if (_mesa_getenv("MESA_XSYNC")) {
@@ -1525,7 +1594,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    _mesa_enable_2_0_extensions(mesaCtx);
    _mesa_enable_2_1_extensions(mesaCtx);
 #if ENABLE_EXT_texure_compression_s3tc
-    if (c->Mesa_DXTn) {
+    if (mesaCtx->Mesa_DXTn) {
        _mesa_enable_extension(mesaCtx, "GL_EXT_texture_compression_s3tc");
        _mesa_enable_extension(mesaCtx, "GL_S3_s3tc");
     }
index 7fd7036665bc738f81a935a6f4b07d0e7ac993cb..72781824460cccae511e09dbc8afed45ee920da3 100644 (file)
@@ -32,6 +32,9 @@ C_SOURCES =           \
 MESA_MODULES = $(TOP)/src/mesa/libmesa.a
 
 C_SOURCES += ../common/driverfuncs.c
+ifeq ("${DRIVER_DIRS}", "dri")
+C_SOURCES += ../dri/common/utils.c
+endif
 
 OBJECTS = $(C_SOURCES:.c=.o)
 
@@ -45,6 +48,12 @@ INCLUDES = \
        -I$(TOP)/src/mesa/glapi \
        `pkg-config --cflags xorg-server`
 
+ifeq ("${DRIVER_DIRS}", "dri")
+INCLUDES += \
+       -I$(TOP)/src/mesa/drivers/dri/common \
+       `pkg-config --cflags libdrm`
+endif
+
 # undef 'USE_XSHM' to make it explicit that 'XFree86Server' takes precedence
 DRIVER_DEFINES = -UUSE_XSHM -DXFree86Server