mesa: Enable remap table in core.
[mesa.git] / src / mesa / drivers / x11 / xm_api.c
index 2a8c3a4fd36c44f44668c9f0f43f41935e2109fa..bf767bceddf28e387de4290a8e65877729cf23ae 100644 (file)
@@ -79,6 +79,7 @@
 #include "tnl/t_context.h"
 #include "tnl/t_pipeline.h"
 #include "drivers/common/driverfuncs.h"
+#include "drivers/common/meta.h"
 
 /**
  * Global X driver lock
@@ -1302,65 +1303,6 @@ 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_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_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
@@ -1406,14 +1348,6 @@ 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")) {
@@ -1584,6 +1518,14 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
       return NULL;
    }
 
+   /* Enable this to exercise fixed function -> shader translation
+    * with software rendering.
+    */
+   if (0) {
+      mesaCtx->VertexProgram._MaintainTnlProgram = GL_TRUE;
+      mesaCtx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
+   }
+
    _mesa_enable_sw_extensions(mesaCtx);
    _mesa_enable_1_3_extensions(mesaCtx);
    _mesa_enable_1_4_extensions(mesaCtx);
@@ -1633,6 +1575,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    xmesa_register_swrast_functions( mesaCtx );
    _swsetup_Wakeup(mesaCtx);
 
+   _mesa_meta_init(mesaCtx);
+
    return c;
 }
 
@@ -1647,6 +1591,8 @@ void XMesaDestroyContext( XMesaContext c )
    FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) );
 #endif
 
+   _mesa_meta_free( mesaCtx );
+
    _swsetup_DestroyContext( mesaCtx );
    _swrast_DestroyContext( mesaCtx );
    _tnl_DestroyContext( mesaCtx );
@@ -2410,11 +2356,8 @@ xbuffer_to_renderbuffer(int buffer)
    case GLX_AUX0_EXT:
       return BUFFER_AUX0;
    case GLX_AUX1_EXT:
-      return BUFFER_AUX1;
    case GLX_AUX2_EXT:
-      return BUFFER_AUX2;
    case GLX_AUX3_EXT:
-      return BUFFER_AUX3;
    case GLX_AUX4_EXT:
    case GLX_AUX5_EXT:
    case GLX_AUX6_EXT:
@@ -2461,13 +2404,13 @@ XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
 #if 0
    switch (drawable->TextureTarget) {
    case GLX_TEXTURE_1D_EXT:
-      texObj = texUnit->Current1D;
+      texObj = texUnit->CurrentTex[TEXTURE_1D_INDEX];
       break;
    case GLX_TEXTURE_2D_EXT:
-      texObj = texUnit->Current2D;
+      texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX];
       break;
    case GLX_TEXTURE_RECTANGLE_EXT:
-      texObj = texUnit->CurrentRect;
+      texObj = texUnit->CurrentTex[TEXTURE_RECT_INDEX];
       break;
    default:
       return; /* BadMatch error */