diff options
author | Kenneth Graunke <[email protected]> | 2010-04-28 23:01:33 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-05-14 16:34:46 -0700 |
commit | b3262128fe2322854377a3af65f924ab27c5fb3b (patch) | |
tree | 61970490a8d6cfe7dd45b207a639492146e9f8f4 | |
parent | 4c7367b3f99236dc664d547b7806680ffcf89d15 (diff) |
Replace old builtin_function.cpp with new autogenerated one.
-rw-r--r-- | builtin_function.cpp | 2004 |
1 files changed, 1226 insertions, 778 deletions
diff --git a/builtin_function.cpp b/builtin_function.cpp index ff731c21625..ef3a5c8d4b9 100644 --- a/builtin_function.cpp +++ b/builtin_function.cpp @@ -1,3 +1,4 @@ +/* DO NOT MODIFY - automatically generated by generate_builtins.pl */ /* * Copyright © 2010 Intel Corporation * @@ -21,796 +22,1243 @@ * DEALINGS IN THE SOFTWARE. */ -#include <stdlib.h> -#include <math.h> -#include "glsl_symbol_table.h" +#include <stdio.h> #include "glsl_parser_extras.h" -#include "glsl_types.h" -#include "ir.h" - -static void -generate_unop(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type, - enum ir_expression_operation op) -{ - ir_dereference *const arg = new ir_dereference(declarations[0]); - ir_rvalue *result; - - result = new ir_expression(op, type, arg, NULL); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_binop(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type, - enum ir_expression_operation op) -{ - ir_dereference *const arg1 = new ir_dereference(declarations[0]); - ir_dereference *const arg2 = new ir_dereference(declarations[1]); - ir_rvalue *result; - - result = new ir_expression(op, type, arg1, arg2); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_radians(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg = new ir_dereference(declarations[0]); - ir_rvalue *result; - - result = new ir_expression(ir_binop_mul, type, - arg, - new ir_constant((float)(M_PI / 180.0))); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_degrees(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg = new ir_dereference(declarations[0]); - ir_rvalue *result; - - result = new ir_expression(ir_binop_mul, type, - arg, - new ir_constant((float)(180.0 / M_PI))); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_exp(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_exp); -} - -static void -generate_log(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_log); -} - -static void -generate_exp2(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_exp2); -} - -static void -generate_log2(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_log2); -} - -static void -generate_rsq(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_rsq); -} - -static void -generate_sqrt(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_sqrt); -} - -static void -generate_abs(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_abs); -} - -static void -generate_ceil(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_ceil); -} - -static void -generate_floor(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_unop(instructions, declarations, type, ir_unop_floor); -} - -static void -generate_mod(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_binop(instructions, declarations, type, ir_binop_mod); -} - -static void -generate_min(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_binop(instructions, declarations, type, ir_binop_min); -} - -static void -generate_max(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_binop(instructions, declarations, type, ir_binop_max); -} - -static void -generate_clamp(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const x = new ir_dereference(declarations[0]); - ir_dereference *const minval = new ir_dereference(declarations[1]); - ir_dereference *const maxval = new ir_dereference(declarations[2]); - ir_rvalue *result; - - result = new ir_expression(ir_binop_min, type, x, maxval); - result = new ir_expression(ir_binop_max, type, result, minval); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_mix_vec(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const x = new ir_dereference(declarations[0]); - ir_dereference *const y = new ir_dereference(declarations[1]); - ir_dereference *const a = new ir_dereference(declarations[2]); - ir_rvalue *result, *temp; - - temp = new ir_expression(ir_binop_sub, type, new ir_constant(1.0f), a); - result = new ir_expression(ir_binop_mul, type, x, temp); - - temp = new ir_expression(ir_binop_mul, type, y, a); - result = new ir_expression(ir_binop_add, type, result, temp); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - - -static void -generate_normalize(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg = new ir_dereference(declarations[0]); - ir_rvalue *temp; - ir_rvalue *result; - - temp = new ir_expression(ir_binop_dot, glsl_type::float_type, arg, arg); - temp = new ir_expression(ir_unop_rsq, glsl_type::float_type, temp, NULL); - result = new ir_expression(ir_binop_mul, type, arg, temp); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - - -static void -generate_pow(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_binop(instructions, declarations, type, ir_binop_pow); -} +#include "ir_reader.h" void -generate_function_instance(ir_function *f, - int n_args, - void (*generate)(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type), - const glsl_type *ret_type, - const glsl_type *type) -{ - ir_variable *declarations[16]; - - ir_function_signature *const sig = new ir_function_signature(ret_type); - f->add_signature(sig); - - static const char *arg_names[] = { - "arg0", - "arg1", - "arg2" - }; - int i; - - for (i = 0; i < n_args; i++) { - ir_variable *var = new ir_variable(type, arg_names[i]); - - var->mode = ir_var_in; - sig->parameters.push_tail(var); - - declarations[i] = var; - } - - generate(&sig->body, declarations, type); - sig->is_defined = true; -} - -void -make_gentype_function(glsl_symbol_table *symtab, exec_list *instructions, - const char *name, - int n_args, - void (*generate)(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type)) -{ - ir_function *const f = new ir_function(name); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, n_args, generate, - glsl_type::float_type, glsl_type::float_type); - generate_function_instance(f, n_args, generate, - glsl_type::vec2_type, glsl_type::vec2_type); - generate_function_instance(f, n_args, generate, - glsl_type::vec3_type, glsl_type::vec3_type); - generate_function_instance(f, n_args, generate, - glsl_type::vec4_type, glsl_type::vec4_type); -} - -static void -generate_vec_compare(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type, - enum ir_expression_operation op) -{ - ir_dereference *const x = new ir_dereference(declarations[0]); - ir_dereference *const y = new ir_dereference(declarations[1]); - ir_variable *temp; - const glsl_type *return_type; - int i; - - return_type = glsl_type::get_instance(GLSL_TYPE_BOOL, - type->vector_elements, 1); - temp = new ir_variable(return_type, "temp"); - instructions->push_tail(temp); - - for (i = 0; i < type->vector_elements; i++) { - ir_assignment *assign; - ir_expression *compare; - - compare = new ir_expression(op, - glsl_type::get_instance(type->base_type, - 1, 1), - new ir_swizzle(x, i, 0, 0, 0, 1), - new ir_swizzle(y, i, 0, 0, 0, 1)); - assign = new ir_assignment(new ir_swizzle(new ir_dereference(temp), - i, 0, 0, 0, 1), - compare, NULL); - instructions->push_tail(assign); - } - ir_instruction *inst = new ir_return(new ir_dereference(temp)); - instructions->push_tail(inst); -} - -static void -generate_lessThan(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_vec_compare(instructions, declarations, type, ir_binop_less); -} - -static void -generate_lessThanEqual(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) +read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions, + const char **functions, unsigned count) { - generate_vec_compare(instructions, declarations, type, ir_binop_lequal); -} + if (st->error) + return; -static void -generate_greaterThan(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_vec_compare(instructions, declarations, type, ir_binop_greater); -} + for (unsigned i = 0; i < count; i++) { + _mesa_glsl_read_ir(st, instructions, functions[i]); -static void -generate_greaterThanEqual(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_vec_compare(instructions, declarations, type, ir_binop_gequal); -} - -static void -generate_equal(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_vec_compare(instructions, declarations, type, ir_binop_equal); -} - -static void -generate_notEqual(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - generate_vec_compare(instructions, declarations, type, ir_binop_nequal); -} - -static void -generate_vec_compare_function(glsl_symbol_table *symtab, - exec_list *instructions, - const char *name, - void (*generate)(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type), - bool do_bool) -{ - ir_function *const f = new ir_function(name); - const glsl_type *ivec2_type = glsl_type::get_instance(GLSL_TYPE_INT, 2, 1); - const glsl_type *ivec3_type = glsl_type::get_instance(GLSL_TYPE_INT, 3, 1); - const glsl_type *ivec4_type = glsl_type::get_instance(GLSL_TYPE_INT, 4, 1); - const glsl_type *uvec2_type = glsl_type::get_instance(GLSL_TYPE_UINT, 2, 1); - const glsl_type *uvec3_type = glsl_type::get_instance(GLSL_TYPE_UINT, 3, 1); - const glsl_type *uvec4_type = glsl_type::get_instance(GLSL_TYPE_UINT, 4, 1); - const glsl_type *bvec2_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 2, 1); - const glsl_type *bvec3_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 3, 1); - const glsl_type *bvec4_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 2, generate, - bvec2_type, glsl_type::vec2_type); - generate_function_instance(f, 2, generate, - bvec3_type, glsl_type::vec3_type); - generate_function_instance(f, 2, generate, - bvec4_type, glsl_type::vec4_type); - - generate_function_instance(f, 2, generate, - bvec2_type, ivec2_type); - generate_function_instance(f, 2, generate, - bvec3_type, ivec3_type); - generate_function_instance(f, 2, generate, - bvec4_type, ivec4_type); - - generate_function_instance(f, 2, generate, - bvec2_type, uvec2_type); - generate_function_instance(f, 2, generate, - bvec3_type, uvec3_type); - generate_function_instance(f, 2, generate, - bvec4_type, uvec4_type); - - if (do_bool) { - generate_function_instance(f, 2, generate, - bvec2_type, bvec2_type); - generate_function_instance(f, 2, generate, - bvec3_type, bvec3_type); - generate_function_instance(f, 2, generate, - bvec4_type, bvec4_type); + if (st->error) { + printf("error reading builtin: %.35s ...\n", functions[i]); + return; + } } } -static void -generate_length(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg = new ir_dereference(declarations[0]); - ir_rvalue *result, *temp; - - (void)type; - - /* FINISHME: implement the abs(arg) variant for length(float f) */ - - temp = new ir_expression(ir_binop_dot, glsl_type::float_type, arg, arg); - result = new ir_expression(ir_unop_sqrt, glsl_type::float_type, temp, NULL); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -void -generate_length_functions(glsl_symbol_table *symtab, exec_list *instructions) -{ - const char *name = "length"; - ir_function *const f = new ir_function(name); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 1, generate_length, - glsl_type::float_type, glsl_type::float_type); - generate_function_instance(f, 1, generate_length, - glsl_type::float_type, glsl_type::vec2_type); - generate_function_instance(f, 1, generate_length, - glsl_type::float_type, glsl_type::vec3_type); - generate_function_instance(f, 1, generate_length, - glsl_type::float_type, glsl_type::vec4_type); -} - -static void -generate_dot(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_dereference *const arg1 = new ir_dereference(declarations[1]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_dot, glsl_type::float_type, arg0, arg1); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -void -generate_dot_functions(glsl_symbol_table *symtab, exec_list *instructions) -{ - const char *name = "dot"; - ir_function *const f = new ir_function(name); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 2, generate_dot, - glsl_type::float_type, glsl_type::float_type); - generate_function_instance(f, 2, generate_dot, - glsl_type::float_type, glsl_type::vec2_type); - generate_function_instance(f, 2, generate_dot, - glsl_type::float_type, glsl_type::vec3_type); - generate_function_instance(f, 2, generate_dot, - glsl_type::float_type, glsl_type::vec4_type); -} - -static void -generate_any_bvec2(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_any_bvec3(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 2, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_any_bvec4(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 2, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_or, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 3, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_all_bvec2(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_all_bvec3(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 2, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_all_bvec4(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - (void)type; - - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - new ir_swizzle(arg0, 0, 0, 0, 0, 1), - new ir_swizzle(arg0, 1, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 2, 0, 0, 0, 1)); - result = new ir_expression(ir_binop_logic_and, glsl_type::bool_type, - result, - new ir_swizzle(arg0, 3, 0, 0, 0, 1)); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -static void -generate_not(exec_list *instructions, - ir_variable **declarations, - const glsl_type *type) -{ - ir_dereference *const arg0 = new ir_dereference(declarations[0]); - ir_rvalue *result; - - result = new ir_expression(ir_unop_logic_not, type, arg0, NULL); - - ir_instruction *inst = new ir_return(result); - instructions->push_tail(inst); -} - -void -generate_any_functions(glsl_symbol_table *symtab, exec_list *instructions) -{ - const char *name = "any"; - ir_function *const f = new ir_function(name); - const glsl_type *bvec2_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 2, 1); - const glsl_type *bvec3_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 3, 1); - const glsl_type *bvec4_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 1, generate_any_bvec2, - glsl_type::bool_type, bvec2_type); - generate_function_instance(f, 1, generate_any_bvec3, - glsl_type::bool_type, bvec3_type); - generate_function_instance(f, 1, generate_any_bvec4, - glsl_type::bool_type, bvec4_type); -} +/* Version 110 builtins */ + +static const char *builtins_110_abs = { + "((function abs\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float abs (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 abs (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 abs (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 abs (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_all = { + "((function all\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool && (expression bool && (expression bool && (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_any = { + "((function any\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))))))\n" + "\n" + " (signature bool\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bool || (expression bool || (expression bool || (swiz x (var_ref arg0))(swiz y (var_ref arg0))) (swiz z (var_ref arg0))) (swiz w (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_ceil = { + "((function ceil\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float ceil (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 ceil (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 ceil (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_clamp = { + "((function clamp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float max (expression float min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 max (expression vec2 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 max (expression vec3 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 max (expression vec4 min (var_ref arg0) (var_ref arg2)) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_degrees = { + "((function degrees\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (57.295780))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (57.295780))))))\n" + "))\n" +}; + +static const char *builtins_110_dot = { + "((function dot\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_equal = { + "((function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_exp = { + "((function exp\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_exp2 = { + "((function exp2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 exp2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 exp2 (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_floor = { + "((function floor\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float floor (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 floor (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 floor (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 floor (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_greaterThan = { + "((function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_greaterThanEqual = { + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_inversesqrt = { + "((function inversesqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float rsq (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 rsq (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 rsq (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_length = { + "((function length\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "\n" + " (signature float\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n" + "))\n" +}; + +static const char *builtins_110_lessThan = { + "((function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_lessThanEqual = { + "((function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_log = { + "((function log\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_log2 = { + "((function log2\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float log2 (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 log2 (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 log2 (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_max = { + "((function max\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 max (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 max (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_min = { + "((function min\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 min (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 min (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_mix = { + "((function mix\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1)\n" + " (declare (in) float arg2))\n" + " ((return (expression float + (expression float * (var_ref arg0) (expression float - (constant float (1.000000)) (var_ref arg2))) (expression float * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1)\n" + " (declare (in) vec2 arg2))\n" + " ((return (expression vec2 + (expression vec2 * (var_ref arg0) (expression vec2 - (constant float (1.000000)) (var_ref arg2))) (expression vec2 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1)\n" + " (declare (in) vec3 arg2))\n" + " ((return (expression vec3 + (expression vec3 * (var_ref arg0) (expression vec3 - (constant float (1.000000)) (var_ref arg2))) (expression vec3 * (var_ref arg1) (var_ref arg2))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1)\n" + " (declare (in) vec4 arg2))\n" + " ((return (expression vec4 + (expression vec4 * (var_ref arg0) (expression vec4 - (constant float (1.000000)) (var_ref arg2))) (expression vec4 * (var_ref arg1) (var_ref arg2))))))\n" + "))\n" +}; + +static const char *builtins_110_mod = { + "((function mod\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 % (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 % (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_normalize = { + "((function normalize\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n" + "))\n" +}; + +static const char *builtins_110_not = { + "((function not\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) bvec2 arg0))\n" + " ((return (expression bvec2 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) bvec3 arg0))\n" + " ((return (expression bvec3 ! (var_ref arg0)))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) bvec4 arg0))\n" + " ((return (expression bvec4 ! (var_ref arg0)))))\n" + "))\n" +}; + +static const char *builtins_110_notEqual = { + "((function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression float != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression float != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression float != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression float != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) ivec2 arg0)\n" + " (declare (in) ivec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) ivec3 arg0)\n" + " (declare (in) ivec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) ivec4 arg0)\n" + " (declare (in) ivec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression int != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression int != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression int != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression int != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_110_pow = { + "((function pow\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0)\n" + " (declare (in) float arg1))\n" + " ((return (expression float pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0)\n" + " (declare (in) vec2 arg1))\n" + " ((return (expression vec2 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0)\n" + " (declare (in) vec3 arg1))\n" + " ((return (expression vec3 pow (var_ref arg0) (var_ref arg1)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0)\n" + " (declare (in) vec4 arg1))\n" + " ((return (expression vec4 pow (var_ref arg0) (var_ref arg1)))))\n" + "))\n" +}; + +static const char *builtins_110_radians = { + "((function radians\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 * (var_ref arg0) (constant float (0.017453))))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 * (var_ref arg0) (constant float (0.017453))))))\n" + "))\n" +}; + +static const char *builtins_110_sqrt = { + "((function sqrt\n" + " (signature float\n" + " (parameters\n" + " (declare (in) float arg0))\n" + " ((return (expression float sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec2\n" + " (parameters\n" + " (declare (in) vec2 arg0))\n" + " ((return (expression vec2 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec3\n" + " (parameters\n" + " (declare (in) vec3 arg0))\n" + " ((return (expression vec3 sqrt (var_ref arg0)))))\n" + "\n" + " (signature vec4\n" + " (parameters\n" + " (declare (in) vec4 arg0))\n" + " ((return (expression vec4 sqrt (var_ref arg0)))))\n" + "))\n" +}; + +static const char *functions_for_110 [] = { + builtins_110_abs, + builtins_110_all, + builtins_110_any, + builtins_110_ceil, + builtins_110_clamp, + builtins_110_degrees, + builtins_110_dot, + builtins_110_equal, + builtins_110_exp, + builtins_110_exp2, + builtins_110_floor, + builtins_110_greaterThan, + builtins_110_greaterThanEqual, + builtins_110_inversesqrt, + builtins_110_length, + builtins_110_lessThan, + builtins_110_lessThanEqual, + builtins_110_log, + builtins_110_log2, + builtins_110_max, + builtins_110_min, + builtins_110_mix, + builtins_110_mod, + builtins_110_normalize, + builtins_110_not, + builtins_110_notEqual, + builtins_110_pow, + builtins_110_radians, + builtins_110_sqrt, +}; + +/* Version 130 builtins */ + +static const char *builtins_130_equal = { + "((function equal\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_greaterThan = { + "((function greaterThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_greaterThanEqual = { + "((function greaterThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_lessThan = { + "((function lessThan\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_lessThanEqual = { + "((function lessThanEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *builtins_130_notEqual = { + "((function notEqual\n" + " (signature bvec2\n" + " (parameters\n" + " (declare (in) uvec2 arg0)\n" + " (declare (in) uvec2 arg1))\n" + " ((declare () bvec2 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec3\n" + " (parameters\n" + " (declare (in) uvec3 arg0)\n" + " (declare (in) uvec3 arg1))\n" + " ((declare () bvec3 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "\n" + " (signature bvec4\n" + " (parameters\n" + " (declare (in) uvec4 arg0)\n" + " (declare (in) uvec4 arg1))\n" + " ((declare () bvec4 temp)\n" + " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression uint != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression uint != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression uint != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n" + " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression uint != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n" + " (return (var_ref temp))))\n" + "))\n" +}; + +static const char *functions_for_130 [] = { + builtins_130_equal, + builtins_130_greaterThan, + builtins_130_greaterThanEqual, + builtins_130_lessThan, + builtins_130_lessThanEqual, + builtins_130_notEqual, +}; void -generate_all_functions(glsl_symbol_table *symtab, exec_list *instructions) -{ - const char *name = "all"; - ir_function *const f = new ir_function(name); - const glsl_type *bvec2_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 2, 1); - const glsl_type *bvec3_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 3, 1); - const glsl_type *bvec4_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 1, generate_all_bvec2, - glsl_type::bool_type, bvec2_type); - generate_function_instance(f, 1, generate_all_bvec3, - glsl_type::bool_type, bvec3_type); - generate_function_instance(f, 1, generate_all_bvec4, - glsl_type::bool_type, bvec4_type); -} - -void -generate_not_functions(glsl_symbol_table *symtab, exec_list *instructions) +_mesa_glsl_initialize_functions(exec_list *instructions, + struct _mesa_glsl_parse_state *state) { - const char *name = "not"; - ir_function *const f = new ir_function(name); - const glsl_type *bvec2_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 2, 1); - const glsl_type *bvec3_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 3, 1); - const glsl_type *bvec4_type = glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1); - - bool added = symtab->add_function(name, f); - assert(added); - - instructions->push_tail(f); - - generate_function_instance(f, 1, generate_not, - bvec2_type, bvec2_type); - generate_function_instance(f, 1, generate_not, - bvec3_type, bvec3_type); - generate_function_instance(f, 1, generate_not, - bvec4_type, bvec4_type); -} + if (state->language_version >= 110) + read_builtins(state, instructions, functions_for_110, + sizeof(functions_for_110) / sizeof(const char *)); -void -generate_110_functions(glsl_symbol_table *symtab, exec_list *instructions) -{ - make_gentype_function(symtab, instructions, "radians", 1, generate_radians); - make_gentype_function(symtab, instructions, "degrees", 1, generate_degrees); - /* FINISHME: sin() */ - /* FINISHME: cos() */ - /* FINISHME: tan() */ - /* FINISHME: asin() */ - /* FINISHME: acos() */ - /* FINISHME: atan(y,x) */ - /* FINISHME: atan(y/x) */ - make_gentype_function(symtab, instructions, "pow", 2, generate_pow); - make_gentype_function(symtab, instructions, "exp", 1, generate_exp); - make_gentype_function(symtab, instructions, "log", 1, generate_log); - make_gentype_function(symtab, instructions, "exp2", 1, generate_exp2); - make_gentype_function(symtab, instructions, "log2", 1, generate_log2); - make_gentype_function(symtab, instructions, "sqrt", 1, generate_sqrt); - make_gentype_function(symtab, instructions, "inversesqrt", 1, generate_rsq); - make_gentype_function(symtab, instructions, "abs", 1, generate_abs); - /* FINISHME: sign() */ - make_gentype_function(symtab, instructions, "floor", 1, generate_floor); - make_gentype_function(symtab, instructions, "ceil", 1, generate_ceil); - /* FINISHME: fract() */ - /* FINISHME: mod(x, float y) */ - make_gentype_function(symtab, instructions, "mod", 2, generate_mod); - make_gentype_function(symtab, instructions, "min", 2, generate_min); - /* FINISHME: min(x, float y) */ - make_gentype_function(symtab, instructions, "max", 2, generate_max); - /* FINISHME: max(x, float y) */ - make_gentype_function(symtab, instructions, "clamp", 3, generate_clamp); - /* FINISHME: clamp() */ - make_gentype_function(symtab, instructions, "mix", 3, generate_mix_vec); - /* FINISHME: mix() */ - /* FINISHME: step() */ - /* FINISHME: step() */ - /* FINISHME: smoothstep() */ - /* FINISHME: smoothstep() */ - /* FINISHME: floor() */ - /* FINISHME: step() */ - generate_length_functions(symtab, instructions); - /* FINISHME: distance() */ - generate_dot_functions(symtab, instructions); - /* FINISHME: cross() */ - make_gentype_function(symtab, instructions, "normalize", 1, - generate_normalize); - /* FINISHME: normalize() */ - /* FINISHME: ftransform() */ - /* FINISHME: faceforward() */ - /* FINISHME: reflect() */ - /* FINISHME: refract() */ - /* FINISHME: matrixCompMult() */ - generate_vec_compare_function(symtab, instructions, - "lessThan", generate_lessThan, false); - generate_vec_compare_function(symtab, instructions, - "lessThanEqual", generate_lessThanEqual, - false); - generate_vec_compare_function(symtab, instructions, - "greaterThan", generate_greaterThan, false); - generate_vec_compare_function(symtab, instructions, - "greaterThanEqual", generate_greaterThanEqual, - false); - generate_vec_compare_function(symtab, instructions, - "equal", generate_equal, false); - generate_vec_compare_function(symtab, instructions, - "notEqual", generate_notEqual, false); - generate_any_functions(symtab, instructions); - generate_all_functions(symtab, instructions); - generate_not_functions(symtab, instructions); - /* FINISHME: texture*() */ - /* FINISHME: shadow*() */ - /* FINISHME: dFd[xy]() */ - /* FINISHME: fwidth() */ -} + if (state->language_version >= 130) + read_builtins(state, instructions, functions_for_130, + sizeof(functions_for_130) / sizeof(const char *)); -void -_mesa_glsl_initialize_functions(exec_list *instructions, - struct _mesa_glsl_parse_state *state) -{ - generate_110_functions(state->symbols, instructions); } |