summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2008-02-28 21:27:16 +0800
committerXiang, Haihao <[email protected]>2008-02-28 21:32:36 +0800
commit3ffd11f71d021f672b9bc15b3c39c155a0e2fecb (patch)
tree38ad2acfd3cb10ff5fa0b7b81de18a76ab6ec3af /src/mesa/shader
parent0da03c0aa9ed120fe5ff781a365b503b8ed70e0c (diff)
mesa: separate shader program object from shader object.
Currently a callback delete_shader_cb is used for deleting shader and shader program objects. Mesa detaches all attached shaders in _mesa_free_shader_program_data when deleting shader program objects. However it is likely that these shaders have been freed in _mesa_free_shader, which will result in unexpected behaviour. This fix uses a single callback for shader program objects and deletes shader program objects before shader objects.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/shader_api.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index d0c82351037..e9c35fce715 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -178,7 +178,7 @@ _mesa_reference_shader_program(GLcontext *ctx,
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);
}
@@ -204,7 +204,7 @@ _mesa_lookup_shader_program(GLcontext *ctx, GLuint name)
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.
@@ -536,10 +536,10 @@ _mesa_create_program(GLcontext *ctx)
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);