dri: Add DRI entrypoints to create a context for a given API
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_context.c
index 8f4485aee7c00891df92579d177f776c40dbe73c..ee65d7ff3d06ca364886fd39d149b60b3aba61a5 100644 (file)
@@ -39,10 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/context.h"
 #include "main/simple_list.h"
 #include "main/imports.h"
-#include "main/matrix.h"
 #include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/state.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -61,25 +58,24 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "radeon_tex.h"
 #include "radeon_swtcl.h"
 #include "radeon_tcl.h"
-#include "radeon_maos.h"
 #include "radeon_queryobj.h"
+#include "radeon_blit.h"
 
 #define need_GL_ARB_occlusion_query
 #define need_GL_EXT_blend_minmax
 #define need_GL_EXT_fog_coord
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_framebuffer_object
-#include "extension_helper.h"
+#include "main/remap_helper.h"
 
 #define DRIVER_DATE    "20061018"
 
-#include "vblank.h"
 #include "utils.h"
 #include "xmlpool.h" /* for symbolic values of enum-type options */
 
 /* Extension strings exported by the R100 driver.
  */
-const struct dri_extension card_extensions[] =
+static const struct dri_extension card_extensions[] =
 {
     { "GL_ARB_multitexture",               NULL },
     { "GL_ARB_occlusion_query",                   GL_ARB_occlusion_query_functions},
@@ -109,7 +105,7 @@ const struct dri_extension card_extensions[] =
     { NULL,                                NULL }
 };
 
-const struct dri_extension mm_extensions[] = {
+static const struct dri_extension mm_extensions[] = {
   { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
   { NULL, NULL }
 };
@@ -202,16 +198,20 @@ static void r100_init_vtbl(radeonContextPtr radeon)
    radeon->vtbl.fallback = radeonFallback;
    radeon->vtbl.free_context = r100_vtbl_free_context;
    radeon->vtbl.emit_query_finish = r100_emit_query_finish;
+   radeon->vtbl.check_blit = r100_check_blit;
+   radeon->vtbl.blit = r100_blit;
+   radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
 }
 
 /* Create the device specific context.
  */
 GLboolean
-r100CreateContext( const __GLcontextModes *glVisual,
-                     __DRIcontextPrivate *driContextPriv,
-                     void *sharedContextPrivate)
+r100CreateContext( gl_api api,
+                  const __GLcontextModes *glVisual,
+                  __DRIcontext *driContextPriv,
+                  void *sharedContextPrivate)
 {
-   __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+   __DRIscreen *sPriv = driContextPriv->driScreenPriv;
    radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
    struct dd_function_table functions;
    r100ContextPtr rmesa;
@@ -228,6 +228,7 @@ r100CreateContext( const __GLcontextModes *glVisual,
    if ( !rmesa )
       return GL_FALSE;
 
+   rmesa->radeon.radeonScreen = screen;
    r100_init_vtbl(&rmesa->radeon);
 
    /* init exp fog table data */
@@ -257,7 +258,7 @@ r100CreateContext( const __GLcontextModes *glVisual,
     * (the texture functions are especially important)
     */
    _mesa_init_driver_functions( &functions );
-   radeonInitTextureFuncs( &functions );
+   radeonInitTextureFuncs( &rmesa->radeon, &functions );
    radeonInitQueryObjFunctions(&functions);
 
    if (!radeonInitContext(&rmesa->radeon, &functions,
@@ -281,6 +282,7 @@ r100CreateContext( const __GLcontextModes *glVisual,
                                                 "texture_units");
    ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
    ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
+   ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits;
 
    i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures");
 
@@ -318,6 +320,8 @@ r100CreateContext( const __GLcontextModes *glVisual,
    rmesa->boxes = 0;
 
    ctx->Const.MaxDrawBuffers = 1;
+   ctx->Const.MaxColorAttachments = 1;
+   ctx->Const.MaxRenderbufferSize = 2048;
 
    _mesa_set_mvp_with_dp4( ctx, GL_TRUE );