summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shaderobjects.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2006-03-21 10:37:40 +0000
committerMichal Krol <[email protected]>2006-03-21 10:37:40 +0000
commit071357096e682e9af59ad45ea5abc444ab431837 (patch)
tree99fba2183fe97981f7c309d99b206b39e43f5bec /src/mesa/shader/shaderobjects.c
parent519b23b21f9cd6945fd17cdb26e7a6f531cdeec0 (diff)
GLSL fixes:
- generate error on NULL pointers in glShaderSourceARB; - reinstall program object, if current, in glLinkProgramARB; - vertex and fragment shaders are optional in program object; - floor asm was wrongly computed for x86 back-end; - allow for (void) idiom in function prototypes; - all fixed-state uniforms are updated; - local variable initializers are working; - implement texture* and shadow* functions for vertex processor; - generate error if too many arguments in general constructor; - trim unused data in general constructor; - struct r-value field select was badly relocated; Changes: - add derived state gl_fog_attrib::_Scale; - add derived state gl_light::_CosCutoffNeg;
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 ad55b7448c5..998d4e455e1 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);
}