From 2be54a8e8ccb206eeedd319cf48a3c81797b83a4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 8 Jul 2008 16:17:04 -0600 Subject: mesa: implement glGetUniformiv() with new ctx->Driver function The old implementation could overwrite the caller's param buffer. --- src/mesa/main/dd.h | 2 ++ src/mesa/main/shaders.c | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index e3ded41aca..8edcfaf8c6 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -868,6 +868,8 @@ struct dd_function_table { GLsizei *length, GLcharARB *sourceOut); void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location, GLfloat *params); + void (*GetUniformiv)(GLcontext *ctx, GLuint program, GLint location, + GLint *params); GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program, const GLcharARB *name); GLboolean (*IsProgram)(GLcontext *ctx, GLuint name); diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index b7b2f791a5..a2670fda32 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -128,6 +128,7 @@ _mesa_DeleteObjectARB(GLhandleARB obj) void GLAPIENTRY _mesa_DeleteProgram(GLuint name) { + printf("%s name=%u\n", __FUNCTION__, name); if (name) { GET_CURRENT_CONTEXT(ctx); ctx->Driver.DeleteProgram2(ctx, name); @@ -309,11 +310,7 @@ void GLAPIENTRY _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params) { GET_CURRENT_CONTEXT(ctx); - GLfloat fparams[16]; /* XXX is 16 enough? */ - GLuint i; - ctx->Driver.GetUniformfv(ctx, program, location, fparams); - for (i = 0; i < 16; i++) - params[i] = (GLint) fparams[i]; /* XXX correct? */ + ctx->Driver.GetUniformiv(ctx, program, location, params); } -- cgit v1.2.3