aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/osmesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-04-01 17:28:55 +0000
committerBrian Paul <[email protected]>2003-04-01 17:28:55 +0000
commit6fafc7ad19a8b7400e57a86b588766b6f3811a05 (patch)
treeb9d4a02e149daa485376bbe30494f4fd4651c9a0 /src/mesa/drivers/osmesa
parent1e24d3318df57b36e3b68695ff64b4b8bd822c9e (diff)
s/gl_ctx/mesa/ and misc clean-ups
Diffstat (limited to 'src/mesa/drivers/osmesa')
-rw-r--r--src/mesa/drivers/osmesa/osmesa.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index ba7500fd8d9..286662b628e 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -1,4 +1,4 @@
-/* $Id: osmesa.c,v 1.102 2003/04/01 16:41:57 brianp Exp $ */
+/* $Id: osmesa.c,v 1.103 2003/04/01 17:28:55 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -70,7 +70,7 @@
* or vice versa.
*/
struct osmesa_context {
- GLcontext gl_ctx; /* The core GL/Mesa context */
+ GLcontext mesa; /* The core GL/Mesa context */
GLvisual *gl_visual; /* Describes the buffers */
GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */
GLenum format; /* either GL_RGBA or GL_COLOR_INDEX */
@@ -87,6 +87,7 @@ struct osmesa_context {
};
+/* Just cast, since we're using structure containment */
#define OSMESA_CONTEXT(ctx) ((OSMesaContext) (ctx->DriverCtx))
@@ -671,9 +672,6 @@ hook_in_driver_functions( GLcontext *ctx )
ctx->Driver.CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
ctx->Driver.CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
- ctx->Driver.NewTextureObject = _mesa_new_texture_object;
- ctx->Driver.DeleteTexture = _mesa_delete_texture_object;
-
ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d;
ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d;
ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d;
@@ -962,9 +960,17 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
return NULL;
}
- if (!_mesa_initialize_context(&osmesa->gl_ctx,
+ /* 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;
+
+ if (!_mesa_initialize_context(&osmesa->mesa,
osmesa->gl_visual,
- sharelist ? &sharelist->gl_ctx
+ sharelist ? &sharelist->mesa
: (GLcontext *) NULL,
(void *) osmesa,
GL_FALSE)) {
@@ -973,9 +979,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
return NULL;
}
- _mesa_enable_sw_extensions(&(osmesa->gl_ctx));
- _mesa_enable_1_3_extensions(&(osmesa->gl_ctx));
- /*_mesa_enable_1_4_extensions(&(osmesa->gl_ctx));*/
+ _mesa_enable_sw_extensions(&(osmesa->mesa));
+ _mesa_enable_1_3_extensions(&(osmesa->mesa));
+ _mesa_enable_1_4_extensions(&(osmesa->mesa));
osmesa->gl_buffer = _mesa_create_framebuffer( osmesa->gl_visual,
(GLboolean) ( osmesa->gl_visual->depthBits > 0 ),
@@ -985,7 +991,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
if (!osmesa->gl_buffer) {
_mesa_destroy_visual( osmesa->gl_visual );
- _mesa_free_context_data( &osmesa->gl_ctx );
+ _mesa_free_context_data( &osmesa->mesa );
FREE(osmesa);
return NULL;
}
@@ -1007,7 +1013,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
/* Initialize the software rasterizer and helper modules. */
{
- GLcontext *ctx = &osmesa->gl_ctx;
+ GLcontext *ctx = &osmesa->mesa;
_swrast_CreateContext( ctx );
_ac_CreateContext( ctx );
@@ -1031,14 +1037,14 @@ GLAPI void GLAPIENTRY
OSMesaDestroyContext( OSMesaContext ctx )
{
if (ctx) {
- _swsetup_DestroyContext( &ctx->gl_ctx );
- _tnl_DestroyContext( &ctx->gl_ctx );
- _ac_DestroyContext( &ctx->gl_ctx );
- _swrast_DestroyContext( &ctx->gl_ctx );
+ _swsetup_DestroyContext( &ctx->mesa );
+ _tnl_DestroyContext( &ctx->mesa );
+ _ac_DestroyContext( &ctx->mesa );
+ _swrast_DestroyContext( &ctx->mesa );
_mesa_destroy_visual( ctx->gl_visual );
_mesa_destroy_framebuffer( ctx->gl_buffer );
- _mesa_free_context_data( &ctx->gl_ctx );
+ _mesa_free_context_data( &ctx->mesa );
FREE( ctx );
}
}
@@ -1131,8 +1137,8 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
return GL_FALSE;
}
- osmesa_update_state( &ctx->gl_ctx, 0 );
- _mesa_make_current( &ctx->gl_ctx, ctx->gl_buffer );
+ osmesa_update_state( &ctx->mesa, 0 );
+ _mesa_make_current( &ctx->mesa, ctx->gl_buffer );
ctx->buffer = buffer;
ctx->width = width;
@@ -1145,11 +1151,11 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
compute_row_addresses( ctx );
/* init viewport */
- if (ctx->gl_ctx.Viewport.Width == 0) {
+ if (ctx->mesa.Viewport.Width == 0) {
/* initialize viewport and scissor box to buffer size */
_mesa_Viewport( 0, 0, width, height );
- ctx->gl_ctx.Scissor.Width = width;
- ctx->gl_ctx.Scissor.Height = height;
+ ctx->mesa.Scissor.Width = width;
+ ctx->mesa.Scissor.Height = height;
}
else {
/* this will make ensure we recognize the new buffer size */
@@ -1157,8 +1163,8 @@ OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
}
/* Added by Gerk Huisma: */
- _tnl_MakeCurrent( &ctx->gl_ctx, ctx->gl_ctx.DrawBuffer,
- ctx->gl_ctx.ReadBuffer );
+ _tnl_MakeCurrent( &ctx->mesa, ctx->mesa.DrawBuffer,
+ ctx->mesa.ReadBuffer );
return GL_TRUE;
}
@@ -1183,7 +1189,7 @@ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value )
switch (pname) {
case OSMESA_ROW_LENGTH:
if (value<0) {
- _mesa_error( &osmesa->gl_ctx, GL_INVALID_VALUE,
+ _mesa_error( &osmesa->mesa, GL_INVALID_VALUE,
"OSMesaPixelStore(value)" );
return;
}
@@ -1194,7 +1200,7 @@ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value )
osmesa->yup = value ? GL_TRUE : GL_FALSE;
break;
default:
- _mesa_error( &osmesa->gl_ctx, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" );
+ _mesa_error( &osmesa->mesa, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" );
return;
}
@@ -1232,7 +1238,7 @@ GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value )
*value = MAX_HEIGHT;
return;
default:
- _mesa_error(&osmesa->gl_ctx, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)");
+ _mesa_error(&osmesa->mesa, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)");
return;
}
}