summaryrefslogtreecommitdiff
path: root/src/glsl/ast_function.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-07-19 23:45:23 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-07-21 16:37:57 -0700
commit0048c7aef82b17c6bd160f49125a91a70cbf2b55 (patch)
treea0cd3c1b385e5b1fb8998959a2df4c602873d527 /src/glsl/ast_function.cpp
parentc7a18da69022d3f9b05c21ff2473e8ea390f77f1 (diff)
glsl2: Add some comments.
Diffstat (limited to 'src/glsl/ast_function.cpp')
-rw-r--r--src/glsl/ast_function.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 2348bdf24f..1122521e0d 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -164,6 +164,9 @@ match_function_by_name(exec_list *instructions, const char *name,
/**
* Perform automatic type conversion of constructor parameters
+ *
+ * This implements the rules in the "Conversion and Scalar Constructors"
+ * section (GLSL 1.10 section 5.4.1), not the "Implicit Conversions" rules.
*/
static ir_rvalue *
convert_component(ir_rvalue *src, const glsl_type *desired_type)
@@ -220,11 +223,11 @@ convert_component(ir_rvalue *src, const glsl_type *desired_type)
assert(result != NULL);
+ /* Try constant folding; it may fold in the conversion we just added. */
ir_constant *const constant = result->constant_expression_value();
return (constant != NULL) ? (ir_rvalue *) constant : (ir_rvalue *) result;
}
-
/**
* Dereference a specific component from a scalar, vector, or matrix
*/