From eb88c02a4bd4bee19a0e92b65653e64a078ea5c5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 26 May 2010 22:40:38 -0600 Subject: [PATCH] mesa: rewrite _mesa_get_handle() and add some comments --- src/mesa/shader/shader_api.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 25853823a1c..03fb1a91cef 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -893,21 +893,28 @@ _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount, } +/** glGetHandleARB() - return ID/name of currently bound shader program */ static GLuint _mesa_get_handle(GLcontext *ctx, GLenum pname) { - GLint handle = 0; - if (pname == GL_PROGRAM_OBJECT_ARB) { - CALL_GetIntegerv(ctx->Exec, (GL_CURRENT_PROGRAM, &handle)); - } else { + if (ctx->Shader.CurrentProgram) + return ctx->Shader.CurrentProgram->Name; + else + return 0; + } + else { _mesa_error(ctx, GL_INVALID_ENUM, "glGetHandleARB"); + return 0; } - - return handle; } +/** + * glGetProgramiv() - get shader program state. + * Note that this is for GLSL shader programs, not ARB vertex/fragment + * programs (see glGetProgramivARB). + */ static void _mesa_get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params) @@ -977,6 +984,7 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program, } +/** glGetShaderiv() - get GLSL shader state */ static void _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params) { -- 2.30.2