diff options
author | Brian Paul <[email protected]> | 2003-07-22 03:51:46 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-07-22 03:51:46 +0000 |
commit | 05944c031cd6bea985050f0e88a19f0794f57887 (patch) | |
tree | 23b1def1e5c7fe1efe19deb67c366f811e21cdc0 /src/mesa | |
parent | f7fda86c6dcb7894157bd35a0cf15d003d48b441 (diff) |
Restore more code lost during last big merge.
Rename colortable-related functions.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/arbprogram.c | 33 | ||||
-rw-r--r-- | src/mesa/main/arbprogram.h | 5 | ||||
-rw-r--r-- | src/mesa/main/colortab.c | 40 | ||||
-rw-r--r-- | src/mesa/main/colortab.h | 23 | ||||
-rw-r--r-- | src/mesa/main/context.c | 9 | ||||
-rw-r--r-- | src/mesa/main/occlude.c | 14 | ||||
-rw-r--r-- | src/mesa/main/occlude.h | 3 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 4 |
9 files changed, 103 insertions, 32 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 24ab8a1035f..cd441f8e13e 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -60,6 +60,39 @@ _mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target, } +/* + * Init context's program state + */ +void +_mesa_init_program(GLcontext *ctx) +{ + GLuint i; + + ctx->Program.ErrorPos = -1; + ctx->Program.ErrorString = _mesa_strdup(""); + +#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program + ctx->VertexProgram.Enabled = GL_FALSE; + ctx->VertexProgram.PointSizeEnabled = GL_FALSE; + ctx->VertexProgram.TwoSideEnabled = GL_FALSE; + ctx->VertexProgram.Current = NULL; + ctx->VertexProgram.Current = (struct vertex_program *) ctx->Shared->DefaultVertexProgram; + assert(ctx->VertexProgram.Current); + ctx->VertexProgram.Current->Base.RefCount++; + for (i = 0; i < VP_NUM_PROG_REGS / 4; i++) { + ctx->VertexProgram.TrackMatrix[i] = GL_NONE; + ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; + } +#endif + +#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program + ctx->FragmentProgram.Enabled = GL_FALSE; + ctx->FragmentProgram.Current = (struct fragment_program *) ctx->Shared->DefaultFragmentProgram; + assert(ctx->FragmentProgram.Current); + ctx->FragmentProgram.Current->Base.RefCount++; +#endif +} + void _mesa_EnableVertexAttribArrayARB(GLuint index) diff --git a/src/mesa/main/arbprogram.h b/src/mesa/main/arbprogram.h index bc5a6626ed5..07cd3a17aa1 100644 --- a/src/mesa/main/arbprogram.h +++ b/src/mesa/main/arbprogram.h @@ -26,6 +26,11 @@ #ifndef ARBPROGRAM_H #define ARBPROGRAM_H +#include "mtypes.h" + +extern void +_mesa_init_program(GLcontext *ctx); + extern void _mesa_EnableVertexAttribArrayARB(GLuint index); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 9a1734bf4be..cc268557268 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1332,7 +1332,7 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) void -_mesa_init_one_colortable( struct gl_color_table *p ) +_mesa_init_colortable( struct gl_color_table *p ) { p->FloatTable = GL_FALSE; p->Table = NULL; @@ -1343,7 +1343,7 @@ _mesa_init_one_colortable( struct gl_color_table *p ) void -_mesa_free_one_colortable( struct gl_color_table *p ) +_mesa_free_colortable_data( struct gl_color_table *p ) { if (p->Table) { FREE(p->Table); @@ -1351,23 +1351,31 @@ _mesa_free_one_colortable( struct gl_color_table *p ) } } -void _mesa_init_colortable( GLcontext * ctx ) + +/* + * Initialize all colortables for a context. + */ +void _mesa_init_colortables( GLcontext * ctx ) { /* Color tables */ - _mesa_init_one_colortable(&ctx->ColorTable); - _mesa_init_one_colortable(&ctx->ProxyColorTable); - _mesa_init_one_colortable(&ctx->PostConvolutionColorTable); - _mesa_init_one_colortable(&ctx->ProxyPostConvolutionColorTable); - _mesa_init_one_colortable(&ctx->PostColorMatrixColorTable); - _mesa_init_one_colortable(&ctx->ProxyPostColorMatrixColorTable); + _mesa_init_colortable(&ctx->ColorTable); + _mesa_init_colortable(&ctx->ProxyColorTable); + _mesa_init_colortable(&ctx->PostConvolutionColorTable); + _mesa_init_colortable(&ctx->ProxyPostConvolutionColorTable); + _mesa_init_colortable(&ctx->PostColorMatrixColorTable); + _mesa_init_colortable(&ctx->ProxyPostColorMatrixColorTable); } -void _mesa_free_colortable_data( GLcontext *ctx ) + +/* + * Free all colortable data for a context + */ +void _mesa_free_colortables_data( GLcontext *ctx ) { - _mesa_free_one_colortable( &ctx->ColorTable ); - _mesa_free_one_colortable( &ctx->ProxyColorTable ); - _mesa_free_one_colortable( &ctx->PostConvolutionColorTable ); - _mesa_free_one_colortable( &ctx->ProxyPostConvolutionColorTable ); - _mesa_free_one_colortable( &ctx->PostColorMatrixColorTable ); - _mesa_free_one_colortable( &ctx->ProxyPostColorMatrixColorTable ); + _mesa_free_colortable_data(&ctx->ColorTable); + _mesa_free_colortable_data(&ctx->ProxyColorTable); + _mesa_free_colortable_data(&ctx->PostConvolutionColorTable); + _mesa_free_colortable_data(&ctx->ProxyPostConvolutionColorTable); + _mesa_free_colortable_data(&ctx->PostColorMatrixColorTable); + _mesa_free_colortable_data(&ctx->ProxyPostColorMatrixColorTable); } diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index 959547e28bc..9ccf27693f0 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -77,28 +77,33 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); extern void _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); -extern void -_mesa_init_colortable( GLcontext * ctx ); -extern void -_mesa_free_colortable_data( GLcontext * ctx ); extern void -_mesa_free_one_colortable( struct gl_color_table *p ); +_mesa_init_colortable( struct gl_color_table *table ); extern void -_mesa_init_one_colortable( struct gl_color_table *p ); +_mesa_free_colortable_data( struct gl_color_table *table ); + +extern void +_mesa_init_colortables( GLcontext *ctx ); + +extern void +_mesa_free_colortables_data( GLcontext *ctx ); #else /** No-op */ -#define _mesa_init_one_colortable( p ) ((void)0) +#define _mesa_init_colortable( p ) ((void) 0) + +/** No-op */ +#define _mesa_free_colortable_data( p ) ((void) 0) /** No-op */ -#define _mesa_init_colortable( p ) ((void)0) +#define _mesa_init_colortables( p ) ((void)0) /** No-op */ -#define _mesa_free_colortable_data( p ) ((void)0) +#define _mesa_free_colortables_data( p ) ((void)0) #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b44f74be4a1..13b4d193d1e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -74,6 +74,7 @@ #include "glheader.h" #include "imports.h" #include "accum.h" +#include "arbprogram.h" #include "attrib.h" #include "blend.h" #include "buffers.h" @@ -97,6 +98,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "occlude.h" #include "pixel.h" #include "points.h" #include "polygon.h" @@ -1089,7 +1091,7 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_attrib( ctx ); _mesa_init_buffers( ctx ); _mesa_init_color( ctx ); - _mesa_init_colortable( ctx ); + _mesa_init_colortables( ctx ); _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); @@ -1102,10 +1104,11 @@ init_attrib_groups( GLcontext *ctx ) _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); _mesa_init_matrix( ctx ); + _mesa_init_occlude( ctx ); _mesa_init_pixel( ctx ); _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); - /* XXX _mesa_init_program( ctx ); */ + _mesa_init_program( ctx ); _mesa_init_rastpos( ctx ); _mesa_init_stencil( ctx ); _mesa_init_transform( ctx ); @@ -1473,7 +1476,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); - _mesa_free_colortable_data( ctx ); + _mesa_free_colortables_data( ctx ); #if FEATURE_NV_vertex_program if (ctx->VertexProgram.Current) { ctx->VertexProgram.Current->Base.RefCount--; diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c index 4a5df2127ff..f6dc7056ba1 100644 --- a/src/mesa/main/occlude.c +++ b/src/mesa/main/occlude.c @@ -53,6 +53,20 @@ struct occlusion_query }; + +void +_mesa_init_occlude(GLcontext *ctx) +{ +#if FEATURE_ARB_occlusion_query + ctx->Occlusion.QueryObjects = _mesa_NewHashTable(); +#endif + + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; +} + + + /** * Allocate a new occlusion query object. * \param target - must be GL_SAMPLES_PASSED_ARB at this time diff --git a/src/mesa/main/occlude.h b/src/mesa/main/occlude.h index cc3786772bc..e837dd72eb4 100644 --- a/src/mesa/main/occlude.h +++ b/src/mesa/main/occlude.h @@ -28,6 +28,9 @@ extern void +_mesa_init_occlude(GLcontext *ctx); + +extern void _mesa_GenQueriesARB(GLsizei n, GLuint *ids); extern void diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index e131fae50e4..509523a130c 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -123,7 +123,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ - _mesa_init_one_colortable(&obj->Palette); + _mesa_init_colortable(&obj->Palette); } @@ -147,7 +147,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) assert(texObj); - _mesa_free_one_colortable(&texObj->Palette); + _mesa_free_colortable_data(&texObj->Palette); /* free the texture images */ for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index d61b2019e57..72419922eb6 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -2966,7 +2966,7 @@ GLboolean _mesa_init_texture( GLcontext * ctx ) for (i=0; i<MAX_TEXTURE_UNITS; i++) init_texture_unit( ctx, i ); ctx->Texture.SharedPalette = GL_FALSE; - _mesa_init_one_colortable(&ctx->Texture.Palette); + _mesa_init_colortable(&ctx->Texture.Palette); /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) @@ -2987,5 +2987,5 @@ void _mesa_free_texture_data( GLcontext *ctx ) (ctx->Driver.DeleteTexture)(ctx, ctx->Texture.ProxyRect ); for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) - _mesa_free_one_colortable( &ctx->Texture.Unit[i].ColorTable ); + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); } |