alloc caches for fixed-func vertex/fragment progs

This commit is contained in:
Brian
2007-10-31 12:00:38 -06:00
parent 3798395af5
commit b26aae67f5
2 changed files with 11 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ typedef int GLfixed;
/*@{*/ /*@{*/
struct _mesa_HashTable; struct _mesa_HashTable;
struct gl_pixelstore_attrib; struct gl_pixelstore_attrib;
struct gl_program_cache;
struct gl_texture_format; struct gl_texture_format;
struct gl_texture_image; struct gl_texture_image;
struct gl_texture_object; struct gl_texture_object;
@@ -2000,6 +2001,9 @@ struct gl_vertex_program_state
/** Program to emulate fixed-function T&L (see above) */ /** Program to emulate fixed-function T&L (see above) */
struct gl_vertex_program *_TnlProgram; struct gl_vertex_program *_TnlProgram;
/** Cache of fixed-function programs */
struct gl_program_cache *Cache;
#if FEATURE_MESA_program_debug #if FEATURE_MESA_program_debug
GLprogramcallbackMESA Callback; GLprogramcallbackMESA Callback;
GLvoid *CallbackData; GLvoid *CallbackData;
@@ -2033,6 +2037,9 @@ struct gl_fragment_program_state
/** Program to emulate fixed-function texture env/combine (see above) */ /** Program to emulate fixed-function texture env/combine (see above) */
struct gl_fragment_program *_TexEnvProgram; struct gl_fragment_program *_TexEnvProgram;
/** Cache of fixed-function programs */
struct gl_program_cache *Cache;
#if FEATURE_MESA_program_debug #if FEATURE_MESA_program_debug
GLprogramcallbackMESA Callback; GLprogramcallbackMESA Callback;
GLvoid *CallbackData; GLvoid *CallbackData;

View File

@@ -33,6 +33,7 @@
#include "context.h" #include "context.h"
#include "hash.h" #include "hash.h"
#include "program.h" #include "program.h"
#include "prog_cache.h"
#include "prog_parameter.h" #include "prog_parameter.h"
#include "prog_instruction.h" #include "prog_instruction.h"
@@ -66,6 +67,7 @@ _mesa_init_program(GLcontext *ctx)
ctx->VertexProgram.TrackMatrix[i] = GL_NONE; ctx->VertexProgram.TrackMatrix[i] = GL_NONE;
ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV; ctx->VertexProgram.TrackMatrixTransform[i] = GL_IDENTITY_NV;
} }
ctx->VertexProgram.Cache = _mesa_new_program_cache();
#endif #endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
@@ -73,8 +75,10 @@ _mesa_init_program(GLcontext *ctx)
ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram; ctx->FragmentProgram.Current = (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram;
assert(ctx->FragmentProgram.Current); assert(ctx->FragmentProgram.Current);
ctx->FragmentProgram.Current->Base.RefCount++; ctx->FragmentProgram.Current->Base.RefCount++;
ctx->FragmentProgram.Cache = _mesa_new_program_cache();
#endif #endif
/* XXX probably move this stuff */ /* XXX probably move this stuff */
#if FEATURE_ATI_fragment_shader #if FEATURE_ATI_fragment_shader
ctx->ATIFragmentShader.Enabled = GL_FALSE; ctx->ATIFragmentShader.Enabled = GL_FALSE;