[Mesa-dev] [PATCH 3/4] mesa: untangle GLhandleARB vs. GLuint usage
Brian Paul
brianp at vmware.com
Sat Mar 8 17:10:45 PST 2014
Create separate core (GLuint) and ARB (GLhandleARB) shader functions.
For example: we previously had:
_mesa_CompileShader(GLhandleARB shader)
Now there's two functions:
_mesa_CompileShader(GLuint shader)
_mesa_CompileShaderARB(GLhandleARB shader)
In most cases, the later now simply calls the former after
converting the GLhandleARB into a GLuint.
The new _mesa_handle_to_uint() and _mesa_uint_to_handle() functions
are used to convert between GLhandleARB and GLuint.
---
src/mesa/main/dlist.c | 14 ++-
src/mesa/main/shader_query.cpp | 37 +++++--
src/mesa/main/shaderapi.c | 207 ++++++++++++++++++++++++---------------
src/mesa/main/shaderapi.h | 115 ++++++++++++++++++----
src/mesa/main/uniform_query.cpp | 11 +++
src/mesa/main/uniforms.c | 20 +++-
src/mesa/main/uniforms.h | 29 ++++++
7 files changed, 328 insertions(+), 105 deletions(-)
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index d431fd2..6035ec0 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -5891,9 +5891,8 @@ save_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
}
}
-/* aka UseProgram() */
static void GLAPIENTRY
-save_UseProgramObjectARB(GLhandleARB program)
+save_UseProgram(GLuint program)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
@@ -5909,6 +5908,14 @@ save_UseProgramObjectARB(GLhandleARB program)
static void GLAPIENTRY
+save_UseProgramObjectARB(GLhandleARB program)
+{
+ GLuint id = _mesa_handle_to_uint(program);
+ save_UseProgram(id);
+}
+
+
+static void GLAPIENTRY
save_Uniform1fARB(GLint location, GLfloat x)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8720,7 +8727,8 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
SET_BlitFramebuffer(table, save_BlitFramebufferEXT);
- SET_UseProgram(table, save_UseProgramObjectARB);
+ SET_UseProgram(table, save_UseProgram);
+// SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
SET_Uniform1f(table, save_Uniform1fARB);
SET_Uniform2f(table, save_Uniform2fARB);
SET_Uniform3f(table, save_Uniform3fARB);
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index e1afe53..7360f58 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -40,8 +40,7 @@ extern "C" {
}
void GLAPIENTRY
-_mesa_BindAttribLocation(GLhandleARB program, GLuint index,
- const GLcharARB *name)
+_mesa_BindAttribLocation(GLuint program, GLuint index, const GLcharARB *name)
{
GET_CURRENT_CONTEXT(ctx);
@@ -76,10 +75,19 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
*/
}
+
void GLAPIENTRY
-_mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
- GLsizei maxLength, GLsizei * length, GLint * size,
- GLenum * type, GLcharARB * name)
+_mesa_BindAttribLocationARB(GLhandleARB program, GLuint index,
+ const GLcharARB *name)
+{
+ _mesa_BindAttribLocation(_mesa_handle_to_uint(program), index, name);
+}
+
+
+void GLAPIENTRY
+_mesa_GetActiveAttrib(GLuint program, GLuint desired_index,
+ GLsizei maxLength, GLsizei * length, GLint * size,
+ GLenum * type, GLcharARB * name)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
@@ -131,8 +139,18 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveAttrib(index)");
}
+void GLAPIENTRY
+_mesa_GetActiveAttribARB(GLhandleARB program, GLuint desired_index,
+ GLsizei maxLength, GLsizei *length, GLint *size,
+ GLenum *type, GLcharARB *name)
+{
+ _mesa_GetActiveAttrib(_mesa_handle_to_uint(program), desired_index,
+ maxLength, length, size, type, name);
+}
+
+
GLint GLAPIENTRY
-_mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
+_mesa_GetAttribLocation(GLuint program, const GLcharARB * name)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *const shProg =
@@ -182,6 +200,13 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
}
+GLint GLAPIENTRY
+_mesa_GetAttribLocationARB(GLhandleARB program, const GLcharARB * name)
+{
+ return _mesa_GetAttribLocation(_mesa_handle_to_uint(program), name);
+}
+
+
unsigned
_mesa_count_active_attribs(struct gl_shader_program *shProg)
{
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 5060cbb..0687203 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -439,26 +439,6 @@ detach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
/**
- * Return list of shaders attached to shader program.
- */
-static void
-get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj)
-{
- struct gl_shader_program *shProg =
- _mesa_lookup_shader_program_err(ctx, program, "glGetAttachedShaders");
- if (shProg) {
- GLuint i;
- for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) {
- obj[i] = shProg->Shaders[i]->Name;
- }
- if (count)
- *count = i;
- }
-}
-
-
-/**
* glGetHandleARB() - return ID/name of currently bound shader program.
*/
static GLuint
@@ -1108,9 +1088,8 @@ validate_program(struct gl_context *ctx, GLuint program)
}
-
void GLAPIENTRY
-_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
+_mesa_AttachShader(GLuint program, GLuint shader)
{
GET_CURRENT_CONTEXT(ctx);
attach_shader(ctx, program, shader);
@@ -1118,20 +1097,28 @@ _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
void GLAPIENTRY
-_mesa_AttachShader(GLuint program, GLuint shader)
+_mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
{
- GET_CURRENT_CONTEXT(ctx);
- attach_shader(ctx, program, shader);
+ _mesa_AttachShader(_mesa_handle_to_uint(program),
+ _mesa_handle_to_uint(shader));
}
void GLAPIENTRY
-_mesa_CompileShader(GLhandleARB shaderObj)
+_mesa_CompileShader(GLuint shader)
{
GET_CURRENT_CONTEXT(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glCompileShader %u\n", shaderObj);
- compile_shader(ctx, shaderObj);
+ _mesa_debug(ctx, "glCompileShader %u\n", shader);
+ compile_shader(ctx, shader);
+}
+
+
+void GLAPIENTRY
+_mesa_CompileShaderARB(GLhandleARB shaderObj)
+{
+ GLuint id = _mesa_handle_to_uint(shaderObj);
+ _mesa_CompileShader(id);
}
@@ -1149,7 +1136,7 @@ GLhandleARB GLAPIENTRY
_mesa_CreateShaderObjectARB(GLenum type)
{
GET_CURRENT_CONTEXT(ctx);
- return create_shader(ctx, type);
+ return _mesa_uint_to_handle(create_shader(ctx, type));
}
@@ -1167,26 +1154,27 @@ GLhandleARB GLAPIENTRY
_mesa_CreateProgramObjectARB(void)
{
GET_CURRENT_CONTEXT(ctx);
- return create_shader_program(ctx);
+ return _mesa_uint_to_handle(create_shader_program(ctx));
}
void GLAPIENTRY
_mesa_DeleteObjectARB(GLhandleARB obj)
{
+ GLuint id = _mesa_handle_to_uint(obj);
if (MESA_VERBOSE & VERBOSE_API) {
GET_CURRENT_CONTEXT(ctx);
- _mesa_debug(ctx, "glDeleteObjectARB(%u)\n", obj);
+ _mesa_debug(ctx, "glDeleteObjectARB(%u)\n", id);
}
- if (obj) {
+ if (id) {
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);
- if (is_program(ctx, obj)) {
- delete_shader_program(ctx, obj);
+ if (is_program(ctx, id)) {
+ delete_shader_program(ctx, id);
}
- else if (is_shader(ctx, obj)) {
- delete_shader(ctx, obj);
+ else if (is_shader(ctx, id)) {
+ delete_shader(ctx, id);
}
else {
/* error? */
@@ -1221,7 +1209,9 @@ void GLAPIENTRY
_mesa_DetachObjectARB(GLhandleARB program, GLhandleARB shader)
{
GET_CURRENT_CONTEXT(ctx);
- detach_shader(ctx, program, shader);
+ detach_shader(ctx,
+ _mesa_handle_to_uint(program),
+ _mesa_handle_to_uint(shader));
}
@@ -1234,36 +1224,75 @@ _mesa_DetachShader(GLuint program, GLuint shader)
void GLAPIENTRY
+_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
+ GLsizei * count, GLuint *shaders)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ const struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program, "glGetAttachedShaders");
+ if (shProg) {
+ GLuint i;
+ for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) {
+ shaders[i] = shProg->Shaders[i]->Name;
+ }
+ if (count)
+ *count = i;
+ }
+}
+
+
+void GLAPIENTRY
_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
- GLsizei * count, GLhandleARB * obj)
+ GLsizei *count, GLhandleARB *obj)
{
GET_CURRENT_CONTEXT(ctx);
- get_attached_shaders(ctx, container, maxCount, count, obj);
+ const GLuint program = _mesa_handle_to_uint(container);
+ const struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program, "glGetAttachedObjectsARB");
+ if (shProg) {
+ GLuint i;
+ for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) {
+ /* As above, but return GLhandleARB instead of GLuint */
+ obj[i] = _mesa_uint_to_handle(shProg->Shaders[i]->Name);
+ }
+ if (count)
+ *count = i;
+ }
}
void GLAPIENTRY
-_mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
- GLsizei *count, GLuint *obj)
+_mesa_GetShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ get_shader_info_log(ctx, shader, maxLength, length, infoLog);
+}
+
+
+void GLAPIENTRY
+_mesa_GetProgramInfoLog(GLuint program, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog)
{
GET_CURRENT_CONTEXT(ctx);
- get_attached_shaders(ctx, program, maxCount, count, obj);
+ get_program_info_log(ctx, program, maxLength, length, infoLog);
}
void GLAPIENTRY
-_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
- GLcharARB * infoLog)
+_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog)
{
+ GLuint id = _mesa_handle_to_uint(object);
GET_CURRENT_CONTEXT(ctx);
- if (is_program(ctx, object)) {
- get_program_info_log(ctx, object, maxLength, length, infoLog);
+ if (is_program(ctx, id)) {
+ get_program_info_log(ctx, id, maxLength, length, infoLog);
}
- else if (is_shader(ctx, object)) {
- get_shader_info_log(ctx, object, maxLength, length, infoLog);
+ else if (is_shader(ctx, id)) {
+ get_shader_info_log(ctx, id, maxLength, length, infoLog);
}
else {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetShaderInfoLog");
}
}
@@ -1271,22 +1300,23 @@ _mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei * length,
void GLAPIENTRY
_mesa_GetObjectParameterivARB(GLhandleARB object, GLenum pname, GLint *params)
{
+ GLuint id = _mesa_handle_to_uint(object);
GET_CURRENT_CONTEXT(ctx);
/* Implement in terms of GetProgramiv, GetShaderiv */
- if (is_program(ctx, object)) {
+ if (is_program(ctx, id)) {
if (pname == GL_OBJECT_TYPE_ARB) {
*params = GL_PROGRAM_OBJECT_ARB;
}
else {
- get_programiv(ctx, object, pname, params);
+ get_programiv(ctx, id, pname, params);
}
}
- else if (is_shader(ctx, object)) {
+ else if (is_shader(ctx, id)) {
if (pname == GL_OBJECT_TYPE_ARB) {
*params = GL_SHADER_OBJECT_ARB;
}
else {
- get_shaderiv(ctx, object, pname, params);
+ get_shaderiv(ctx, id, pname, params);
}
}
else {
@@ -1322,29 +1352,20 @@ _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
void GLAPIENTRY
-_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
+_mesa_GetShaderSource(GLuint shader, GLsizei maxLength,
+ GLsizei *length, GLcharARB *sourceOut)
{
GET_CURRENT_CONTEXT(ctx);
- get_program_info_log(ctx, program, bufSize, length, infoLog);
-}
-
-
-void GLAPIENTRY
-_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog)
-{
- GET_CURRENT_CONTEXT(ctx);
- get_shader_info_log(ctx, shader, bufSize, length, infoLog);
+ get_shader_source(ctx, shader, maxLength, length, sourceOut);
}
void GLAPIENTRY
-_mesa_GetShaderSource(GLhandleARB shader, GLsizei maxLength,
+_mesa_GetShaderSourceARB(GLhandleARB shader, GLsizei maxLength,
GLsizei *length, GLcharARB *sourceOut)
{
- GET_CURRENT_CONTEXT(ctx);
- get_shader_source(ctx, shader, maxLength, length, sourceOut);
+ _mesa_GetShaderSource(_mesa_handle_to_uint(shader), maxLength,
+ length, sourceOut);
}
@@ -1352,7 +1373,7 @@ GLhandleARB GLAPIENTRY
_mesa_GetHandleARB(GLenum pname)
{
GET_CURRENT_CONTEXT(ctx);
- return get_handle(ctx, pname);
+ return _mesa_uint_to_handle(get_handle(ctx, pname));
}
@@ -1373,13 +1394,20 @@ _mesa_IsShader(GLuint name)
void GLAPIENTRY
-_mesa_LinkProgram(GLhandleARB programObj)
+_mesa_LinkProgram(GLuint programObj)
{
GET_CURRENT_CONTEXT(ctx);
link_program(ctx, programObj);
}
+void GLAPIENTRY
+_mesa_LinkProgramARB(GLhandleARB programObj)
+{
+ _mesa_LinkProgram(_mesa_handle_to_uint(programObj));
+}
+
+
/**
* Read shader source code from a file.
@@ -1416,8 +1444,8 @@ read_shader(const char *fname)
* and pass it to _mesa_shader_source().
*/
void GLAPIENTRY
-_mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
- const GLcharARB * const * string, const GLint * length)
+_mesa_ShaderSource(GLuint shader, GLsizei count,
+ const GLcharARB * const * string, const GLint * length)
{
GET_CURRENT_CONTEXT(ctx);
GLint *offsets;
@@ -1425,7 +1453,7 @@ _mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
GLcharARB *source;
GLuint checksum;
- if (!shaderObj || string == NULL) {
+ if (!shader || string == NULL) {
_mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB");
return;
}
@@ -1491,16 +1519,16 @@ _mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
newSource = read_shader(filename);
if (newSource) {
fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
- shaderObj, checksum, filename);
+ shader, checksum, filename);
free(source);
source = newSource;
}
}
- shader_source(ctx, shaderObj, source);
+ shader_source(ctx, shader, source);
if (SHADER_SUBST) {
- struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj);
+ struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
if (sh)
sh->SourceChecksum = checksum; /* save original checksum */
}
@@ -1510,7 +1538,16 @@ _mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
void GLAPIENTRY
-_mesa_UseProgram(GLhandleARB program)
+_mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
+ const GLcharARB const ** string, const GLint * length)
+{
+ GLuint shader = _mesa_handle_to_uint(shaderObj);
+ _mesa_ShaderSource(shader, count, string, length);
+}
+
+
+void GLAPIENTRY
+_mesa_UseProgram(GLuint program)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
@@ -1546,13 +1583,27 @@ _mesa_UseProgram(GLhandleARB program)
void GLAPIENTRY
-_mesa_ValidateProgram(GLhandleARB program)
+_mesa_UseProgramObjectARB(GLhandleARB handle)
+{
+ _mesa_UseProgram(_mesa_handle_to_uint(handle));
+}
+
+
+void GLAPIENTRY
+_mesa_ValidateProgram(GLuint program)
{
GET_CURRENT_CONTEXT(ctx);
validate_program(ctx, program);
}
+void GLAPIENTRY
+_mesa_ValidateProgramARB(GLhandleARB program)
+{
+ _mesa_ValidateProgram(_mesa_handle_to_uint(program));
+}
+
+
/**
* For OpenGL ES 2.0, GL_ARB_ES2_compatibility
*/
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index 44426cc..ea44d6f 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -40,6 +40,48 @@ struct _glapi_table;
struct gl_context;
struct gl_shader_program;
+
+union handle_uint {
+ GLhandleARB handle;
+ GLuint ui;
+};
+
+/** Convert a GLhandleARB to GLuint */
+static INLINE GLuint
+_mesa_handle_to_uint(GLhandleARB handle)
+{
+#ifdef __APPLE__
+ /* As of glext.h version 20130624, on Mac OS X, GLhandleARB is defined
+ * as a pointer instead of an unsigned int. We use a union here to do
+ * the conversion and assume that the bits we care about are in the least
+ * significant bits of the handle, and we're on a little-endian system.
+ */
+ union handle_uint temp;
+ assert(sizeof(GLhandleARB) >= sizeof(GLuint));
+ temp.handle = handle;
+ return temp.ui;
+#else
+ return handle;
+#endif
+}
+
+
+/** Convert a GLuint id to a GLhandleARB */
+static INLINE GLhandleARB
+_mesa_uint_to_handle(GLuint id)
+{
+#ifdef __APPLE__
+ union handle_uint temp;
+ memset(&temp, 0, sizeof(temp)); /* to clear the high/unused bits */
+ temp.ui = id;
+ return temp.handle;
+#else
+ return id;
+#endif
+}
+
+
+
extern GLbitfield
_mesa_get_shader_flags(void);
@@ -61,10 +103,16 @@ extern size_t
_mesa_longest_attribute_name_length(struct gl_shader_program *shProg);
extern void GLAPIENTRY
+_mesa_AttachShader(GLuint program, GLuint shader);
+
+extern void GLAPIENTRY
_mesa_AttachObjectARB(GLhandleARB, GLhandleARB);
-extern void GLAPIENTRY
-_mesa_CompileShader(GLhandleARB);
+extern void GLAPIENTRY
+_mesa_CompileShader(GLuint shader);
+
+extern void GLAPIENTRY
+_mesa_CompileShaderARB(GLhandleARB);
extern GLhandleARB GLAPIENTRY
_mesa_CreateProgramObjectARB(void);
@@ -100,7 +148,10 @@ extern void GLAPIENTRY
_mesa_GetObjectParameterivARB(GLhandleARB, GLenum, GLint *);
extern void GLAPIENTRY
-_mesa_GetShaderSource(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
+_mesa_GetShaderSource(GLuint, GLsizei, GLsizei *, GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetShaderSourceARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
extern GLboolean GLAPIENTRY
_mesa_IsProgram(GLuint name);
@@ -109,20 +160,35 @@ extern GLboolean GLAPIENTRY
_mesa_IsShader(GLuint name);
extern void GLAPIENTRY
-_mesa_LinkProgram(GLhandleARB programObj);
+_mesa_LinkProgram(GLuint programObj);
extern void GLAPIENTRY
-_mesa_ShaderSource(GLhandleARB, GLsizei, const GLcharARB* const *, const GLint *);
+_mesa_LinkProgramARB(GLhandleARB programObj);
extern void GLAPIENTRY
-_mesa_UseProgram(GLhandleARB);
+_mesa_ShaderSource(GLuint, GLsizei, const GLcharARB* const *, const GLint *);
extern void GLAPIENTRY
-_mesa_ValidateProgram(GLhandleARB);
+_mesa_ShaderSourceARB(GLhandleARB, GLsizei, const GLcharARB **, const GLint *);
+extern void GLAPIENTRY
+_mesa_UseProgram(GLuint);
extern void GLAPIENTRY
-_mesa_BindAttribLocation(GLhandleARB, GLuint, const GLcharARB *);
+_mesa_UseProgramObjectARB(GLhandleARB);
+
+extern void GLAPIENTRY
+_mesa_ValidateProgram(GLuint);
+
+extern void GLAPIENTRY
+_mesa_ValidateProgramARB(GLhandleARB);
+
+
+extern void GLAPIENTRY
+_mesa_BindAttribLocation(GLuint, GLuint, const GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_BindAttribLocationARB(GLhandleARB, GLuint, const GLcharARB *);
extern void GLAPIENTRY
_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
@@ -133,11 +199,18 @@ _mesa_BindFragDataLocationIndexed(GLuint program, GLuint colorNumber,
GLuint index, const GLchar *name);
extern void GLAPIENTRY
-_mesa_GetActiveAttrib(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *,
+_mesa_GetActiveAttrib(GLuint, GLuint, GLsizei, GLsizei *, GLint *,
+ GLenum *, GLcharARB *);
+
+extern void GLAPIENTRY
+_mesa_GetActiveAttribARB(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *,
GLenum *, GLcharARB *);
extern GLint GLAPIENTRY
-_mesa_GetAttribLocation(GLhandleARB, const GLcharARB *);
+_mesa_GetAttribLocation(GLuint, const GLcharARB *);
+
+extern GLint GLAPIENTRY
+_mesa_GetAttribLocationARB(GLhandleARB, const GLcharARB *);
@@ -164,18 +237,26 @@ _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
GLsizei *count, GLuint *obj);
extern void GLAPIENTRY
-_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params);
+_mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
+ GLsizei *count, GLhandleARB *objects);
extern void GLAPIENTRY
-_mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
+_mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params);
-extern void GLAPIENTRY
-_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params);
+void GLAPIENTRY
+_mesa_GetShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog);
+
+void GLAPIENTRY
+_mesa_GetProgramInfoLog(GLuint program, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog);
+
+void GLAPIENTRY
+_mesa_GetInfoLogARB(GLhandleARB object, GLsizei maxLength, GLsizei *length,
+ GLcharARB *infoLog);
extern void GLAPIENTRY
-_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
- GLsizei *length, GLchar *infoLog);
+_mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params);
extern void GLAPIENTRY
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 09c9212..3ee2f59 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -74,6 +74,17 @@ _mesa_GetActiveUniform(GLuint program, GLuint index,
}
}
+
+extern "C" void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
+ GLsizei maxLength, GLsizei *length, GLint *size,
+ GLenum *type, GLcharARB *nameOut)
+{
+ _mesa_GetActiveUniform(_mesa_handle_to_uint(program), index, maxLength,
+ length, size, type, nameOut);
+}
+
+
extern "C" void GLAPIENTRY
_mesa_GetActiveUniformsiv(GLuint program,
GLsizei uniformCount,
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index e9b374b..3bd1fe1 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -835,6 +835,12 @@ _mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params)
_mesa_GetnUniformfvARB(program, location, INT_MAX, params);
}
+void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB program, GLint location, GLfloat *params)
+{
+ _mesa_GetUniformfv(_mesa_handle_to_uint(program), location, params);
+}
+
void GLAPIENTRY
_mesa_GetnUniformivARB(GLuint program, GLint location,
@@ -850,6 +856,12 @@ _mesa_GetUniformiv(GLuint program, GLint location, GLint *params)
_mesa_GetnUniformivARB(program, location, INT_MAX, params);
}
+void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint *params)
+{
+ _mesa_GetUniformiv(_mesa_handle_to_uint(program), location, params);
+}
+
/* GL3 */
void GLAPIENTRY
@@ -935,6 +947,12 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
return _mesa_uniform_merge_location_offset(shProg, index, offset);
}
+GLint GLAPIENTRY
+_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
+{
+ return _mesa_GetUniformLocation(_mesa_handle_to_uint(programObj), name);
+}
+
GLuint GLAPIENTRY
_mesa_GetUniformBlockIndex(GLuint program,
const GLchar *uniformBlockName)
@@ -1190,7 +1208,7 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
return;
if (uniformIndex >= shProg->NumUserUniformStorage) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniformName(index)");
return;
}
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index ba21b79..af3bd17 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -196,37 +196,56 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count,
void GLAPIENTRY
_mesa_GetnUniformfvARB(GLuint, GLint, GLsizei, GLfloat *);
+
void GLAPIENTRY
_mesa_GetUniformfv(GLuint, GLint, GLfloat *);
+
+void GLAPIENTRY
+_mesa_GetUniformfvARB(GLhandleARB, GLint, GLfloat *);
+
void GLAPIENTRY
_mesa_GetnUniformivARB(GLuint, GLint, GLsizei, GLint *);
+
void GLAPIENTRY
_mesa_GetUniformuiv(GLuint, GLint, GLuint *);
+
void GLAPIENTRY
_mesa_GetnUniformuivARB(GLuint, GLint, GLsizei, GLuint *);
+
void GLAPIENTRY
_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params);
+
void GLAPIENTRY
_mesa_GetnUniformdvARB(GLuint, GLint, GLsizei, GLdouble *);
+
void GLAPIENTRY
_mesa_GetUniformdv(GLuint, GLint, GLdouble *);
+
GLint GLAPIENTRY
_mesa_GetUniformLocation(GLuint, const GLcharARB *);
+
+GLint GLAPIENTRY
+_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
+
GLuint GLAPIENTRY
_mesa_GetUniformBlockIndex(GLuint program,
const GLchar *uniformBlockName);
+
void GLAPIENTRY
_mesa_GetUniformIndices(GLuint program,
GLsizei uniformCount,
const GLchar * const *uniformNames,
GLuint *uniformIndices);
+
void GLAPIENTRY
_mesa_UniformBlockBinding(GLuint program,
GLuint uniformBlockIndex,
GLuint uniformBlockBinding);
+
void GLAPIENTRY
_mesa_GetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex,
GLenum pname, GLint *params);
+
void GLAPIENTRY
_mesa_GetActiveUniformBlockiv(GLuint program,
GLuint uniformBlockIndex,
@@ -242,18 +261,28 @@ void GLAPIENTRY
_mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex,
GLsizei bufSize, GLsizei *length,
GLchar *uniformName);
+
void GLAPIENTRY
_mesa_GetActiveUniform(GLuint, GLuint, GLsizei, GLsizei *,
GLint *, GLenum *, GLcharARB *);
+
+void GLAPIENTRY
+_mesa_GetActiveUniformARB(GLhandleARB, GLuint, GLsizei, GLsizei *,
+ GLint *, GLenum *, GLcharARB *);
+
void GLAPIENTRY
_mesa_GetActiveUniformsiv(GLuint program,
GLsizei uniformCount,
const GLuint *uniformIndices,
GLenum pname,
GLint *params);
+
void GLAPIENTRY
_mesa_GetUniformiv(GLuint, GLint, GLint *);
+void GLAPIENTRY
+_mesa_GetUniformivARB(GLhandleARB, GLint, GLint *);
+
long
_mesa_parse_program_resource_name(const GLchar *name,
const GLchar **out_base_name_end);
--
1.7.10.4
More information about the mesa-dev
mailing list