Merge commit 'mesa_7_6_branch' into mesa_7_7_branch
[mesa.git] / src / mesa / drivers / dri / swrast / swrast.c
index cd499cd5d2e2769f4880d58e82563f1bd05143a9..8340861aff8b5715259312f51639046e7b3fa086 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "main/context.h"
 #include "main/extensions.h"
+#include "main/formats.h"
 #include "main/framebuffer.h"
 #include "main/imports.h"
 #include "main/renderbuffer.h"
 #include "swrast_priv.h"
 
 
-#define need_GL_VERSION_1_3
-#define need_GL_VERSION_1_4
-#define need_GL_VERSION_1_5
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-
-/* 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_draw_elements_base_vertex
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_vertex_array_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_sync
-#define need_GL_APPLE_vertex_array_object
-#define need_GL_ATI_fragment_shader
-#define need_GL_ATI_separate_stencil
-#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_EXT_stencil_two_side
-#define need_GL_MESA_resize_buffers
-#define need_GL_NV_vertex_program
-#define need_GL_NV_fragment_program
-
-#include "extension_helper.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_VERSION_2_1",                        GL_VERSION_2_1_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_depth_clamp",            NULL },
-    { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions },
-    { "GL_ARB_shader_objects",         GL_ARB_shader_objects_functions },
-    { "GL_ARB_vertex_array_object",    GL_ARB_vertex_array_object_functions },
-    { "GL_ARB_vertex_program",         GL_ARB_vertex_program_functions },
-    { "GL_ARB_sync",                   GL_ARB_sync_functions },
-    { "GL_APPLE_vertex_array_object",  GL_APPLE_vertex_array_object_functions },
-    { "GL_ATI_fragment_shader",                GL_ATI_fragment_shader_functions },
-    { "GL_ATI_separate_stencil",       GL_ATI_separate_stencil_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_EXT_stencil_two_side",       GL_EXT_stencil_two_side_functions },
-    { "GL_MESA_resize_buffers",                GL_MESA_resize_buffers_functions },
-    { "GL_NV_depth_clamp",             NULL },
-    { "GL_NV_vertex_program",          GL_NV_vertex_program_functions },
-    { "GL_NV_fragment_program",                GL_NV_fragment_program_functions },
-    { NULL,                            NULL }
-};
-
-
 /**
  * Screen and config-related functions
  */
@@ -243,7 +173,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
     *driver_configs = (const __DRIconfig **)
        driConcatConfigs(configs24, configs32);
 
-    driInitExtensions( NULL, card_extensions, GL_FALSE );
+    driInitExtensions( NULL, NULL, GL_FALSE );
 
     return psp;
 }
@@ -377,50 +307,38 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
 
     switch (pixel_format) {
     case PF_A8R8G8B8:
+       xrb->Base.Format = MESA_FORMAT_ARGB8888;
        xrb->Base.InternalFormat = GL_RGBA;
        xrb->Base._BaseFormat = GL_RGBA;
        xrb->Base.DataType = GL_UNSIGNED_BYTE;
-       xrb->Base.RedBits   = 8 * sizeof(GLubyte);
-       xrb->Base.GreenBits = 8 * sizeof(GLubyte);
-       xrb->Base.BlueBits  = 8 * sizeof(GLubyte);
-       xrb->Base.AlphaBits = 8 * sizeof(GLubyte);
        xrb->bpp = 32;
        break;
     case PF_X8R8G8B8:
+       xrb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX */
        xrb->Base.InternalFormat = GL_RGB;
        xrb->Base._BaseFormat = GL_RGB;
        xrb->Base.DataType = GL_UNSIGNED_BYTE;
-       xrb->Base.RedBits   = 8 * sizeof(GLubyte);
-       xrb->Base.GreenBits = 8 * sizeof(GLubyte);
-       xrb->Base.BlueBits  = 8 * sizeof(GLubyte);
-       xrb->Base.AlphaBits = 0;
        xrb->bpp = 32;
        break;
     case PF_R5G6B5:
+       xrb->Base.Format = MESA_FORMAT_RGB565;
        xrb->Base.InternalFormat = GL_RGB;
        xrb->Base._BaseFormat = GL_RGB;
        xrb->Base.DataType = GL_UNSIGNED_BYTE;
-       xrb->Base.RedBits   = 5 * sizeof(GLubyte);
-       xrb->Base.GreenBits = 6 * sizeof(GLubyte);
-       xrb->Base.BlueBits  = 5 * sizeof(GLubyte);
-       xrb->Base.AlphaBits = 0;
        xrb->bpp = 16;
        break;
     case PF_R3G3B2:
+       xrb->Base.Format = MESA_FORMAT_RGB332;
        xrb->Base.InternalFormat = GL_RGB;
        xrb->Base._BaseFormat = GL_RGB;
        xrb->Base.DataType = GL_UNSIGNED_BYTE;
-       xrb->Base.RedBits   = 3 * sizeof(GLubyte);
-       xrb->Base.GreenBits = 3 * sizeof(GLubyte);
-       xrb->Base.BlueBits  = 2 * sizeof(GLubyte);
-       xrb->Base.AlphaBits = 0;
        xrb->bpp = 8;
        break;
     case PF_CI8:
+       xrb->Base.Format = MESA_FORMAT_CI8;
        xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT;
        xrb->Base._BaseFormat = GL_COLOR_INDEX;
        xrb->Base.DataType = GL_UNSIGNED_BYTE;
-       xrb->Base.IndexBits = 8 * sizeof(GLubyte);
        xrb->bpp = 8;
        break;
     default: