aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ast_function.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-08-01 09:05:15 +0200
committermarha <marha@users.sourceforge.net>2011-08-01 09:05:15 +0200
commitf87ad0cdc41af88f134475ab50b0d604004d9cdc (patch)
tree72e8cd139cf22d66d77c6a52f72b3d5c11c330f3 /mesalib/src/glsl/ast_function.cpp
parent28257038c4f13ac26127d536c14c922aa036efed (diff)
downloadvcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.tar.gz
vcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.tar.bz2
vcxsrv-f87ad0cdc41af88f134475ab50b0d604004d9cdc.zip
mesa xserver pixman xkeyboard-config git update 1 aug 2011
Diffstat (limited to 'mesalib/src/glsl/ast_function.cpp')
-rw-r--r--mesalib/src/glsl/ast_function.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/mesalib/src/glsl/ast_function.cpp b/mesalib/src/glsl/ast_function.cpp
index bdb73f487..8bcf48dfd 100644
--- a/mesalib/src/glsl/ast_function.cpp
+++ b/mesalib/src/glsl/ast_function.cpp
@@ -442,13 +442,21 @@ process_array_constructor(exec_list *instructions,
ir_rvalue *ir = (ir_rvalue *) n;
ir_rvalue *result = ir;
- /* Apply implicit conversions (not the scalar constructor rules!) */
+ /* Apply implicit conversions (not the scalar constructor rules!). See
+ * the spec quote above. */
if (constructor_type->element_type()->is_float()) {
const glsl_type *desired_type =
glsl_type::get_instance(GLSL_TYPE_FLOAT,
ir->type->vector_elements,
ir->type->matrix_columns);
- result = convert_component(ir, desired_type);
+ if (result->type->can_implicitly_convert_to(desired_type)) {
+ /* Even though convert_component() implements the constructor
+ * conversion rules (not the implicit conversion rules), its safe
+ * to use it here because we already checked that the implicit
+ * conversion is legal.
+ */
+ result = convert_component(ir, desired_type);
+ }
}
if (result->type != constructor_type->element_type()) {