summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-28 17:03:16 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-28 17:03:16 -0700
commit43de17282017bdf187d6e646de3262cc64b7f46b (patch)
tree048cb0bd33b3e3c34295f727fa95dc7a3bacd91d /ast_to_hir.cpp
parent66faec4895b7bb59a614087a200c05157191b4ae (diff)
Generate more correctly diagnostics from some invalid initializers
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index ce64794ae2..d6aa3bce57 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -981,6 +981,8 @@ ast_declarator_list::hir(exec_list *instructions,
instructions->push_tail(var);
if (decl->initializer != NULL) {
+ YYLTYPE initializer_loc = decl->initializer->get_location();
+
/* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
*
* "All uniform variables are read-only and are initialized either
@@ -989,10 +991,22 @@ ast_declarator_list::hir(exec_list *instructions,
*/
if ((state->language_version <= 110)
&& (var->mode == ir_var_uniform)) {
- YYLTYPE loc = decl->initializer->get_location();
+ _mesa_glsl_error(& initializer_loc, state,
+ "cannot initialize uniforms in GLSL 1.10");
+ }
+
+ if (var->type->is_sampler()) {
+ _mesa_glsl_error(& initializer_loc, state,
+ "cannot initialize samplers");
+ }
- _mesa_glsl_error(& loc, state, "uniform initializers forbidden in "
- "GLSL 1.10");
+ if ((var->mode == ir_var_in) && (state->current_function == NULL)) {
+ _mesa_glsl_error(& initializer_loc, state,
+ "cannot initialize %s shader input / %s",
+ (state->target == vertex_shader)
+ ? "vertex" : "fragment",
+ (state->target == vertex_shader)
+ ? "attribute" : "varying");
}
ir_dereference *const lhs = new ir_dereference(var);