aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-07-22 08:25:25 +0200
committermarha <marha@users.sourceforge.net>2011-07-22 08:25:25 +0200
commitc70e21be1fe5f9b47bce020ffd8d69c6012b21fc (patch)
tree2ae24d451df0e12093fd82c2cd466e05dfe1aaa0 /mesalib/src/glsl/ast_to_hir.cpp
parent556198b74eecf7e9f7105a792a33bf699cff6507 (diff)
parent91e91b72f07f4e61db17ee86c6933a7217f0e25c (diff)
downloadvcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.tar.gz
vcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.tar.bz2
vcxsrv-c70e21be1fe5f9b47bce020ffd8d69c6012b21fc.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/gallium/auxiliary/util/u_vbuf_mgr.c mesalib/src/glsl/ast_function.cpp mesalib/src/glsl/ast_to_hir.cpp mesalib/src/glsl/glsl_types.cpp mesalib/src/glsl/ir.cpp mesalib/src/glsl/ir.h mesalib/src/glsl/linker.cpp mesalib/src/glsl/s_expression.cpp mesalib/src/mesa/drivers/common/driverfuncs.c mesalib/src/mesa/main/dd.h mesalib/src/mesa/main/fbobject.c mesalib/src/mesa/main/teximage.c mesalib/src/mesa/state_tracker/st_cb_texture.c
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 546c18c35..e1cecc11b 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -83,6 +83,8 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
foreach_list_typed (ast_node, ast, link, & state->translation_unit)
ast->hir(instructions, state);
+
+ detect_recursion_unlinked(state, instructions);
}
@@ -2704,6 +2706,17 @@ ast_declarator_list::hir(exec_list *instructions,
: "and integer");
}
+ /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "[Sampler types] can only be declared as function
+ * parameters or uniform variables (see Section 4.3.5
+ * "Uniform")".
+ */
+ if (var_type->contains_sampler() &&
+ !this->type->qualifier.flags.q.uniform) {
+ _mesa_glsl_error(&loc, state, "samplers must be declared uniform");
+ }
+
/* Process the initializer and add its instructions to a temporary
* list. This list will be added to the instruction stream (below) after
* the declaration is added. This is done because in some cases (such as
@@ -2864,6 +2877,18 @@ ast_parameter_declarator::hir(exec_list *instructions,
*/
apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc);
+ /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "Samplers cannot be treated as l-values; hence cannot be used
+ * as out or inout function parameters, nor can they be assigned
+ * into."
+ */
+ if ((var->mode == ir_var_inout || var->mode == ir_var_out)
+ && type->contains_sampler()) {
+ _mesa_glsl_error(&loc, state, "out and inout parameters cannot contain samplers");
+ type = glsl_type::error_type;
+ }
+
instructions->push_tail(var);
/* Parameter declarations do not have r-values.
@@ -2992,6 +3017,18 @@ ast_function::hir(exec_list *instructions,
"function `%s' return type has qualifiers", name);
}
+ /* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
+ *
+ * "[Sampler types] can only be declared as function parameters
+ * or uniform variables (see Section 4.3.5 "Uniform")".
+ */
+ if (return_type->contains_sampler()) {
+ YYLTYPE loc = this->get_location();
+ _mesa_glsl_error(&loc, state,
+ "function `%s' return type can't contain a sampler",
+ name);
+ }
+
/* Verify that this function's signature either doesn't match a previously
* seen signature for a function with the same name, or, if a match is found,
* that the previously seen signature does not have an associated definition.