summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-26 17:35:24 +0200
committerSamuel Pitoiset <[email protected]>2017-06-28 10:25:13 +0200
commit34e5b39f37f6bd43676b3422b058c4df464c5ee7 (patch)
tree587b1207069670a3c560450c3c1d604f40c098cd /src
parent352adb53db342a5b9042680a5e81ffbca1b2a417 (diff)
mesa: add bind_attrib_location() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
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)