summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/osmesa
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/osmesa
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/osmesa')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c63
1 files changed, 13 insertions, 50 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index 67d72446b8..8faf143372 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -59,6 +59,7 @@
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
+#include "drivers/common/driverfuncs.h"
@@ -629,6 +630,7 @@ osmesa_choose_line( GLcontext *ctx )
_NEW_RENDERMODE | \
_SWRAST_NEW_RASTERMASK)
+
/* one-time, per-context initialization */
static void
hook_in_driver_functions( GLcontext *ctx )
@@ -643,45 +645,6 @@ hook_in_driver_functions( GLcontext *ctx )
/* use default TCL pipeline */
tnl->Driver.RunPipeline = _tnl_run_pipeline;
- ctx->Driver.GetString = get_string;
- ctx->Driver.UpdateState = osmesa_update_state;
- ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
- ctx->Driver.GetBufferSize = get_buffer_size;
-
- ctx->Driver.Accum = _swrast_Accum;
- ctx->Driver.Bitmap = _swrast_Bitmap;
- ctx->Driver.Clear = clear; /* uses _swrast_Clear */
- ctx->Driver.CopyPixels = _swrast_CopyPixels;
- ctx->Driver.DrawPixels = _swrast_DrawPixels;
- ctx->Driver.ReadPixels = _swrast_ReadPixels;
- ctx->Driver.DrawBuffer = _swrast_DrawBuffer;
-
- ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;
- ctx->Driver.TexImage1D = _mesa_store_teximage1d;
- ctx->Driver.TexImage2D = _mesa_store_teximage2d;
- ctx->Driver.TexImage3D = _mesa_store_teximage3d;
- ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d;
- ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d;
- ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d;
- ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage;
-
- ctx->Driver.CompressedTexImage1D = _mesa_store_compressed_teximage1d;
- ctx->Driver.CompressedTexImage2D = _mesa_store_compressed_teximage2d;
- ctx->Driver.CompressedTexImage3D = _mesa_store_compressed_teximage3d;
- ctx->Driver.CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
- ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
- ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
-
- ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
- ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
- ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
- ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;
- ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;
- ctx->Driver.CopyColorTable = _swrast_CopyColorTable;
- ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable;
- ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
- ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
-
swdd->SetBuffer = set_buffer;
/* RGB(A) span/pixel functions */
@@ -800,6 +763,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
GLint accumBits, OSMesaContext sharelist )
{
OSMesaContext osmesa;
+ struct dd_function_table functions;
GLint rshift, gshift, bshift, ashift;
GLint rind, gind, bind, aind;
GLint indexBits = 0, redBits = 0, greenBits = 0, blueBits = 0, alphaBits =0;
@@ -961,20 +925,19 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
return NULL;
}
- /* Setup these pointers here since they're using for making the default
- * and proxy texture objects. Actually, we don't really need to do
- * this since we're using the default fallback functions which
- * _mesa_initialize_context() would plug in if needed.
- */
- osmesa->mesa.Driver.NewTextureObject = _mesa_new_texture_object;
- osmesa->mesa.Driver.DeleteTexture = _mesa_delete_texture_object;
+ /* Initialize device driver function table */
+ _mesa_init_driver_functions(&functions);
+ /* override with our functions */
+ functions.GetString = get_string;
+ functions.UpdateState = osmesa_update_state;
+ functions.GetBufferSize = get_buffer_size;
+ functions.Clear = clear;
if (!_mesa_initialize_context(&osmesa->mesa,
osmesa->gl_visual,
sharelist ? &sharelist->mesa
: (GLcontext *) NULL,
- (void *) osmesa,
- GL_FALSE)) {
+ &functions, (void *) osmesa)) {
_mesa_destroy_visual( osmesa->gl_visual );
FREE(osmesa);
return NULL;