Mesa (master): mesa/sso: Implement _mesa_DeleteProgramPipelines
Ian Romanick
idr at kemper.freedesktop.org
Fri Feb 21 23:41:20 UTC 2014
Module: Mesa
Branch: master
Commit: 55311557fda35d3e304039cc8700a43d04a0c077
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=55311557fda35d3e304039cc8700a43d04a0c077
Author: Gregory Hainaut <gregory.hainaut at gmail.com>
Date: Fri Jun 28 13:57:50 2013 -0700
mesa/sso: Implement _mesa_DeleteProgramPipelines
Implement DeleteProgramPipelines based on the VAO code.
This was originally included in another patch, but it was split out by
Ian Romanick.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/main/pipelineobj.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index d50214c..810c6fd 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -242,6 +242,39 @@ _mesa_BindProgramPipeline(GLuint pipeline)
void GLAPIENTRY
_mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
{
+ GET_CURRENT_CONTEXT(ctx);
+ GLsizei i;
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteProgramPipelines(n<0)");
+ return;
+ }
+
+ for (i = 0; i < n; i++) {
+ struct gl_pipeline_object *obj =
+ lookup_pipeline_object(ctx, pipelines[i]);
+
+ if (obj) {
+ ASSERT(obj->Name == pipelines[i]);
+
+ /* If the pipeline object is currently bound, the spec says "If an
+ * object that is currently bound is deleted, the binding for that
+ * object reverts to zero and no program pipeline object becomes
+ * current."
+ */
+ if (obj == ctx->Pipeline.Current) {
+ _mesa_BindProgramPipeline(0);
+ }
+
+ /* The ID is immediately freed for re-use */
+ remove_pipeline_object(ctx, obj);
+
+ /* Unreference the pipeline object.
+ * If refcount hits zero, the object will be deleted.
+ */
+ _mesa_reference_pipeline_object(ctx, &obj, NULL);
+ }
+ }
}
/**
More information about the mesa-commit
mailing list