prevent run_arb_vertex_program from running tnl programs unless ctx->_MaintainTnlProg...
authorAapo Tahkola <aet@rasterburn.org>
Tue, 6 Jun 2006 22:24:12 +0000 (22:24 +0000)
committerAapo Tahkola <aet@rasterburn.org>
Tue, 6 Jun 2006 22:24:12 +0000 (22:24 +0000)
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/tnl/t_context.c
src/mesa/tnl/t_vb_arbprogram.c
src/mesa/tnl/t_vp_build.c
src/mesa/tnl/t_vp_build.h

index cadb27ba8b9eb5882e1741f4b9c851b7478a8b22..ab582525abc4b97ee3df66cc07fa1438a39ddad2 100644 (file)
@@ -48,6 +48,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "tnl/tnl.h"
 #include "tnl/t_pipeline.h"
+#include "tnl/t_vp_build.h"
 
 #include "drivers/common/driverfuncs.h"
 
@@ -274,9 +275,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        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
@@ -325,6 +323,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        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);
@@ -454,6 +453,7 @@ void r300DestroyContext(__DRIcontextPrivate * driContextPriv)
 
                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);
index 70d42c2ea3be54d2fd1de2cca72c408841e7245b..1e06992394bfe52056faf66ea0dde8d4a1da9303 100644 (file)
@@ -1678,10 +1678,6 @@ void r300UpdateShaders(r300ContextPtr rmesa)
        
        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;
                
index d13056f9f39895902e0a64e22f372bcccf766d09..671654988b0f1f8e69c426caf537ea7b77153fac 100644 (file)
@@ -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 );
index d034929fe0a76d3a52e43f93aa6ee44a12bf9eaf..0b39f77ae864d60ff129eaa505d7b6843e7b62a8 100644 (file)
@@ -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;   
 
index 6789fd38fb8d125594762aca5d9a8412c279a277..c2fd42c533200dc668fd980e4df37b2f383a03a3 100644 (file)
@@ -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 )
 {
index 83e685b1ae4142241258fb1cf15d869e05ca9119..4a98fff026d03929f96666c8f76196a5e14228d9 100644 (file)
@@ -30,6 +30,7 @@
 
 extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx );
 
+extern void _tnl_ProgramCacheInit( GLcontext *ctx );
 extern void _tnl_ProgramCacheDestroy( GLcontext *ctx );
 
 #endif