summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i830/i830_context.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-01-20 02:49:27 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-01-20 02:49:27 +0000
commitd3fd7ba8af15bead2f770d68a893449adeb11397 (patch)
tree2c92f7cb35f2776d6c461378f93b556fc1ca080d /src/mesa/drivers/dri/i830/i830_context.c
parent988a8862c8379c0312d40353ee4b35537dff59a1 (diff)
Before calling _mesa_create_context(), initialize a dd_function_table struct
by calling _mesa_init_driver_functions() and then plugging in the driver- specific functions. In particular, make sure ctx->Driver.NewTextureObject points to the appropriate driver function so that _all_ texture objects are augmented with the driver-specific data. Put in a bunch of assertions in the texture-related driver functions that texObj->DriverData is valid. Remove old dead code in near future.
Diffstat (limited to 'src/mesa/drivers/dri/i830/i830_context.c')
-rw-r--r--src/mesa/drivers/dri/i830/i830_context.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c
index eb4fb3f7a4..74a7d77a86 100644
--- a/src/mesa/drivers/dri/i830/i830_context.c
+++ b/src/mesa/drivers/dri/i830/i830_context.c
@@ -50,6 +50,8 @@
#include "tnl/t_pipeline.h"
+#include "drivers/common/driverfuncs.h"
+
#include "i830_screen.h"
#include "i830_dri.h"
@@ -211,17 +213,27 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
i830ScreenPrivate *screen = (i830ScreenPrivate *)sPriv->private;
I830SAREAPtr saPriv=(I830SAREAPtr)
(((GLubyte *)sPriv->pSAREA)+screen->sarea_priv_offset);
+ struct dd_function_table functions;
/* Allocate i830 context */
imesa = (i830ContextPtr) CALLOC_STRUCT(i830_context_t);
- if (!imesa) return GL_FALSE;
+ if (!imesa)
+ return GL_FALSE;
+
+ /* Init default driver functions then plug in our I830-specific functions
+ * (the texture functions are especially important)
+ */
+ _mesa_init_driver_functions(&functions);
+ i830InitIoctlFuncs(&functions);
+ i830InitTextureFuncs(&functions);
/* Allocate the Mesa context */
if (sharedContextPrivate)
shareCtx = ((i830ContextPtr) sharedContextPrivate)->glCtx;
else
shareCtx = NULL;
- imesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void*) imesa, GL_TRUE);
+ imesa->glCtx = _mesa_create_context(mesaVis, shareCtx,
+ &functions, (void*) imesa);
if (!imesa->glCtx) {
FREE(imesa);
return GL_FALSE;
@@ -260,7 +272,7 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxTextureImageUnits = 2;
ctx->Const.MaxTextureCoordUnits = 2;
- /* FIXME: driCalcualteMaxTextureLevels assumes that mipmaps are tightly
+ /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
* FIXME: packed, but they're not in Intel graphics hardware.
*/
driCalculateMaxTextureLevels( imesa->texture_heaps,
@@ -352,13 +364,16 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
_math_matrix_ctr (&imesa->ViewportMatrix);
driInitExtensions( ctx, card_extensions, GL_TRUE );
+ /* XXX these should really go right after _mesa_init_driver_functions() */
i830DDInitStateFuncs( ctx );
- i830DDInitTextureFuncs( ctx );
i830InitTriFuncs (ctx);
i830DDInitSpanFuncs( ctx );
- i830DDInitIoctlFuncs( ctx );
i830DDInitState (ctx);
+ driInitTextureObjects( ctx, & imesa->swapped,
+ DRI_TEXMGR_DO_TEXTURE_2D
+ | DRI_TEXMGR_DO_TEXTURE_RECT );
+
#if DO_DEBUG
I830_DEBUG = driParseDebugString( getenv( "I830_DEBUG" ),
debug_control );
@@ -372,7 +387,6 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
FALLBACK(imesa, I830_FALLBACK_USER, 1);
}
-
return GL_TRUE;
}