From af7f1c8f24df636a06cd9e78c767d6df77d3945b Mon Sep 17 00:00:00 2001
From: iostrows <igor.ostrowski@intel.com>
Date: Wed, 1 Jun 2016 16:40:00 +0200
Subject: [PATCH] Fix double matrix creation

---
 SPIRV/SpvBuilder.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp
index a08e54886..152a46396 100644
--- a/SPIRV/SpvBuilder.cpp
+++ b/SPIRV/SpvBuilder.cpp
@@ -1830,6 +1830,9 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
     int numCols = getTypeNumColumns(resultTypeId);
     int numRows = getTypeNumRows(resultTypeId);
 
+    Instruction* instr = module.getInstruction(componentTypeId);
+    Id bitCount = instr->getIdOperand(0);
+
     // Will use a two step process
     // 1. make a compile-time 2D array of values
     // 2. construct a matrix from that array
@@ -1838,8 +1841,8 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector<Id>&
 
     // initialize the array to the identity matrix
     Id ids[maxMatrixSize][maxMatrixSize];
-    Id  one = makeFloatConstant(1.0);
-    Id zero = makeFloatConstant(0.0);
+    Id  one = (bitCount == 64 ? makeDoubleConstant(1.0) : makeFloatConstant(1.0));
+    Id zero = (bitCount == 64 ? makeDoubleConstant(0.0) : makeFloatConstant(0.0));
     for (int col = 0; col < 4; ++col) {
         for (int row = 0; row < 4; ++row) {
             if (col == row)
-- 
GitLab