diff options
author | marha <marha@users.sourceforge.net> | 2011-08-09 08:20:19 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-09 08:20:19 +0200 |
commit | 93ed12672618a2e321cb79a3b3a656aae63d6beb (patch) | |
tree | f05cc2daca62dcd4b312e7bc0cf392cb8b53d5ce /mesalib/src/glsl/ast_function.cpp | |
parent | 0c2b3e6fd26158cb97f4210cc891e218801b4b25 (diff) | |
download | vcxsrv-93ed12672618a2e321cb79a3b3a656aae63d6beb.tar.gz vcxsrv-93ed12672618a2e321cb79a3b3a656aae63d6beb.tar.bz2 vcxsrv-93ed12672618a2e321cb79a3b3a656aae63d6beb.zip |
xrandrproto mesa git update 9 aug 2011
Diffstat (limited to 'mesalib/src/glsl/ast_function.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_function.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp index 8bcf48dfd..5b6ed3bc8 100644 --- a/mesalib/src/glsl/ast_function.cpp +++ b/mesalib/src/glsl/ast_function.cpp @@ -125,7 +125,7 @@ match_function_by_name(exec_list *instructions, const char *name, if (f == NULL) { f = new(ctx) ir_function(name); state->symbols->add_global_function(f); - emit_function(state, instructions, f); + emit_function(state, f); } f->add_signature(sig->clone_prototype(f, NULL)); @@ -199,6 +199,20 @@ match_function_by_name(exec_list *instructions, const char *name, */ ir_call *call = new(ctx) ir_call(sig, actual_parameters); if (!sig->return_type->is_void()) { + /* If the function call is a constant expression, don't + * generate the instructions to call it; just generate an + * ir_constant representing the constant value. + * + * Function calls can only be constant expressions starting + * in GLSL 1.20. + */ + if (state->language_version >= 120) { + ir_constant *const_val = call->constant_expression_value(); + if (const_val) { + return const_val; + } + } + ir_variable *var; ir_dereference_variable *deref; @@ -211,8 +225,6 @@ match_function_by_name(exec_list *instructions, const char *name, deref = new(ctx) ir_dereference_variable(var); ir_assignment *assign = new(ctx) ir_assignment(deref, call, NULL); instructions->push_tail(assign); - if (state->language_version >= 120) - var->constant_value = call->constant_expression_value(); deref = new(ctx) ir_dereference_variable(var); return deref; |