summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/shader_query.cpp48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6efbc379656..9086a904f3d 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -62,30 +62,26 @@ DECL_RESOURCE_FUNC(XFV, gl_transform_feedback_varying_info);
DECL_RESOURCE_FUNC(XFB, gl_transform_feedback_buffer);
DECL_RESOURCE_FUNC(SUB, gl_subroutine_function);
-void GLAPIENTRY
-_mesa_BindAttribLocation(GLuint program, GLuint index,
- const GLchar *name)
+static void
+bind_attrib_location(struct gl_context *ctx,
+ struct gl_shader_program *const shProg, GLuint index,
+ const GLchar *name, bool no_error)
{
- GET_CURRENT_CONTEXT(ctx);
-
- 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 (!no_error) {
+ if (strncmp(name, "gl_", 3) == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindAttribLocation(illegal name)");
+ return;
+ }
- if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(%u >= %u)",
- index, ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs);
- return;
+ if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindAttribLocation(%u >= %u)",
+ index, ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs);
+ return;
+ }
}
/* Replace the current value if it's already in the list. Add
@@ -101,6 +97,20 @@ _mesa_BindAttribLocation(GLuint program, GLuint index,
}
void GLAPIENTRY
+_mesa_BindAttribLocation(GLuint program, GLuint index,
+ const GLchar *name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ struct gl_shader_program *const shProg =
+ _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
+ if (!shProg)
+ return;
+
+ bind_attrib_location(ctx, shProg, index, name, false);
+}
+
+void GLAPIENTRY
_mesa_GetActiveAttrib(GLuint program, GLuint desired_index,
GLsizei maxLength, GLsizei * length, GLint * size,
GLenum * type, GLchar * name)