From 9248882ca27b289180a76262aa3d9b26c0cb0e8b Mon Sep 17 00:00:00 2001 From: Aapo Tahkola Date: Tue, 6 Jun 2006 22:24:12 +0000 Subject: prevent run_arb_vertex_program from running tnl programs unless ctx->_MaintainTnlProgram is set --- src/mesa/tnl/t_context.c | 9 +-------- src/mesa/tnl/t_vb_arbprogram.c | 5 ++++- src/mesa/tnl/t_vp_build.c | 10 ++++++++++ src/mesa/tnl/t_vp_build.h | 1 + 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/mesa/tnl') diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index d13056f9f3..671654988b 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -87,14 +87,7 @@ _tnl_CreateContext( GLcontext *ctx ) _tnl_vtx_init( ctx ); if (ctx->_MaintainTnlProgram) { - tnl->vp_cache = (struct tnl_cache *) MALLOC(sizeof(*tnl->vp_cache)); - tnl->vp_cache->size = 5; - tnl->vp_cache->n_items = 0; - tnl->vp_cache->items = (struct tnl_cache_item**) - _mesa_malloc(tnl->vp_cache->size * sizeof(*tnl->vp_cache->items)); - _mesa_memset(tnl->vp_cache->items, 0, tnl->vp_cache->size * - sizeof(*tnl->vp_cache->items)); - + _tnl_ProgramCacheInit( ctx ); _tnl_install_pipeline( ctx, _tnl_vp_pipeline ); } else { _tnl_install_pipeline( ctx, _tnl_default_pipeline ); diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c index d034929fe0..0b39f77ae8 100644 --- a/src/mesa/tnl/t_vb_arbprogram.c +++ b/src/mesa/tnl/t_vb_arbprogram.c @@ -1237,7 +1237,10 @@ run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage) if (ctx->ShaderObjects._VertexShaderPresent) return GL_TRUE; - program = (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : ctx->_TnlProgram); + program = (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0); + if (!program && ctx->_MaintainTnlProgram) { + program = ctx->_TnlProgram; + } if (!program || program->IsNVProgram) return GL_TRUE; diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 6789fd38fb..c2fd42c533 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -1544,6 +1544,16 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ) ctx->VertexProgram._Current); } +void _tnl_ProgramCacheInit( GLcontext *ctx ) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + + tnl->vp_cache = (struct tnl_cache *) MALLOC(sizeof(*tnl->vp_cache)); + tnl->vp_cache->size = 17; + tnl->vp_cache->n_items = 0; + tnl->vp_cache->items = (struct tnl_cache_item**) + _mesa_calloc(tnl->vp_cache->size * sizeof(*tnl->vp_cache->items)); +} void _tnl_ProgramCacheDestroy( GLcontext *ctx ) { diff --git a/src/mesa/tnl/t_vp_build.h b/src/mesa/tnl/t_vp_build.h index 83e685b1ae..4a98fff026 100644 --- a/src/mesa/tnl/t_vp_build.h +++ b/src/mesa/tnl/t_vp_build.h @@ -30,6 +30,7 @@ extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx ); +extern void _tnl_ProgramCacheInit( GLcontext *ctx ); extern void _tnl_ProgramCacheDestroy( GLcontext *ctx ); #endif -- cgit v1.2.3