aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2010-06-29 15:59:27 -0700
committerIan Romanick <[email protected]>2010-06-29 16:31:52 -0700
commit506199b852390e14a1d78392285bee8f06b6ede7 (patch)
tree7431b410d32ebabc8cf00d50f05b5b45acd24de6 /src/glsl
parent22971e922a72c8a433638429b635935fe80907ee (diff)
glsl2: Keep the same number of components in implicit conversions.
Fixes piglit test glsl-implicit-conversion-01.
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ast_to_hir.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 664e4687c4e..ba292400925 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -109,6 +109,12 @@ apply_implicit_conversion(const glsl_type *to, ir_rvalue * &from,
if (!to->is_float() || !from->type->is_numeric())
return false;
+ /* Convert to a floating point type with the same number of components
+ * as the original type - i.e. int to float, not int to vec4.
+ */
+ to = glsl_type::get_instance(GLSL_TYPE_FLOAT, from->type->vector_elements,
+ from->type->matrix_columns);
+
switch (from->type->base_type) {
case GLSL_TYPE_INT:
from = new(ctx) ir_expression(ir_unop_i2f, to, from, NULL);