summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2006-06-06 22:24:12 +0000
committerAapo Tahkola <aet@rasterburn.org>2006-06-06 22:24:12 +0000
commit9248882ca27b289180a76262aa3d9b26c0cb0e8b (patch)
tree4be41552706b53802d8a034e70c132d98cd7a827 /src/mesa/tnl
parent9ba2006594a54173956b2af69055f633fa813bf8 (diff)
prevent run_arb_vertex_program from running tnl programs unless ctx->_MaintainTnlProgram is set
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c9
-rw-r--r--src/mesa/tnl/t_vb_arbprogram.c5
-rw-r--r--src/mesa/tnl/t_vp_build.c10
-rw-r--r--src/mesa/tnl/t_vp_build.h1
4 files changed, 16 insertions, 9 deletions
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