summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-05-14 16:02:20 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-05-14 16:02:20 -0600
commit6c536b9924a46e3e6f4eb93369b2e7006182ba39 (patch)
tree9f80dc6632314481bec14b331bbdd5ea44768a36 /src/mesa/shader
parentf84005c0a114837a0c7209a3c598e02fb5f47da1 (diff)
mesa: fix errors in LightModelProduct state, other misc error cases
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_builtin.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 1081d8ff8d..f0f59aa87a 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -250,7 +250,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
}
}
else if (strcmp(var, "gl_FrontLightModelProduct") == 0) {
- if (strcmp(field, "ambient") == 0) {
+ if (strcmp(field, "sceneColor") == 0) {
tokens[0] = STATE_LIGHTMODEL_SCENECOLOR;
tokens[1] = 0;
}
@@ -259,7 +259,7 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
}
}
else if (strcmp(var, "gl_BackLightModelProduct") == 0) {
- if (strcmp(field, "ambient") == 0) {
+ if (strcmp(field, "sceneColor") == 0) {
tokens[0] = STATE_LIGHTMODEL_SCENECOLOR;
tokens[1] = 1;
}
@@ -397,6 +397,8 @@ lookup_statevar(const char *var, GLint index1, GLint index2, const char *field,
* var.field
* var[i].field
* var[i][j]
+ *
+ * \return -1 upon error, else position in paramList of the state var/data
*/
GLint
_slang_alloc_statevar(slang_ir_node *n,
@@ -414,9 +416,13 @@ _slang_alloc_statevar(slang_ir_node *n,
if (n->Opcode == IR_ELEMENT) {
/* XXX can only handle constant indexes for now */
- assert(n->Children[1]->Opcode == IR_FLOAT);
- index1 = (GLint) n->Children[1]->Value[0];
- n = n->Children[0];
+ if (n->Children[1]->Opcode == IR_FLOAT) {
+ index1 = (GLint) n->Children[1]->Value[0];
+ n = n->Children[0];
+ }
+ else {
+ return -1;
+ }
}
if (n->Opcode == IR_ELEMENT) {