ss->ArrayObjects = _mesa_NewHashTable();
#if FEATURE_ARB_shader_objects
+ ss->ShaderProgramObjects = _mesa_NewHashTable();
ss->ShaderObjects = _mesa_NewHashTable();
#endif
_mesa_DeleteHashTable (ss->ArrayObjects);
#if FEATURE_ARB_shader_objects
+ if (ss->ShaderProgramObjects)
+ _mesa_DeleteHashTable (ss->ShaderProgramObjects);
if (ss->ShaderObjects)
_mesa_DeleteHashTable (ss->ShaderObjects);
#endif
{
GLcontext *ctx = (GLcontext *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
- if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
- _mesa_free_shader(ctx, sh);
- }
- else {
- struct gl_shader_program *shProg = (struct gl_shader_program *) data;
- ASSERT(shProg->Type == GL_SHADER_PROGRAM_MESA);
- _mesa_free_shader_program(ctx, shProg);
- }
+ assert(sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER);
+ _mesa_free_shader(ctx, sh);
+}
+
+static void
+delete_shader_program_cb(GLuint id, void *data, void *userData)
+{
+ GLcontext *ctx = (GLcontext *) userData;
+ struct gl_shader_program *shProg = (struct gl_shader_program *) data;
+ assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
+ _mesa_free_shader_program(ctx, shProg);
}
/**
_mesa_DeleteHashTable(ss->ArrayObjects);
#if FEATURE_ARB_shader_objects
+ _mesa_HashDeleteAll(ss->ShaderProgramObjects, delete_shader_program_cb, ctx);
+ _mesa_DeleteHashTable(ss->ShaderProgramObjects);
_mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx);
_mesa_DeleteHashTable(ss->ShaderObjects);
#endif
deleteFlag = (old->RefCount == 0);
if (deleteFlag) {
- _mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
+ _mesa_HashRemove(ctx->Shared->ShaderProgramObjects, old->Name);
_mesa_free_shader_program(ctx, old);
}
struct gl_shader_program *shProg;
if (name) {
shProg = (struct gl_shader_program *)
- _mesa_HashLookup(ctx->Shared->ShaderObjects, name);
+ _mesa_HashLookup(ctx->Shared->ShaderProgramObjects, name);
/* Note that both gl_shader and gl_shader_program objects are kept
* in the same hash table. Check the object's type to be sure it's
* what we're expecting.
GLuint name;
struct gl_shader_program *shProg;
- name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
+ name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderProgramObjects, 1);
shProg = _mesa_new_shader_program(ctx, name);
- _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
+ _mesa_HashInsert(ctx->Shared->ShaderProgramObjects, name, shProg);
assert(shProg->RefCount == 1);