summaryrefslogtreecommitdiff
path: root/src/mesa/shader/shaderobjects.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/shaderobjects.c')
-rw-r--r--src/mesa/shader/shaderobjects.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/src/mesa/shader/shaderobjects.c b/src/mesa/shader/shaderobjects.c
index ad55b7448c..998d4e455e 100644
--- a/src/mesa/shader/shaderobjects.c
+++ b/src/mesa/shader/shaderobjects.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 2004-2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -200,7 +200,14 @@ _mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **s
GET_SHADER(sha, shaderObj, "glShaderSourceARB");
if (sha == NULL)
- return;
+ return;
+
+ if (string == NULL)
+ {
+ RELEASE_SHADER(sha);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
+ }
/*
* This array holds offsets of where the appropriate string ends, thus the last
@@ -215,7 +222,14 @@ _mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **s
}
for (i = 0; i < count; i++)
- {
+ {
+ if (string[i] == NULL)
+ {
+ _mesa_free ((GLvoid *) offsets);
+ RELEASE_SHADER(sha);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
+ }
if (length == NULL || length[i] < 0)
offsets[i] = _mesa_strlen (string[i]);
else
@@ -291,11 +305,14 @@ _mesa_LinkProgramARB (GLhandleARB programObj)
if (pro != NULL)
{
- if (pro == ctx->ShaderObjects.CurrentProgram)
- {
- /* TODO re-install executable program */
+ (**pro).Link (pro);
+ if (pro == ctx->ShaderObjects.CurrentProgram)
+ {
+ if ((**pro).GetLinkStatus (pro))
+ _mesa_UseProgramObjectARB (programObj);
+ else
+ _mesa_UseProgramObjectARB (0);
}
- (**pro).Link (pro);
RELEASE_PROGRAM(pro);
}
}
@@ -309,7 +326,7 @@ _mesa_UseProgramObjectARB (GLhandleARB programObj)
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (programObj != 0)
- {
+ {
GET_PROGRAM(pro, programObj, "glUseProgramObjectARB");
if (pro == NULL)
@@ -322,7 +339,16 @@ _mesa_UseProgramObjectARB (GLhandleARB programObj)
return;
}
- program = pro;
+ program = pro;
+
+ ctx->ShaderObjects._VertexShaderPresent = (**pro).IsShaderPresent (pro, GL_VERTEX_SHADER_ARB);
+ ctx->ShaderObjects._FragmentShaderPresent = (**pro).IsShaderPresent (pro,
+ GL_FRAGMENT_SHADER_ARB);
+ }
+ else
+ {
+ ctx->ShaderObjects._VertexShaderPresent = GL_FALSE;
+ ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;
}
if (ctx->ShaderObjects.CurrentProgram != NULL)
@@ -1060,7 +1086,9 @@ _mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name)
GLvoid
_mesa_init_shaderobjects (GLcontext *ctx)
{
- ctx->ShaderObjects.CurrentProgram = NULL;
+ ctx->ShaderObjects.CurrentProgram = NULL;
+ ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;
+ ctx->ShaderObjects._VertexShaderPresent = GL_FALSE;
_mesa_init_shaderobjects_3dlabs (ctx);
}