diff options
author | Kenneth Graunke <[email protected]> | 2013-08-30 16:12:55 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-09-09 11:46:51 -0700 |
commit | 4b0bac0dce31ab6c5c36fc35347e6e0e3b2ecc2a (patch) | |
tree | 7f7fb4f8f21f577ce3bf4d887fcfdadd22d2e93f /src/glsl | |
parent | ca321d07fda7d4c550eec985c79bbafb3dfbf570 (diff) |
glsl: Convert ir_function_signature::is_builtin to a method.
A signature is a built-in if and only if builtin_info != NULL, so we
don't actually need a separate flag bit. Making a boolean-valued
method allows existing code to ask the same question while not worrying
about the internal representation.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir.cpp | 10 | ||||
-rw-r--r-- | src/glsl/ir.h | 4 | ||||
-rw-r--r-- | src/glsl/ir_clone.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 2 | ||||
-rw-r--r-- | src/glsl/link_functions.cpp | 4 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 4 |
6 files changed, 15 insertions, 10 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index ea018eb2d9e..d9fb808c4b1 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1585,11 +1585,17 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type, _function(NULL) { this->ir_type = ir_type_function_signature; - this->is_builtin = builtin_info != NULL; this->origin = NULL; } +bool +ir_function_signature::is_builtin() const +{ + return builtin_info != NULL; +} + + static bool modes_match(unsigned a, unsigned b) { @@ -1661,7 +1667,7 @@ ir_function::has_user_signature() { foreach_list(n, &this->signatures) { ir_function_signature *const sig = (ir_function_signature *) n; - if (!sig->is_builtin) + if (!sig->is_builtin()) return true; } return false; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index d785259cc86..a927e90ca1f 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -684,7 +684,7 @@ public: unsigned is_defined:1; /** Whether or not this function signature is a built-in. */ - unsigned is_builtin:1; + bool is_builtin() const; /** Body of instructions in the function. */ struct exec_list body; @@ -1321,7 +1321,7 @@ public: ir_type = ir_type_call; assert(callee->return_type != NULL); actual_parameters->move_nodes_to(& this->actual_parameters); - this->use_builtin = callee->is_builtin; + this->use_builtin = callee->is_builtin(); } virtual ir_call *clone(void *mem_ctx, struct hash_table *ht) const; diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 52e2fb54e41..a91afb7ac84 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -329,7 +329,6 @@ ir_function_signature::clone_prototype(void *mem_ctx, struct hash_table *ht) con new(mem_ctx) ir_function_signature(this->return_type); copy->is_defined = false; - copy->is_builtin = this->is_builtin; copy->builtin_info = this->builtin_info; copy->origin = this; diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index bf019b95577..ec338a8348d 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1840,7 +1840,7 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s * "Function calls to user-defined functions (non-built-in functions) * cannot be used to form constant expressions." */ - if (!this->is_builtin) + if (!this->is_builtin()) return NULL; /* diff --git a/src/glsl/link_functions.cpp b/src/glsl/link_functions.cpp index dd6f2471630..c5398f5ff04 100644 --- a/src/glsl/link_functions.cpp +++ b/src/glsl/link_functions.cpp @@ -116,7 +116,7 @@ public: f->exact_matching_signature(&callee->parameters); if ((linked_sig == NULL) || ((linked_sig != NULL) - && (linked_sig->is_builtin != ir->use_builtin))) { + && (linked_sig->is_builtin() != ir->use_builtin))) { linked_sig = new(linked) ir_function_signature(callee->return_type); f->add_signature(linked_sig); } @@ -297,7 +297,7 @@ find_matching_signature(const char *name, const exec_list *actual_parameters, * signature that we found isn't a built-in, keep looking. Also keep * looking if we expect a non-built-in but found a built-in. */ - if (use_builtin != sig->is_builtin) + if (use_builtin != sig->is_builtin()) continue; return sig; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 8430096aca8..350778a01c6 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1163,14 +1163,14 @@ link_intrastage_shaders(void *mem_ctx, ir_function_signature *sig = (ir_function_signature *) iter.get(); - if (!sig->is_defined || sig->is_builtin) + if (!sig->is_defined || sig->is_builtin()) continue; ir_function_signature *other_sig = other->exact_matching_signature(& sig->parameters); if ((other_sig != NULL) && other_sig->is_defined - && !other_sig->is_builtin) { + && !other_sig->is_builtin()) { linker_error(prog, "function `%s' is multiply defined", f->name); return NULL; |