Fix the DRI swrast driver for big endian platforms.
[mesa.git] / src / mesa / drivers / dri / swrast / swrast.c
index a90b30b49d3ada7ba9bec46cbec029a6169a4c77..a858af30c1153ae1e1132526fdd980c560130b18 100644 (file)
@@ -63,7 +63,9 @@
 
 /* sw extensions not associated with some GL version */
 #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
@@ -94,7 +96,9 @@ const struct dri_extension card_extensions[] =
     { "GL_SGI_color_table",            GL_SGI_color_table_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 },
@@ -127,7 +131,7 @@ setupLoaderExtensions(__DRIscreen *psp,
     }
 }
 
-static const __DRIconfig **
+static __DRIconfig **
 swrastFillInModes(__DRIscreen *psp,
                  unsigned pixel_bits, unsigned depth_bits,
                  unsigned stencil_bits, GLboolean have_back_buffer)
@@ -147,6 +151,7 @@ swrastFillInModes(__DRIscreen *psp,
 
     uint8_t depth_bits_array[4];
     uint8_t stencil_bits_array[4];
+    uint8_t msaa_samples_array[1];
 
     depth_bits_array[0] = 0;
     depth_bits_array[1] = 0;
@@ -161,6 +166,8 @@ swrastFillInModes(__DRIscreen *psp,
     stencil_bits_array[2] = 0;
     stencil_bits_array[3] = (stencil_bits == 0) ? 8 : stencil_bits;
 
+    msaa_samples_array[0] = 0;
+
     depth_buffer_factor = 4;
     back_buffer_factor = 2;
 
@@ -190,14 +197,14 @@ swrastFillInModes(__DRIscreen *psp,
     configs = driCreateConfigs(fb_format, fb_type,
                               depth_bits_array, stencil_bits_array,
                               depth_buffer_factor, back_buffer_modes,
-                              back_buffer_factor);
+                              back_buffer_factor, msaa_samples_array, 1);
     if (configs == NULL) {
        fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
                __LINE__);
        return NULL;
     }
 
-    return (const __DRIconfig **)configs;
+    return configs;
 }
 
 static __DRIscreen *
@@ -206,7 +213,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
 {
     static const __DRIextension *emptyExtensionList[] = { NULL };
     __DRIscreen *psp;
-    const __DRIconfig **configs8, **configs16, **configs24, **configs32;
+    __DRIconfig **configs8, **configs16, **configs24, **configs32;
 
     (void) data;
 
@@ -228,7 +235,8 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
 
     configs16 = driConcatConfigs(configs8, configs16);
     configs24 = driConcatConfigs(configs16, configs24);
-    *driver_configs = driConcatConfigs(configs24, configs32);
+    *driver_configs = (const __DRIconfig **)
+       driConcatConfigs(configs24, configs32);
 
     driInitExtensions( NULL, card_extensions, GL_FALSE );
 
@@ -472,7 +480,7 @@ driDestroyDrawable(__DRIdrawable *buf)
        _mesa_free(buf->row);
 
        fb->DeletePending = GL_TRUE;
-       _mesa_unreference_framebuffer(&fb);
+       _mesa_reference_framebuffer(&fb, NULL);
     }
 }