Lower correlation threshold in flush-finish tests again am: 6455e6f987 am: 2e18b48b04...
[platform/upstream/VK-GL-CTS.git] / modules / glshared / glsBuiltinPrecisionTests.cpp
index da69f89..afe990b 100644 (file)
@@ -2924,12 +2924,32 @@ public:
 protected:
        ExprP<float>    doExpand        (ExpandContext&, const ArgExprs& args) const
        {
-               ExprP<float> val = args.a[0] * args.b[0];
+               ExprP<float> op[Size];
+               // Precompute all products.
+               for (int ndx = 0; ndx < Size; ++ndx)
+                       op[ndx] = args.a[ndx] * args.b[ndx];
 
-               for (int ndx = 1; ndx < Size; ++ndx)
-                       val = val + args.a[ndx] * args.b[ndx];
+               int idx[Size];
+               //Prepare an array of indices.
+               for (int ndx = 0; ndx < Size; ++ndx)
+                       idx[ndx] = ndx;
 
-               return val;
+               ExprP<float> res = op[0];
+               // Compute the first dot alternative: SUM(a[i]*b[i]), i = 0 .. Size-1
+               for (int ndx = 1; ndx < Size; ++ndx)
+                       res = res + op[ndx];
+
+               // Generate all permutations of indices and
+               // using a permutation compute a dot alternative.
+               // Generates all possible variants fo summation of products in the dot product expansion expression.
+               do {
+                       ExprP<float> alt = constant(0.0f);
+                       for (int ndx = 0; ndx < Size; ++ndx)
+                               alt = alt + op[idx[ndx]];
+                       res = alternatives(res, alt);
+               } while (std::next_permutation(idx, idx + Size));
+
+               return res;
        }
 };