glsl: fix emit_inline_matrix_constructor for doubles
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 19 Feb 2016 08:16:14 +0000 (09:16 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 19 Feb 2016 13:16:05 +0000 (14:16 +0100)
Specifically, for the case where we initialize a dmat with a source
matrix that has fewer columns/rows.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/ast_function.cpp

index 2ed61de0b9fde59f1b74cd2eadbe0f4f95820806..1a440203cfc9b45391e5d6a7b05fcc785381aecf 100644 (file)
@@ -1484,12 +1484,19 @@ emit_inline_matrix_constructor(const glsl_type *type,
          for (/* empty */; col < var->type->matrix_columns; col++) {
             ir_constant_data ident;
 
-            ident.f[0] = 0.0f;
-            ident.f[1] = 0.0f;
-            ident.f[2] = 0.0f;
-            ident.f[3] = 0.0f;
-
-            ident.f[col] = 1.0f;
+            if (!col_type->is_double()) {
+               ident.f[0] = 0.0f;
+               ident.f[1] = 0.0f;
+               ident.f[2] = 0.0f;
+               ident.f[3] = 0.0f;
+               ident.f[col] = 1.0f;
+            } else {
+               ident.d[0] = 0.0;
+               ident.d[1] = 0.0;
+               ident.d[2] = 0.0;
+               ident.d[3] = 0.0;
+               ident.d[col] = 1.0;
+            }
 
             ir_rvalue *const rhs = new(ctx) ir_constant(col_type, &ident);