mesa: Move _mesa_GetAttribLocationARB to shader_query.cpp

This allows querying the linked shader itself rather than the Mesa IR.
This is the first step towards removing gl_program::Attributes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2011-08-16 12:51:25 -07:00
parent 7bbcc0b832
commit b7fa0d0727
3 changed files with 90 additions and 42 deletions

View File

@@ -324,39 +324,6 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
}
static GLint
get_attrib_location(struct gl_context *ctx, GLuint program, const GLchar *name)
{
struct gl_shader_program *shProg
= _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
if (!shProg) {
return -1;
}
if (!shProg->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGetAttribLocation(program not linked)");
return -1;
}
if (!name)
return -1;
if (shProg->VertexProgram) {
const struct gl_program_parameter_list *attribs =
shProg->VertexProgram->Base.Attributes;
if (attribs) {
GLint i = _mesa_lookup_parameter_index(attribs, -1, name);
if (i >= 0) {
return attribs->Parameters[i].StateIndexes[0];
}
}
}
return -1;
}
static void
bind_attrib_location(struct gl_context *ctx, GLuint program, GLuint index,
const GLchar *name)
@@ -1316,14 +1283,6 @@ _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
}
GLint GLAPIENTRY
_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
{
GET_CURRENT_CONTEXT(ctx);
return get_attrib_location(ctx, program, name);
}
/* GL_EXT_gpu_shader4, GL3 */
GLint GLAPIENTRY
_mesa_GetFragDataLocation(GLuint program, const GLchar *name)