Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / drivers / dri / tdfx / tdfx_context.c
index b4eea2566f6c15d3fbc8a70fe2f553af03f52318..63dfa5ae746687e139339f60354da475f9164da7 100644 (file)
@@ -43,9 +43,9 @@
 #include "tdfx_render.h"
 #include "tdfx_span.h"
 #include "tdfx_texman.h"
-#include "extensions.h"
-#include "hash.h"
-#include "texobj.h"
+#include "main/extensions.h"
+#include "main/hash.h"
+#include "main/texobj.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
 
 #include "utils.h"
 
-#define need_GL_ARB_multisample
 /* #define need_GL_ARB_point_parameters */
 #define need_GL_ARB_occlusion_query
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_buffer_object
 /* #define need_GL_ARB_vertex_program */
 #define need_GL_EXT_blend_equation_separate
 #define need_GL_EXT_blend_func_separate
 #define need_GL_EXT_blend_minmax
 #define need_GL_EXT_fog_coord
-#define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_paletted_texture
 /* #define need_GL_EXT_secondary_color */
-#define need_GL_IBM_multimode_draw_arrays
-/* #define need_GL_MESA_program_debug */
 /* #define need_GL_NV_vertex_program */
-#include "extension_helper.h"
+#include "main/remap_helper.h"
 
 
 /**
  * Common extension strings exported by all cards
  */
