Browse Source

Updated glslang.

Бранимир Караџић 4 years ago
parent
commit
1f32a216b3

+ 1 - 1
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -5562,7 +5562,7 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
             ++lValueCount;
         } else {
             // process r-value, which involves a copy for a type mismatch
-            if (function->getParamType(a) != convertGlslangToSpvType(*argTypes[a]) ||
+            if (function->getParamType(a) != builder.getTypeId(rValues[rValueCount]) ||
                 TranslatePrecisionDecoration(*argTypes[a]) != function->getParamPrecision(a))
             {
                 spv::Id argCopy = builder.createVariable(function->getParamPrecision(a), spv::StorageClassFunction, function->getParamType(a), "arg");

+ 18 - 19
3rdparty/glslang/glslang/MachineIndependent/parseConst.cpp

@@ -166,31 +166,30 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
                 }
             } else {
                 // matrix from vector or scalar
-                int count = 0;
-                const int startIndex = index;
                 int nodeComps = node->getType().computeNumComponents();
-                for (int i = startIndex; i < endIndex; i++) {
-                    if (i >= instanceSize)
-                        return;
-                    if (nodeComps == 1) {
-                        // If there is a single scalar parameter to a matrix
-                        // constructor, it is used to initialize all the
-                        // components on the matrix's diagonal, with the
-                        // remaining components initialized to 0.0.
-                        if (i == startIndex || (i - startIndex) % (matrixRows + 1) == 0 )
-                            leftUnionArray[i] = rightUnionArray[count];
-                        else
-                            leftUnionArray[i].setDConst(0.0);
-                    } else {
+                if (nodeComps == 1) {
+                    for (int c = 0; c < matrixCols; ++c) {
+                        for (int r = 0; r < matrixRows; ++r) {
+                            if (r == c)
+                                leftUnionArray[index] = rightUnionArray[0];
+                            else
+                                leftUnionArray[index].setDConst(0.0);
+                            index++;
+                        }
+                    }
+                } else {
+                    int count = 0;
+                    for (int i = index; i < endIndex; i++) {
+                        if (i >= instanceSize)
+                            return;
+
                         // construct the matrix in column-major order, from
                         // the components provided, in order
                         leftUnionArray[i] = rightUnionArray[count];
-                    }
-
-                    index++;
 
-                    if (nodeComps > 1)
+                        index++;
                         count++;
+                    }
                 }
             }
         }