diff options
Diffstat (limited to 'src/glsl/ir.cpp')
| -rw-r--r-- | src/glsl/ir.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 68ad512bf5..86dc490154 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -196,6 +196,8 @@ ir_expression::get_num_operands(ir_expression_operation op) 1, /* ir_unop_dFdx */ 1, /* ir_unop_dFdy */ + 1, /* ir_unop_noise */ + 2, /* ir_binop_add */ 2, /* ir_binop_sub */ 2, /* ir_binop_mul */ @@ -208,6 +210,8 @@ ir_expression::get_num_operands(ir_expression_operation op) 2, /* ir_binop_gequal */ 2, /* ir_binop_equal */ 2, /* ir_binop_nequal */ + 2, /* ir_binop_all_equal */ + 2, /* ir_binop_any_nequal */ 2, /* ir_binop_lshift */ 2, /* ir_binop_rshift */ @@ -261,6 +265,7 @@ static const char *const operator_strs[] = { "cos", "dFdx", "dFdy", + "noise", "+", "-", "*", @@ -272,6 +277,8 @@ static const char *const operator_strs[] = { ">=", "==", "!=", + "all_equal", + "any_nequal", "<<", ">>", "&", @@ -287,11 +294,16 @@ static const char *const operator_strs[] = { "pow", }; +const char *ir_expression::operator_string(ir_expression_operation op) +{ + assert((unsigned int) op < Elements(operator_strs)); + assert(Elements(operator_strs) == (ir_binop_pow + 1)); + return operator_strs[op]; +} + const char *ir_expression::operator_string() { - assert((unsigned int) operation <= - sizeof(operator_strs) / sizeof(operator_strs[0])); - return operator_strs[operation]; + return operator_string(this->operation); } ir_expression_operation @@ -701,6 +713,18 @@ ir_constant::has_value(const ir_constant *c) const return true; } + +ir_loop::ir_loop() +{ + this->ir_type = ir_type_loop; + this->cmp = ir_unop_neg; + this->from = NULL; + this->to = NULL; + this->increment = NULL; + this->counter = NULL; +} + + ir_dereference_variable::ir_dereference_variable(ir_variable *var) { this->ir_type = ir_type_dereference_variable; @@ -1057,6 +1081,7 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type) : return_type(return_type), is_defined(false), _function(NULL) { this->ir_type = ir_type_function_signature; + this->is_builtin = false; } @@ -1108,7 +1133,18 @@ ir_function::ir_function(const char *name) { this->ir_type = ir_type_function; this->name = talloc_strdup(this, name); - this->is_builtin = false; +} + + +bool +ir_function::has_builtin_signature() +{ + foreach_list(n, &this->signatures) { + ir_function_signature *const sig = (ir_function_signature *) n; + if (sig->is_builtin) + return true; + } + return false; } |
