From 363c14ae0cd2baa624d85e8c9db12cd1677190ea Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Wed, 2 May 2012 23:11:42 +0200 Subject: glsl: Change built-in constant expression evaluation to run the IR. This removes code duplication with ir_expression::constant_expression_value and builtins/ir/*. Signed-off-by: Olivier Galibert Reviewed-by: Kenneth Graunke --- src/glsl/ir.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/glsl/ir.h') diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 92be063747f..9c7961ab92c 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -576,6 +576,21 @@ private: const ir_function_signature *origin; friend class ir_function; + + /** + * Helper function to run a list of instructions for constant + * expression evaluation. + * + * The hash table represents the values of the visible variables. + * There are no scoping issues because the table is indexed on + * ir_variable pointers, not variable names. + * + * Returns false if the expression is not constant, true otherwise, + * and the value in *result if result is non-NULL. + */ + bool constant_expression_evaluate_expression_list(const struct exec_list &body, + struct hash_table *variable_context, + ir_constant **result); }; -- cgit v1.2.3