Mesa (master): mesa/sso: Implement _mesa_GetProgramPipelineiv

Ian Romanick idr at kemper.freedesktop.org
Fri Feb 21 23:41:21 UTC 2014


Module: Mesa
Branch: master
Commit: 4719ad79ec1cd84996b6366e05c7ae4bbb7fe5f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4719ad79ec1cd84996b6366e05c7ae4bbb7fe5f5

Author: Gregory Hainaut <gregory.hainaut at gmail.com>
Date:   Fri Jun 28 14:20:11 2013 -0700

mesa/sso: Implement _mesa_GetProgramPipelineiv

This was originally included in another patch, but it was split out by
Ian Romanick.

v2 (idr):
* Trivial reformatting.
* Remove GL_COMPUTE_SHADER.  Compute shaders don't participate in pipeline
  objects anyway.  Suggested by Matt Turner.

v3 (idr):
* Use _mesa_has_geometry_shaders.

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 |   58 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index b5780c6..aaed9f9 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -370,6 +370,64 @@ _mesa_IsProgramPipeline(GLuint pipeline)
 void GLAPIENTRY
 _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
 {
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_pipeline_object *pipe = lookup_pipeline_object(ctx, pipeline);
+
+   /* Are geometry shaders available in this context?
+    */
+   const bool has_gs = _mesa_has_geometry_shaders(ctx);
+
+   if (!pipe) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGetProgramPipelineiv(pipeline)");
+      return;
+   }
+
+   /* Object is created by any Pipeline call but glGenProgramPipelines,
+    * glIsProgramPipeline and GetProgramPipelineInfoLog
+    */
+   pipe->EverBound = GL_TRUE;
+
+   switch (pname) {
+   case GL_ACTIVE_PROGRAM:
+      *params = pipe->ActiveProgram ? pipe->ActiveProgram->Name : 0;
+      return;
+   case GL_INFO_LOG_LENGTH:
+      /* FINISHME: Implement the info log.
+       */
+      *params = 0;
+      return;
+   case GL_VALIDATE_STATUS:
+      /* FINISHME: Implement validation status.
+       */
+      *params = 0;
+      return;
+   case GL_VERTEX_SHADER:
+      *params = pipe->CurrentProgram[MESA_SHADER_VERTEX]
+         ? pipe->CurrentProgram[MESA_SHADER_VERTEX]->Name : 0;
+      return;
+   case GL_TESS_EVALUATION_SHADER:
+      /* NOT YET SUPPORTED */
+      break;
+   case GL_TESS_CONTROL_SHADER:
+      /* NOT YET SUPPORTED */
+      break;
+   case GL_GEOMETRY_SHADER:
+      if (!has_gs)
+         break;
+      *params = pipe->CurrentProgram[MESA_SHADER_GEOMETRY]
+         ? pipe->CurrentProgram[MESA_SHADER_GEOMETRY]->Name : 0;
+      return;
+   case GL_FRAGMENT_SHADER:
+      *params = pipe->CurrentProgram[MESA_SHADER_FRAGMENT]
+         ? pipe->CurrentProgram[MESA_SHADER_FRAGMENT]->Name : 0;
+      return;
+   default:
+      break;
+   }
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramPipelineiv(pname=%s)",
+               _mesa_lookup_enum_by_nr(pname));
 }
 
 /**




More information about the mesa-commit mailing list