mga: enable GL_ARB_vertex_array_object extension
[mesa.git] / src / mesa / drivers / dri / mga / mga_xmesa.c
index 428afa589511fe912506e09c2622dba4f0dbadc7..6ec99dbc3ba79ae6039dd3cb00c459e310230af4 100644 (file)
@@ -35,7 +35,6 @@
 #include "mga_drm.h"
 #include "mga_xmesa.h"
 #include "main/context.h"
-#include "main/matrix.h"
 #include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/framebuffer.h"
 #include "mgatris.h"
 #include "mgavb.h"
 #include "mgapixel.h"
-#include "mga_xmesa.h"
 #include "mga_dri.h"
 
 #include "utils.h"
 #include "vblank.h"
 
-#include "main/extensions.h"
 #include "drirenderbuffer.h"
 
 #include "GL/internal/dri_interface.h"
 
+#define need_GL_ARB_vertex_array_object
 #define need_GL_ARB_vertex_program
 #define need_GL_EXT_fog_coord
 #define need_GL_EXT_gpu_program_parameters
@@ -113,7 +111,7 @@ mgaFillInModes( __DRIscreen *psp,
                unsigned stencil_bits, GLboolean have_back_buffer )
 {
     __DRIconfig **configs;
-    __GLcontextModes * m;
+    struct gl_config * m;
     unsigned depth_buffer_factor;
     unsigned back_buffer_factor;
     GLenum fb_format;
@@ -162,7 +160,7 @@ mgaFillInModes( __DRIscreen *psp,
                               depth_bits_array, stencil_bits_array,
                               depth_buffer_factor,
                               back_buffer_modes, back_buffer_factor,
-                               msaa_samples_array, 1);
+                               msaa_samples_array, 1, GL_TRUE);
     if (configs == NULL) {
        fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
                 __func__, __LINE__ );
@@ -184,7 +182,6 @@ mgaFillInModes( __DRIscreen *psp,
 const __DRIextension *mgaScreenExtensions[] = {
     &driReadDrawableExtension,
     &driSwapControlExtension.base,
-    &driFrameTrackingExtension.base,
     &driMediaStreamCounterExtension.base,
     NULL
 };
@@ -386,6 +383,7 @@ static const struct dri_extension g400_extensions[] =
 static const struct dri_extension card_extensions[] =
 {
    { "GL_ARB_texture_rectangle",      NULL },
+   { "GL_ARB_vertex_array_object",    GL_ARB_vertex_array_object_functions },
    { "GL_EXT_blend_logic_op",         NULL },
    { "GL_EXT_fog_coord",              GL_EXT_fog_coord_functions },
    /* paletted_textures currently doesn't work, but we could fix them later */
@@ -397,7 +395,6 @@ static const struct dri_extension card_extensions[] =
    { "GL_EXT_stencil_wrap",           NULL },
    { "GL_APPLE_vertex_array_object",  GL_APPLE_vertex_array_object_functions },
    { "GL_MESA_ycbcr_texture",         NULL },
-   { "GL_SGIS_generate_mipmap",       NULL },
    { NULL,                            NULL }
 };
 
@@ -425,13 +422,14 @@ static const struct dri_debug_control debug_control[] =
 
 
 static GLboolean
-mgaCreateContext( const __GLcontextModes *mesaVis,
+mgaCreateContext( gl_api api,
+                 const struct gl_config *mesaVis,
                   __DRIcontext *driContextPriv,
                   void *sharedContextPrivate )
 {
    int i;
    unsigned   maxlevels;
-   GLcontext *ctx, *shareCtx;
+   struct gl_context *ctx, *shareCtx;
    mgaContextPtr mmesa;
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
    mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
@@ -461,7 +459,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
       shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx;
    else 
       shareCtx = NULL;
-   mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
+   mmesa->glCtx = _mesa_create_context(API_OPENGL, mesaVis, shareCtx,
                                        &functions, (void *) mmesa);
    if (!mmesa->glCtx) {
       FREE(mmesa);
@@ -699,7 +697,7 @@ mgaDestroyContext(__DRIcontext *driContextPriv)
 static GLboolean
 mgaCreateBuffer( __DRIscreen *driScrnPriv,
                  __DRIdrawable *driDrawPriv,
-                 const __GLcontextModes *mesaVis,
+                 const struct gl_config *mesaVis,
                  GLboolean isPixmap )
 {
    mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private;
@@ -816,7 +814,7 @@ mgaCreateBuffer( __DRIscreen *driScrnPriv,
 static void
 mgaDestroyBuffer(__DRIdrawable *driDrawPriv)
 {
-   _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+   _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
 }
 
 static void
@@ -824,7 +822,7 @@ mgaSwapBuffers(__DRIdrawable *dPriv)
 {
    if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
       mgaContextPtr mmesa;
-      GLcontext *ctx;
+      struct gl_context *ctx;
       mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
       ctx = mmesa->glCtx;
 
@@ -879,8 +877,8 @@ mgaMakeCurrent(__DRIcontext *driContextPriv,
       mmesa->driReadable = driReadPriv;
 
       _mesa_make_current(mmesa->glCtx,
-                         (GLframebuffer *) driDrawPriv->driverPrivate,
-                         (GLframebuffer *) driReadPriv->driverPrivate);
+                         (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+                         (struct gl_framebuffer *) driReadPriv->driverPrivate);
    }
    else {
       _mesa_make_current(NULL, NULL, NULL);
@@ -929,7 +927,7 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags )
  * 
  * \todo maybe fold this into intelInitDriver
  *
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
  */
 static const __DRIconfig **mgaInitScreen(__DRIscreen *psp)
 {
@@ -998,3 +996,10 @@ const struct __DriverAPIRec driDriverAPI = {
    .WaitForSBC      = NULL,
    .SwapBuffersMSC  = NULL
 };
+
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+    &driCoreExtension.base,
+    &driLegacyExtension.base,
+    NULL
+};