diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2006-05-23 02:44:46 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2006-05-23 02:44:46 +0000 |
commit | d9736db6676948e06712d4bcba46b7040452f870 (patch) | |
tree | 1a348c790bb7a6ccc5b80d0e5cc0e5687f969dfb /src/mesa | |
parent | f5a2ac95c30b0d4cecc47aeebfb056ec6ac8e511 (diff) |
Add const qualifiers in a number of places.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_tris.c | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 10 | ||||
-rw-r--r-- | src/mesa/main/texenvprogram.c | 23 | ||||
-rw-r--r-- | src/mesa/swrast/s_context.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_arbprogram.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vp_build.c | 4 |
6 files changed, 22 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index cef6db7a19..e1a53212a5 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -642,7 +642,7 @@ void intelChooseRenderState(GLcontext *ctx) TNLcontext *tnl = TNL_CONTEXT(ctx); intelContextPtr intel = INTEL_CONTEXT(ctx); GLuint flags = ctx->_TriangleCaps; - struct fragment_program *fprog = ctx->FragmentProgram._Current; + const struct fragment_program *fprog = ctx->FragmentProgram._Current; GLboolean have_wpos = (fprog && (fprog->Base.InputsRead & FRAG_BIT_WPOS)); GLuint index = 0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 91c1797f1e..e9893dda61 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1917,9 +1917,9 @@ struct gl_vertex_program_state GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ struct vertex_program *Current; /**< ptr to currently bound program */ - struct vertex_program *_Current; /**< ptr to currently bound - program, including internal - (t_vp_build.c) programs */ + const struct vertex_program *_Current; /**< ptr to currently bound + program, including internal + (t_vp_build.c) programs */ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; @@ -1950,8 +1950,8 @@ struct gl_fragment_program_state GLboolean _Enabled; /* Enabled and valid program? */ GLboolean _Active; struct fragment_program *Current; /* ptr to currently bound program */ - struct fragment_program *_Current; /* ptr to currently active program - (including internal programs) */ + const struct fragment_program *_Current; /* ptr to currently active program + (including internal programs) */ struct fp_machine Machine; /* machine state */ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 5b2eb2eb52..5db2f6249c 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -192,7 +192,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key ) memset(key, 0, sizeof(*key)); for (i=0;i<MAX_TEXTURE_UNITS;i++) { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; if (!texUnit->_ReallyEnabled) continue; @@ -727,7 +727,7 @@ static struct ureg emit_combine( struct texenv_fragment_program *p, GLuint unit, GLuint nr, GLuint mode, - struct mode_opt *opt) + const struct mode_opt *opt) { struct ureg src[3]; struct ureg tmp, half; @@ -1103,16 +1103,17 @@ create_new_program(struct state_key *key, GLcontext *ctx, } -static void *search_cache( struct texenvprog_cache *cache, - GLuint hash, - const void *key, - GLuint keysize) +static struct fragment_program * +search_cache(const struct texenvprog_cache *cache, + GLuint hash, + const const void *key, + GLuint keysize) { struct texenvprog_cache_item *c; for (c = cache->items[hash % cache->size]; c; c = c->next) { if (c->hash == hash && memcmp(c->key, key, keysize) == 0) - return c->data; + return (struct fragment_program *) c->data; } return NULL; @@ -1185,7 +1186,7 @@ static void cache_item( struct texenvprog_cache *cache, cache->items[hash % cache->size] = c; } -static GLuint hash_key( struct state_key *key ) +static GLuint hash_key( const struct state_key *key ) { GLuint *ikey = (GLuint *)key; GLuint hash = 0, i; @@ -1206,14 +1207,14 @@ void _mesa_UpdateTexEnvProgram( GLcontext *ctx ) { struct state_key key; GLuint hash; - struct fragment_program *prev = ctx->FragmentProgram._Current; + const struct fragment_program *prev = ctx->FragmentProgram._Current; if (!ctx->FragmentProgram._Enabled) { make_state_key(ctx, &key); hash = hash_key(&key); - ctx->FragmentProgram._Current = ctx->_TexEnvProgram = - (struct fragment_program *) + ctx->FragmentProgram._Current = + ctx->_TexEnvProgram = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); if (!ctx->_TexEnvProgram) { diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index c544e6c166..a243881322 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -231,7 +231,7 @@ static void _swrast_update_fragment_program( GLcontext *ctx ) { if (ctx->FragmentProgram._Active) { - struct fragment_program *program = ctx->FragmentProgram._Current; + const struct fragment_program *program = ctx->FragmentProgram._Current; _mesa_load_state_parameters(ctx, program->Base.Parameters); } } diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c index 9fa53e2d5b..88d8fe9546 100644 --- a/src/mesa/tnl/t_vb_arbprogram.c +++ b/src/mesa/tnl/t_vb_arbprogram.c @@ -1257,7 +1257,7 @@ static INLINE void call_func( struct tnl_compiled_program *p, static GLboolean run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage) { - struct vertex_program *program; + const struct vertex_program *program; struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct arb_vp_machine *m = ARB_VP_MACHINE(stage); struct tnl_compiled_program *p; diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index eb12dfe6aa..6789fd38fb 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -115,7 +115,7 @@ static struct state_key *make_state_key( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - struct fragment_program *fp = ctx->FragmentProgram._Current; + const struct fragment_program *fp = ctx->FragmentProgram._Current; struct state_key *key = CALLOC_STRUCT(state_key); GLuint i; @@ -1493,7 +1493,7 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) TNLcontext *tnl = TNL_CONTEXT(ctx); struct state_key *key; GLuint hash; - struct vertex_program *prev = ctx->VertexProgram._Current; + const struct vertex_program *prev = ctx->VertexProgram._Current; if (ctx->VertexProgram._Enabled == GL_FALSE) { /* Grab all the relevent state and put it in a single structure: |