mesa: Move _mesa_GetActiveAttribARB to shader_query.cpp
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 17 Aug 2011 22:44:48 +0000 (15:44 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 4 Oct 2011 20:17:46 +0000 (13:17 -0700)
This just folds get_active_attrib into _mesa_GetActiveAttribARB
and moves the resulting function function to the other source file.
More changes are coming soon.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/shader_query.cpp
src/mesa/main/shaderapi.c

index 424610d6d5a7a5c5783d06fe8073d9289d61435e..6e81564f22505ce15fd78c91c2e12720a220a9b7 100644 (file)
@@ -84,6 +84,38 @@ _mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
     */
 }
 
+void GLAPIENTRY
+_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
+                         GLsizei maxLength, GLsizei * length, GLint * size,
+                         GLenum * type, GLcharARB * name)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   const struct gl_program_parameter_list *attribs = NULL;
+   struct gl_shader_program *shProg;
+
+   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
+   if (!shProg)
+      return;
+
+   if (shProg->VertexProgram)
+      attribs = shProg->VertexProgram->Base.Attributes;
+
+   if (!attribs || index >= attribs->NumParameters) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)");
+      return;
+   }
+
+   _mesa_copy_string(name, maxLength, length,
+                     attribs->Parameters[index].Name);
+
+   if (size)
+      *size = attribs->Parameters[index].Size
+         / _mesa_sizeof_glsl_type(attribs->Parameters[index].DataType);
+
+   if (type)
+      *type = attribs->Parameters[index].DataType;
+}
+
 GLint GLAPIENTRY
 _mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
 {
index 707975411474312cd0832bfc3baba086bb0a0722..b13ec45df36655dbdb5ed67916043b5428f9e362 100644 (file)
@@ -481,38 +481,6 @@ detach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
 }
 
 
-static void
-get_active_attrib(struct gl_context *ctx, GLuint program, GLuint index,
-                  GLsizei maxLength, GLsizei *length, GLint *size,
-                  GLenum *type, GLchar *nameOut)
-{
-   const struct gl_program_parameter_list *attribs = NULL;
-   struct gl_shader_program *shProg;
-
-   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
-   if (!shProg)
-      return;
-
-   if (shProg->VertexProgram)
-      attribs = shProg->VertexProgram->Base.Attributes;
-
-   if (!attribs || index >= attribs->NumParameters) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)");
-      return;
-   }
-
-   _mesa_copy_string(nameOut, maxLength, length,
-                     attribs->Parameters[index].Name);
-
-   if (size)
-      *size = attribs->Parameters[index].Size
-         / _mesa_sizeof_glsl_type(attribs->Parameters[index].DataType);
-
-   if (type)
-      *type = attribs->Parameters[index].DataType;
-}
-
-
 /**
  * Return list of shaders attached to shader program.
  */
@@ -1203,16 +1171,6 @@ _mesa_DetachShader(GLuint program, GLuint shader)
 }
 
 
-void GLAPIENTRY
-_mesa_GetActiveAttribARB(GLhandleARB program, GLuint index,
-                         GLsizei maxLength, GLsizei * length, GLint * size,
-                         GLenum * type, GLcharARB * name)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   get_active_attrib(ctx, program, index, maxLength, length, size, type, name);
-}
-
-
 void GLAPIENTRY
 _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
                             GLsizei * count, GLhandleARB * obj)