diff options
author | marha <marha@users.sourceforge.net> | 2011-08-09 08:25:48 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-09 08:25:48 +0200 |
commit | 8a2c8f93072dc4c9a1f9275b09ac3f2af481f56a (patch) | |
tree | 24b60778dfbd64e217b8b08ae4ce465687128d80 /mesalib/src/glsl/ast_to_hir.cpp | |
parent | f8e53281a55d43ae1b17f848f28579d74d877835 (diff) | |
parent | 93ed12672618a2e321cb79a3b3a656aae63d6beb (diff) | |
download | vcxsrv-8a2c8f93072dc4c9a1f9275b09ac3f2af481f56a.tar.gz vcxsrv-8a2c8f93072dc4c9a1f9275b09ac3f2af481f56a.tar.bz2 vcxsrv-8a2c8f93072dc4c9a1f9275b09ac3f2af481f56a.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
X11/extensions/randr.h
mesalib/src/glsl/ast_function.cpp
mesalib/src/glsl/ast_to_hir.cpp
mesalib/src/glsl/glsl_parser_extras.h
mesalib/src/glsl/link_functions.cpp
mesalib/src/glsl/linker.cpp
mesalib/src/mesa/state_tracker/st_program.c
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_to_hir.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index e16f69018..d4f5065cc 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -66,6 +66,8 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) state->current_function = NULL;
+ state->toplevel_ir = instructions;
+
/* Section 4.2 of the GLSL 1.20 specification states:
* "The built-in functions are scoped in a scope outside the global scope
* users declare global variables in. That is, a shader's global scope,
@@ -85,6 +87,8 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) ast->hir(instructions, state);
detect_recursion_unlinked(state, instructions);
+
+ state->toplevel_ir = NULL;
}
@@ -1765,11 +1769,6 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, ir_rvalue *const ir = array_size->hir(& dummy_instructions, state);
YYLTYPE loc = array_size->get_location();
- /* FINISHME: Verify that the grammar forbids side-effects in array
- * FINISHME: sizes. i.e., 'vec4 [x = 12] data'
- */
- assert(dummy_instructions.is_empty());
-
if (ir != NULL) {
if (!ir->type->is_integer()) {
_mesa_glsl_error(& loc, state, "array size must be integer type");
@@ -1786,6 +1785,14 @@ process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size, } else {
assert(size->type == ir->type);
length = size->value.u[0];
+
+ /* If the array size is const (and we've verified that
+ * it is) then no instructions should have been emitted
+ * when we converted it to HIR. If they were emitted,
+ * then either the array size isn't const after all, or
+ * we are emitting unnecessary instructions.
+ */
+ assert(dummy_instructions.is_empty());
}
}
}
@@ -2926,23 +2933,16 @@ ast_parameter_declarator::parameters_to_hir(exec_list *ast_parameters, void
-emit_function(_mesa_glsl_parse_state *state, exec_list *instructions,
- ir_function *f)
+emit_function(_mesa_glsl_parse_state *state, ir_function *f)
{
- /* Emit the new function header */
- if (state->current_function == NULL) {
- instructions->push_tail(f);
- } else {
- /* IR invariants disallow function declarations or definitions nested
- * within other function definitions. Insert the new ir_function
- * block in the instruction sequence before the ir_function block
- * containing the current ir_function_signature.
- */
- ir_function *const curr =
- const_cast<ir_function *>(state->current_function->function());
-
- curr->insert_before(f);
- }
+ /* IR invariants disallow function declarations or definitions
+ * nested within other function definitions. But there is no
+ * requirement about the relative order of function declarations
+ * and definitions with respect to one another. So simply insert
+ * the new ir_function block at the end of the toplevel instruction
+ * list.
+ */
+ state->toplevel_ir->push_tail(f);
}
@@ -3069,7 +3069,7 @@ ast_function::hir(exec_list *instructions, return NULL;
}
- emit_function(state, instructions, f);
+ emit_function(state, f);
}
/* Verify the return type of main() */
|