diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index a08e54886194301144cbb43a5d5e04b64643c1e2..152a463962a910f3e9902280d6bb81e2f5906af9 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)