implement _mesa_GetProgramiv()
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 3 Nov 2006 22:15:43 +0000 (22:15 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 3 Nov 2006 22:15:43 +0000 (22:15 +0000)
src/mesa/shader/shaderobjects.c

index 1f7d0dbdb5292adae2e20448cb81dc75c25465f6..fdcb92a215fdc95534975e535c875f8cbef2edd2 100644 (file)
@@ -67,8 +67,8 @@ lookup_handle(GLcontext * ctx, GLhandleARB handle, enum gl2_uiid uiid,
       return NULL;
    }
    _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-   unk = (struct gl2_unknown_intf **)
-      (_mesa_HashLookup(ctx->Shared->GL2Objects, handle));
+   unk = (struct gl2_unknown_intf **) _mesa_HashLookup(ctx->Shared->GL2Objects,
+                                                       handle);
    _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
 
    if (unk == NULL) {
@@ -1005,7 +1005,44 @@ _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
 void GLAPIENTRY
 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
 {
-   /* XXX to do */
+   GET_CURRENT_CONTEXT(ctx);
+   GET_PROGRAM(pro, program, "glGetProgramiv");
+
+   if (!pro)
+      return;
+
+   switch (pname) {
+   case GL_DELETE_STATUS:
+      *params = 0; /* XXX fix */
+      break; 
+   case GL_LINK_STATUS:
+      *params = (**pro).GetLinkStatus(pro);
+      break;
+   case GL_VALIDATE_STATUS:
+      *params = (**pro).GetValidateStatus(pro);
+      break;
+   case GL_INFO_LOG_LENGTH:
+      *params = (**pro)._container._generic.GetInfoLogLength( (struct gl2_unknown_inf **) pro );
+      break;
+   case GL_ATTACHED_SHADERS:
+      *params = (**pro)._container.GetAttachedCount( (struct gl2_unknown_inf **) pro );
+      break;
+   case GL_ACTIVE_ATTRIBUTES:
+      *params = (**pro).GetActiveAttribCount(pro);
+      break;
+   case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+      *params = (**pro).GetActiveAttribMaxLength(pro);
+      break;
+   case GL_ACTIVE_UNIFORMS:
+      *params = (**pro).GetActiveUniformCount(pro);
+      break;
+   case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+      *params = (**pro).GetActiveUniformMaxLength(pro);
+      break;
+   default:
+      _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
+      return;
+   }
 }
 
 void GLAPIENTRY