summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-08-17 15:35:09 -0700
committerIan Romanick <[email protected]>2011-10-04 13:17:46 -0700
commit2fd80534f01a5c684c47eff3946f412192ae3c0b (patch)
tree50db6d6bf3aa7ad3d726af26437281a2049a0f64 /src/mesa/main/shader_query.cpp
parent3ea297bdc47848e80c3b5a7d2143aca8a982b7a5 (diff)
mesa: Move _mesa_BindAttribLocationARB to shader_query.cpp
This just folds bind_attrib_location into _mesa_BindAttribLocationARB and moves the resulting function function to the other source file. More changes are coming soon. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index d5c1546967e..b754b1f64a1 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -37,6 +37,48 @@ extern "C" {
#include "shaderapi.h"
}
+void GLAPIENTRY
+_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
+ const GLcharARB *name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ const GLint size = -1; /* unknown size */
+ GLint i;
+ GLenum datatype = GL_FLOAT_VEC4;
+
+ struct gl_shader_program *const shProg =
+ _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
+ if (!shProg)
+ return;
+
+ if (!name)
+ return;
+
+ if (strncmp(name, "gl_", 3) == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindAttribLocation(illegal name)");
+ return;
+ }
+
+ if (index >= ctx->Const.VertexProgram.MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(index)");
+ return;
+ }
+
+ /* this will replace the current value if it's already in the list */
+ i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index);
+ if (i < 0) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindAttribLocation");
+ return;
+ }
+
+ /*
+ * Note that this attribute binding won't go into effect until
+ * glLinkProgram is called again.
+ */
+}
+
GLint GLAPIENTRY
_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
{