From 300ad09822db1013d9f28c4bca3680f865533ab6 Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Tue, 6 Nov 2012 13:42:48 -0800 Subject: [PATCH] Fix return type of glGetAttribLocation and glGetUniformLocation from int to GLint. See: http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetAttribLocation.xml http://www.khronos.org/opengles/sdk/docs/man/xhtml/glGetUniformLocation.xml Change-Id: I4a9f8e9e34b8c3cca239ae84bfe8f3cdfd94802a --- opengl/include/GLES2/gl2.h | 4 ++-- opengl/libs/GLES2/gl2_api.in | 4 ++-- opengl/libs/GLES_trace/src/gltrace_api.cpp | 8 ++++---- opengl/libs/GLES_trace/src/gltrace_api.h | 4 ++-- opengl/libs/GLES_trace/src/gltrace_fixup.cpp | 4 ++-- opengl/libs/entries.in | 4 ++-- opengl/libs/trace.in | 4 ++-- opengl/tests/gl_perf/fill_common.cpp | 6 +++--- opengl/tools/glgen/specs/gles11/GLES20.spec | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/opengl/include/GLES2/gl2.h b/opengl/include/GLES2/gl2.h index e1d3b87cc..c139c2517 100644 --- a/opengl/include/GLES2/gl2.h +++ b/opengl/include/GLES2/gl2.h @@ -528,7 +528,7 @@ GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL GLenum GL_APIENTRY glGetError (void); @@ -547,7 +547,7 @@ GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum p GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); diff --git a/opengl/libs/GLES2/gl2_api.in b/opengl/libs/GLES2/gl2_api.in index 9a89a52ca..cccf46c1b 100644 --- a/opengl/libs/GLES2/gl2_api.in +++ b/opengl/libs/GLES2/gl2_api.in @@ -169,7 +169,7 @@ void API_ENTRY(glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { CALL_GL_API(glGetAttachedShaders, program, maxcount, count, shaders); } -int API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) { +GLint API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) { CALL_GL_API_RETURN(glGetAttribLocation, program, name); } void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean* params) { @@ -226,7 +226,7 @@ void API_ENTRY(glGetUniformfv)(GLuint program, GLint location, GLfloat* params) void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint* params) { CALL_GL_API(glGetUniformiv, program, location, params); } -int API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) { +GLint API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) { CALL_GL_API_RETURN(glGetUniformLocation, program, name); } void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) { diff --git a/opengl/libs/GLES_trace/src/gltrace_api.cpp b/opengl/libs/GLES_trace/src/gltrace_api.cpp index cef6cbb16..2ae4b1112 100644 --- a/opengl/libs/GLES_trace/src/gltrace_api.cpp +++ b/opengl/libs/GLES_trace/src/gltrace_api.cpp @@ -2214,7 +2214,7 @@ void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* cou glContext->traceGLMessage(&glmsg); } -int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) { +GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2235,7 +2235,7 @@ int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) { // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - int retValue = glContext->hooks->gl.glGetAttribLocation(program, name); + GLint retValue = glContext->hooks->gl.glGetAttribLocation(program, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2996,7 +2996,7 @@ void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) { glContext->traceGLMessage(&glmsg); } -int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) { +GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3017,7 +3017,7 @@ int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) { // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - int retValue = glContext->hooks->gl.glGetUniformLocation(program, name); + GLint retValue = glContext->hooks->gl.glGetUniformLocation(program, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); diff --git a/opengl/libs/GLES_trace/src/gltrace_api.h b/opengl/libs/GLES_trace/src/gltrace_api.h index debcac0ac..309afcb33 100644 --- a/opengl/libs/GLES_trace/src/gltrace_api.h +++ b/opengl/libs/GLES_trace/src/gltrace_api.h @@ -78,7 +78,7 @@ void GLTrace_glGenTextures(GLsizei n, GLuint* textures); void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name); +GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name); void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params); void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params); GLenum GLTrace_glGetError(void); @@ -97,7 +97,7 @@ void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params); void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params); void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params); -int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name); +GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name); void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer); diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp index 3597b2601..393265490 100644 --- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp +++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp @@ -340,7 +340,7 @@ void fixup_glLinkProgram(GLMessage *glmsg) { /** Given a glGetActive[Uniform|Attrib] call, obtain the location * of the variable of given name in the call. */ -int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) { +GLint getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) { GLMessage_Function func = glmsg->function(); if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) { return -1; @@ -373,7 +373,7 @@ void fixup_glGetActiveAttribOrUniform(GLTraceContext *context, GLMessage *glmsg, // In order to make things simpler for the debugger, we also pass // a hidden location argument that stores the actual location. // append the location value to the end of the argument list - int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]); + GLint location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]); GLMessage_DataType *arg_location = glmsg->add_args(); arg_location->set_isarray(false); arg_location->set_type(GLMessage::DataType::INT); diff --git a/opengl/libs/entries.in b/opengl/libs/entries.in index 6316d7898..b9a51a49c 100644 --- a/opengl/libs/entries.in +++ b/opengl/libs/entries.in @@ -160,7 +160,7 @@ GL_ENTRY(void, glGenerateMipmapOES, GLenum target) GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) -GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name) +GL_ENTRY(GLint, glGetAttribLocation, GLuint program, const GLchar* name) GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params) GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params) GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params) @@ -218,7 +218,7 @@ GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params) GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params) GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params) -GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name) +GL_ENTRY(GLint, glGetUniformLocation, GLuint program, const GLchar* name) GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params) GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params) GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer) diff --git a/opengl/libs/trace.in b/opengl/libs/trace.in index a5c5c8438..e89e45653 100644 --- a/opengl/libs/trace.in +++ b/opengl/libs/trace.in @@ -160,7 +160,7 @@ TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", targe TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name) TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name) TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders), 4, "GLuint", program, "GLsizei", maxcount, "GLsizei*", count, "GLuint*", shaders) -TRACE_GL(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) +TRACE_GL(GLint, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean *params), (pname, params), 2, "GLenum", pname, "GLboolean *", params) TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params) @@ -218,7 +218,7 @@ TRACE_GL_VOID(glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) -TRACE_GL(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) +TRACE_GL(GLint, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat*", params) TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint*", params) TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "GLvoid**", pointer) diff --git a/opengl/tests/gl_perf/fill_common.cpp b/opengl/tests/gl_perf/fill_common.cpp index 389381fb3..fefedc093 100644 --- a/opengl/tests/gl_perf/fill_common.cpp +++ b/opengl/tests/gl_perf/fill_common.cpp @@ -189,7 +189,7 @@ static void setupVA() { } static void randUniform(int pgm, const char *var) { - int loc = glGetUniformLocation(pgm, var); + GLint loc = glGetUniformLocation(pgm, var); if (loc >= 0) { float x = ((float)rand()) / RAND_MAX; float y = ((float)rand()) / RAND_MAX; @@ -211,7 +211,7 @@ static void doLoop(bool warmup, int pgm, uint32_t passCount) { startTimer(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); for (uint32_t ct=0; ct < passCount; ct++) { - int loc = glGetUniformLocation(pgm, "u_texOff"); + GLint loc = glGetUniformLocation(pgm, "u_texOff"); glUniform2f(loc, ((float)ct) / passCount, ((float)ct) / 2.f / passCount); randUniform(pgm, "u_color"); @@ -271,7 +271,7 @@ static void doSingleTest(uint32_t pgmNum, int tex) { printf("error running test\n"); return; } - int loc = glGetUniformLocation(pgm, "u_tex0"); + GLint loc = glGetUniformLocation(pgm, "u_tex0"); if (loc >= 0) glUniform1i(loc, 0); loc = glGetUniformLocation(pgm, "u_tex1"); if (loc >= 0) glUniform1i(loc, 1); diff --git a/opengl/tools/glgen/specs/gles11/GLES20.spec b/opengl/tools/glgen/specs/gles11/GLES20.spec index ee88f5921..dda746e48 100644 --- a/opengl/tools/glgen/specs/gles11/GLES20.spec +++ b/opengl/tools/glgen/specs/gles11/GLES20.spec @@ -56,7 +56,7 @@ void glGenTextures ( GLsizei n, GLuint *textures ) void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) -int glGetAttribLocation ( GLuint program, const char *name ) +GLint glGetAttribLocation ( GLuint program, const char *name ) void glGetBooleanv ( GLenum pname, GLboolean *params ) void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) GLenum glGetError ( void ) @@ -75,7 +75,7 @@ void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) void glGetUniformiv ( GLuint program, GLint location, GLint *params ) -int glGetUniformLocation ( GLuint program, const char *name ) +GLint glGetUniformLocation ( GLuint program, const char *name ) void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) // void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer )