aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-03-15 14:27:22 -0700
committerIan Romanick <[email protected]>2013-04-08 15:17:05 -0700
commit666fafc144c254705d490915b6e150025780a87a (patch)
tree65eba376e5668b294748e784b43c3e1b2d162135 /src
parent46934adb8d855a9505f2231ba3f1ad5449b896a4 (diff)
glsl: Remove some unnecessary uses of error_emitted
The error_emitted flag is used in semantic checking to prevent spurious cascading errors. For example, void foo(sampler2D s, float a) { float x = a + (1.2 + s); ... } should only generate a single error. Without the error_emitted flag for the first error, "a + ..." would also generate an error. However, a bunch of cases in _mesa_ast_array_index_to_hir that were setting error_emitted would mask legitimate errors. For example, vec4 a[7]; float b = a[3.14]; should generate two error (float index and type mismatch in assignment). The uses of error_emitted would cause only the first to be emitted. This patch removes most of the places in _mesa_ast_array_index_to_hir that would set the error_emitted flag. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_array_index.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index fecda4592b6..9331bef4bde 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -43,17 +43,13 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
_mesa_glsl_error(& idx_loc, state,
"cannot dereference non-array / non-matrix / "
"non-vector");
- error_emitted = true;
+ result->type = glsl_type::error_type;
}
if (!idx->type->is_integer()) {
- _mesa_glsl_error(& idx_loc, state,
- "array index must be integer type");
- error_emitted = true;
+ _mesa_glsl_error(& idx_loc, state, "array index must be integer type");
} else if (!idx->type->is_scalar()) {
- _mesa_glsl_error(& idx_loc, state,
- "array index must be scalar");
- error_emitted = true;
+ _mesa_glsl_error(& idx_loc, state, "array index must be scalar");
}
/* If the array index is a constant expression and the array has a
@@ -101,11 +97,9 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
if (bound > 0) {
_mesa_glsl_error(& loc, state, "%s index must be < %u",
type_name, bound);
- error_emitted = true;
} else if (idx < 0) {
_mesa_glsl_error(& loc, state, "%s index must be >= 0",
type_name);
- error_emitted = true;
}
if (array->type->is_array()) {
@@ -122,8 +116,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
/* Check whether this access will, as a side effect, implicitly
* cause the size of a built-in array to be too large.
*/
- if (check_builtin_array_max_size(v->name, idx+1, loc, state))
- error_emitted = true;
+ check_builtin_array_max_size(v->name, idx+1, loc, state);
}
}
} else if (array->type->array_size() == 0) {
@@ -183,12 +176,8 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
"sampler arrays indexed with non-constant "
"expressions is forbidden in GLSL 1.30 and "
"later");
- error_emitted = true;
}
}
- if (error_emitted)
- result->type = glsl_type::error_type;
-
return result;
}