}
-/**
- * Return size (in floats) of the given GLSL type.
- * See also _slang_sizeof_type_specifier().
- */
-static GLint
-sizeof_glsl_type(GLenum type)
-{
- switch (type) {
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- return 2;
- case GL_BOOL_VEC3:
- case GL_FLOAT_VEC3:
- case GL_INT_VEC3:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- return 4;
- case GL_FLOAT_MAT2:
- return 8; /* 2 rows of 4, actually */
- case GL_FLOAT_MAT3:
- return 12; /* 3 rows of 4, actually */
- case GL_FLOAT_MAT4:
- return 16;
- case GL_FLOAT_MAT2x3:
- return 8; /* 2 rows of 4, actually */
- case GL_FLOAT_MAT2x4:
- return 8;
- case GL_FLOAT_MAT3x2:
- return 12; /* 3 rows of 4, actually */
- case GL_FLOAT_MAT3x4:
- return 12;
- case GL_FLOAT_MAT4x2:
- return 16; /* 4 rows of 4, actually */
- case GL_FLOAT_MAT4x3:
- return 16; /* 4 rows of 4, actually */
- default:
- return 0; /* error */
- }
-}
-
-
/**
* Called via ctx->Driver.AttachShader()
*/
}
+GLint
+_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
+ const GLchar *name)
+{
+ struct gl_shader_program *shProg
+ = _mesa_lookup_shader_program(ctx, program);
+
+ if (!shProg) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetAttribLocation");
+ return -1;
+ }
+
+ if (!shProg->LinkStatus) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetAttribLocation(program not linked)");
+ return -1;
+ }
+
+ if (!name)
+ return -1;
+
+ if (shProg->Attributes) {
+ GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name);
+ if (i >= 0) {
+ return shProg->Attributes->Parameters[i].StateIndexes[0];
+ }
+ }
+ return -1;
+}
+
+
void
_mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
const GLchar *name)
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
{
- struct gl_shader_program *shProg
+ const struct gl_shader_program *shProg
= _mesa_lookup_shader_program(ctx, program);
const struct gl_program *prog;
GLint progPos;
}
-GLint
-_mesa_get_attrib_location(GLcontext *ctx, GLuint program,
- const GLchar *name)
-{
- struct gl_shader_program *shProg
- = _mesa_lookup_shader_program(ctx, program);
-
- if (!shProg) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetAttribLocation");
- return -1;
- }
-
- if (!shProg->LinkStatus) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glGetAttribLocation(program not linked)");
- return -1;
- }
-
- if (!name)
- return -1;
-
- if (shProg->Attributes) {
- GLint i = _mesa_lookup_parameter_index(shProg->Attributes, -1, name);
- if (i >= 0) {
- return shProg->Attributes->Parameters[i].StateIndexes[0];
- }
- }
- return -1;
-}
-
-
GLuint
_mesa_get_handle(GLcontext *ctx, GLenum pname)
{