-const struct dri_extension card_extensions[] =
+static const struct dri_extension card_extensions[] =
 {
-    { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_occlusion_query",            GL_ARB_occlusion_query_functions },
     { "GL_ARB_texture_mirrored_repeat",    NULL },
-    { "GL_ARB_vertex_buffer_object",       GL_ARB_vertex_buffer_object_functions },
 
     { "GL_EXT_blend_func_separate",        GL_EXT_blend_func_separate_functions },
     { "GL_EXT_fog_coord",                  GL_EXT_fog_coord_functions },
-    { "GL_EXT_multi_draw_arrays",          GL_EXT_multi_draw_arrays_functions },
     { "GL_EXT_paletted_texture",           GL_EXT_paletted_texture_functions },
     { "GL_EXT_shared_texture_palette",     NULL },
     { "GL_EXT_stencil_wrap",               NULL },
     { "GL_EXT_texture_env_add",            NULL },
     { "GL_EXT_texture_lod_bias",           NULL },
-    { "GL_IBM_multimode_draw_arrays",      GL_IBM_multimode_draw_arrays_functions },
 
 #ifdef need_GL_ARB_point_parameters
     { "GL_ARB_point_parameters",           GL_ARB_point_parameters_functions },
@@ -110,9 +100,6 @@ const struct dri_extension card_extensions[] =
 #ifdef need_GL_NV_vertex_program
     { "GL_NV_vertex_program",              GL_NV_vertex_program_functions }
     { "GL_NV_vertex_program1_1",           NULL },
-#endif
-#ifdef need_GL_MESA_program_debug
-    { "GL_MESA_program_debug",             GL_MESA_program_debug_functions },
 #endif
     { NULL,                                NULL }
 };
@@ -120,9 +107,8 @@ const struct dri_extension card_extensions[] =
 /**
  * Extension strings exported only by Naplam (e.g., Voodoo4 & Voodoo5) cards.
  */
-const struct dri_extension napalm_extensions[] =
+static const struct dri_extension napalm_extensions[] =
 {
-    { "GL_ARB_texture_compression",        GL_ARB_texture_compression_functions },
     { "GL_ARB_texture_env_combine",        NULL },
     { "GL_EXT_blend_equation_separate",    GL_EXT_blend_equation_separate_functions },
     { "GL_EXT_blend_subtract",             GL_EXT_blend_minmax_functions },
@@ -138,7 +124,7 @@ const struct dri_extension napalm_extensions[] =
 /*
  * Enable/Disable the extensions for this context.
  */
-static void tdfxDDInitExtensions( GLcontext *ctx )
+static void tdfxDDInitExtensions( struct gl_context *ctx )
 {
    tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
 
@@ -150,8 +136,6 @@ static void tdfxDDInitExtensions( GLcontext *ctx )
 
    if ( TDFX_IS_NAPALM( fxMesa ) ) {
       driInitExtensions( ctx, napalm_extensions, GL_FALSE );
-   } else {
-      _mesa_enable_extension( ctx, "GL_SGIS_generate_mipmap" );
    }
 }
 
@@ -178,13 +162,14 @@ static const struct dri_debug_control debug_control[] =
     { NULL,    0 }
 };
 
-GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
-                            __DRIcontextPrivate *driContextPriv,
+GLboolean tdfxCreateContext( gl_api api,
+                            const struct gl_config *mesaVis,
+                            __DRIcontext *driContextPriv,
                              void *sharedContextPrivate )
 {
    tdfxContextPtr fxMesa;
-   GLcontext *ctx, *shareCtx;
-   __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+   struct gl_context *ctx, *shareCtx;
+   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
    tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
    TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA +
                                              sizeof(drm_sarea_t));
@@ -319,6 +304,8 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
    ctx->Const.MaxLineWidthAA = 1.0;
    ctx->Const.LineWidthGranularity = 1.0;
 
+   ctx->Const.MaxDrawBuffers = 1;
+
    /* Initialize the software rasterizer and helper modules.
     */
    _swrast_CreateContext( ctx );
@@ -453,7 +440,7 @@ static GLboolean tdfxInitVertexFormats( tdfxContextPtr fxMesa )
  * Initialize the state in an tdfxContextPtr struct.
  */
 static GLboolean
-tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa )
+tdfxInitContext( __DRIdrawable *driDrawPriv, tdfxContextPtr fxMesa )
 {
    /* KW: Would be nice to make one of these a member of the other.
     */
@@ -575,7 +562,7 @@ tdfxInitContext( __DRIdrawablePrivate *driDrawPriv, tdfxContextPtr fxMesa )
 
 
 void
-tdfxDestroyContext( __DRIcontextPrivate *driContextPriv )
+tdfxDestroyContext( __DRIcontext *driContextPriv )
 {
    tdfxContextPtr fxMesa = (tdfxContextPtr) driContextPriv->driverPrivate;
 
@@ -619,7 +606,7 @@ tdfxDestroyContext( __DRIcontextPrivate *driContextPriv )
 
 
 GLboolean
-tdfxUnbindContext( __DRIcontextPrivate *driContextPriv )
+tdfxUnbindContext( __DRIcontext *driContextPriv )
 {
    GET_CURRENT_CONTEXT(ctx);
    tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
@@ -638,9 +625,9 @@ tdfxUnbindContext( __DRIcontextPrivate *driContextPriv )
 
 
 GLboolean
-tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
-                 __DRIdrawablePrivate *driDrawPriv,
-                 __DRIdrawablePrivate *driReadPriv )
+tdfxMakeCurrent( __DRIcontext *driContextPriv,
+                 __DRIdrawable *driDrawPriv,
+                 __DRIdrawable *driReadPriv )
 {
    if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
       fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driContextPriv );
@@ -648,7 +635,7 @@ tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
 
    if ( driContextPriv ) {
       tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate;
-      GLcontext *newCtx = newFx->glCtx;
+      struct gl_context *newCtx = newFx->glCtx;
       GET_CURRENT_CONTEXT(curCtx);
 
       if ((newFx->driDrawable != driDrawPriv)
@@ -664,8 +651,8 @@ tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
              * dispatch is set correctly.
              */
             _mesa_make_current( newCtx,
-                                (GLframebuffer *) driDrawPriv->driverPrivate,
-                                (GLframebuffer *) driReadPriv->driverPrivate );
+                                (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+                                (struct gl_framebuffer *) driReadPriv->driverPrivate );
             return GL_TRUE;
         }
         /* [dBorca] tunnel2 requires this */
@@ -702,8 +689,8 @@ tdfxMakeCurrent( __DRIcontextPrivate *driContextPriv,
       }
 
       _mesa_make_current( newCtx,
-                          (GLframebuffer *) driDrawPriv->driverPrivate,
-                          (GLframebuffer *) driReadPriv->driverPrivate );
+                          (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+                          (struct gl_framebuffer *) driReadPriv->driverPrivate );
    } else {
       _mesa_make_current( NULL, NULL, NULL );
    }