diff options
author | Brian Paul <[email protected]> | 2005-01-20 04:02:02 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-01-20 04:02:02 +0000 |
commit | ea2943efd95c0760a5423236ed37655d863b8a5e (patch) | |
tree | e86344d411aadf9b698a79896ed78469f7129285 /src/mesa/shader | |
parent | 36da0459e4d0b12ab46f0e2090d107a22f68844a (diff) |
Update glDeletePrograms/Buffers() so that the ID is freed immediately, like
texture objects.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/atifragshader.c | 9 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 15 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index dbffa37f4f6..2a8cf9016a4 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -185,6 +185,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id) _mesa_BindFragmentShaderATI(0); } } +#if 0 if (!prog->DeletePending) { prog->DeletePending = GL_TRUE; prog->RefCount--; @@ -193,6 +194,14 @@ _mesa_DeleteFragmentShaderATI(GLuint id) _mesa_HashRemove(ctx->Shared->Programs, id); ctx->Driver.DeleteProgram(ctx, prog); } +#else + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->Programs, id); + prog->RefCount--; + if (prog->RefCount <= 0) { + ctx->Driver.DeleteProgram(ctx, prog); + } +#endif } } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 28c18ed51ad..a45bc50371e 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -940,9 +940,8 @@ _mesa_BindProgram(GLenum target, GLuint id) curProg->Base.RefCount--; /* and delete if refcount goes below one */ if (curProg->Base.RefCount <= 0) { - ASSERT(curProg->Base.DeletePending); + /* the program ID was already removed from the hash table */ ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); - _mesa_HashRemove(ctx->Shared->Programs, id); } } } @@ -961,9 +960,8 @@ _mesa_BindProgram(GLenum target, GLuint id) curProg->Base.RefCount--; /* and delete if refcount goes below one */ if (curProg->Base.RefCount <= 0) { - ASSERT(curProg->Base.DeletePending); + /* the program ID was already removed from the hash table */ ctx->Driver.DeleteProgram(ctx, &(curProg->Base)); - _mesa_HashRemove(ctx->Shared->Programs, id); } } } @@ -1068,13 +1066,10 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids) _mesa_problem(ctx, "bad target in glDeleteProgramsNV"); return; } - /* Decrement reference count if not already marked for delete */ - if (!prog->DeletePending) { - prog->DeletePending = GL_TRUE; - prog->RefCount--; - } + /* The ID is immediately available for re-use now */ + _mesa_HashRemove(ctx->Shared->Programs, ids[i]); + prog->RefCount--; if (prog->RefCount <= 0) { - _mesa_HashRemove(ctx->Shared->Programs, ids[i]); ctx->Driver.DeleteProgram(ctx, prog); } } |