summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/arbprogram.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2006-11-23 15:58:30 +0000
committerBrian Paul <[email protected]>2006-11-23 15:58:30 +0000
commit308b85f29f191409e42935a3ccd5c502bdf70608 (patch)
tree03de268e41f9265113667586ca8ba8b85e9a0891 /src/mesa/shader/arbprogram.c
parent897b9c5cb2e9d4d155b07dc6cf25de648fb3bf20 (diff)
fix several program-related bugs (bug 9136)
Diffstat (limited to 'src/mesa/shader/arbprogram.c')
-rw-r--r--src/mesa/shader/arbprogram.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index 91fb6910381..bff80d7ee3a 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -195,13 +195,15 @@ _mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer)
GLboolean GLAPIENTRY
_mesa_IsProgramARB(GLuint id)
{
+ struct gl_program *prog = NULL;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (id == 0)
return GL_FALSE;
- if (_mesa_lookup_program(ctx, id))
+ prog = _mesa_lookup_program(ctx, id);
+ if (prog && (prog != &_mesa_DummyProgram))
return GL_TRUE;
else
return GL_FALSE;
@@ -765,6 +767,7 @@ void GLAPIENTRY
_mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
{
const struct gl_program *prog;
+ char *dst = (char *) string;
GET_CURRENT_CONTEXT(ctx);
if (!ctx->_CurrentProgram)
@@ -788,5 +791,8 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
return;
}
- _mesa_memcpy(string, prog->String, _mesa_strlen((char *) prog->String));
+ if (prog->String)
+ _mesa_memcpy(dst, prog->String, _mesa_strlen((char *) prog->String));
+ else
+ *dst = '\0';
}