summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2008-03-31 16:27:47 +0800
committerXiang, Haihao <[email protected]>2008-03-31 16:27:47 +0800
commitaef47c4dc87075fd63002b50c4b32b1049e5e4d1 (patch)
treed1b1fbc27253e4cd7d0c44ec52ce2944e1927b5c /src/mesa
parentd30d9e42b758db452bfdb482b619a5f4c6d01037 (diff)
Revert "mesa: separate shader program object from shader object." (bug#15244)
This reverts commit 3ffd11f71d021f672b9bc15b3c39c155a0e2fecb.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/context.c24
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/shader/shader_api.c8
3 files changed, 13 insertions, 21 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 62d592767d1..087e18fb53e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -444,7 +444,6 @@ alloc_shared_state( GLcontext *ctx )
ss->ArrayObjects = _mesa_NewHashTable();
#if FEATURE_ARB_shader_objects
- ss->ShaderProgramObjects = _mesa_NewHashTable();
ss->ShaderObjects = _mesa_NewHashTable();
#endif
@@ -524,8 +523,6 @@ cleanup:
_mesa_DeleteHashTable (ss->ArrayObjects);
#if FEATURE_ARB_shader_objects
- if (ss->ShaderProgramObjects)
- _mesa_DeleteHashTable (ss->ShaderProgramObjects);
if (ss->ShaderObjects)
_mesa_DeleteHashTable (ss->ShaderObjects);
#endif
@@ -634,17 +631,14 @@ delete_shader_cb(GLuint id, void *data, void *userData)
{
GLcontext *ctx = (GLcontext *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
- 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);
+ 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);
+ }
}
/**
@@ -727,8 +721,6 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
_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
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index da60a469a4c..c8718a7f636 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2202,8 +2202,8 @@ struct gl_shared_state
#endif
#if FEATURE_ARB_shader_objects
+ /** Table of both gl_shader and gl_shader_program objects */
struct _mesa_HashTable *ShaderObjects;
- struct _mesa_HashTable *ShaderProgramObjects;
#endif
#if FEATURE_EXT_framebuffer_object
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 76da855a07e..df2f9dcec81 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->ShaderProgramObjects, old->Name);
+ _mesa_HashRemove(ctx->Shared->ShaderObjects, 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->ShaderProgramObjects, name);
+ _mesa_HashLookup(ctx->Shared->ShaderObjects, 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->ShaderProgramObjects, 1);
+ name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
shProg = _mesa_new_shader_program(ctx, name);
- _mesa_HashInsert(ctx->Shared->ShaderProgramObjects, name, shProg);
+ _mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
assert(shProg->RefCount == 1);