#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
+#include "tnl/t_vp_build.h"
#include "drivers/common/driverfuncs.h"
ctx->Const.MaxLineWidth = R300_LINESIZE_MAX;
ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;
- if (hw_tcl_on)
- ctx->_MaintainTnlProgram = GL_TRUE;
-
#ifdef USER_BUFFERS
/* Needs further modifications */
#if 0
ctx->Const.FragmentProgram.MaxNativeInstructions = PFS_MAX_ALU_INST+PFS_MAX_TEX_INST;
ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */
+ _tnl_ProgramCacheInit(ctx);
ctx->_MaintainTexEnvProgram = GL_TRUE;
driInitExtensions(ctx, card_extensions, GL_TRUE);
release_texture_heaps = (r300->radeon.glCtx->Shared->RefCount == 1);
_swsetup_DestroyContext(r300->radeon.glCtx);
+ _tnl_ProgramCacheDestroy(r300->radeon.glCtx);
_tnl_DestroyContext(r300->radeon.glCtx);
_ac_DestroyContext(r300->radeon.glCtx);
_swrast_DestroyContext(r300->radeon.glCtx);
ctx = rmesa->radeon.glCtx;
- /* Disable tnl programs when doing software vertex programs.
- I can only hope this actually disables it at the right time. */
- ctx->_MaintainTnlProgram = hw_tcl_on;
-
if (rmesa->NewGLState && hw_tcl_on) {
rmesa->NewGLState = 0;
_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 );
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;
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 )
{
extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx );
+extern void _tnl_ProgramCacheInit( GLcontext *ctx );
extern void _tnl_ProgramCacheDestroy( GLcontext *ctx );
#endif