From: Jeremy Huddleston Sequoia Date: Sun, 8 May 2016 07:47:10 +0000 (-0700) Subject: mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7ef901650b92052d07f578a7884c53e93554d4c;p=mesa.git mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB Signed-off-by: Jeremy Huddleston Sequoia Reviewed-by: Matt Turner --- diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 6dd617be7e5..72824355838 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -513,10 +513,12 @@ detach_shader_no_error(struct gl_context *ctx, GLuint program, GLuint shader) /** * Return list of shaders attached to shader program. + * \param objOut returns GLuint ids + * \param handleOut returns GLhandleARB handles */ static void get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount, - GLsizei *count, GLuint *obj) + GLsizei *countOut, GLuint *objOut, GLhandleARB *handleOut) { struct gl_shader_program *shProg; @@ -531,14 +533,20 @@ get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount, if (shProg) { GLuint i; for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) { - obj[i] = shProg->Shaders[i]->Name; + if (objOut) { + objOut[i] = shProg->Shaders[i]->Name; + } + + if (handleOut) { + handleOut[i] = (GLhandleARB) shProg->Shaders[i]->Name; + } + } + if (countOut) { + *countOut = i; } - if (count) - *count = i; } } - /** * glGetHandleARB() - return ID/name of currently bound shader program. */ @@ -1575,7 +1583,7 @@ _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount, GLsizei * count, GLhandleARB * obj) { GET_CURRENT_CONTEXT(ctx); - get_attached_shaders(ctx, container, maxCount, count, obj); + get_attached_shaders(ctx, (GLuint)container, maxCount, count, NULL, obj); } @@ -1584,7 +1592,7 @@ _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj) { GET_CURRENT_CONTEXT(ctx); - get_attached_shaders(ctx, program, maxCount, count, obj); + get_attached_shaders(ctx, program, maxCount, count, obj, NULL); }