summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_function.cpp
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2016-02-19 09:16:14 +0100
committerIago Toral Quiroga <itoral@igalia.com>2016-02-19 14:16:05 +0100
commit72794b0bd9740d8c6671a9b4c7115540b339b8b4 (patch)
tree18f6deac1c9c0946896238e0ad61be809c8759ba /src/compiler/glsl/ast_function.cpp
parentd1617b4088aafc58affde4e348f66c0d45286735 (diff)
downloadexternal_mesa3d-72794b0bd9740d8c6671a9b4c7115540b339b8b4.zip
external_mesa3d-72794b0bd9740d8c6671a9b4c7115540b339b8b4.tar.gz
external_mesa3d-72794b0bd9740d8c6671a9b4c7115540b339b8b4.tar.bz2
glsl: fix emit_inline_matrix_constructor for doubles
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>
Diffstat (limited to 'src/compiler/glsl/ast_function.cpp')
-rw-r--r--src/compiler/glsl/ast_function.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 2ed61de..1a44020 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -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);