From 6c1b3db5fb439806b9b67442f1042615ffa32816 Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Fri, 29 May 2015 14:06:53 -0700 Subject: [PATCH] Allow alternative mix() implementation Some compilers translate mix(a, b, x) to a + (b - a)*x which produces slightly different results than the form a*(1 - x) + b*x suggested by the GLSL specification. This change relaxes tests to allow both forms. Bug: 21110253 Change-Id: I3af056145ef8e64c0fc998302770fd38d105481a --- modules/glshared/glsBuiltinPrecisionTests.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp index b954cad..c7d2928 100644 --- a/modules/glshared/glsBuiltinPrecisionTests.cpp +++ b/modules/glshared/glsBuiltinPrecisionTests.cpp @@ -3240,7 +3240,8 @@ ExprP clamp(const ExprP& x, const ExprP& minVal, const Expr return app(x, minVal, maxVal); } -DEFINE_DERIVED_FLOAT3(Mix, mix, x, y, a, (x * (constant(1.0f) - a)) + y * a); +DEFINE_DERIVED_FLOAT3(Mix, mix, x, y, a, alternatives((x * (constant(1.0f) - a)) + y * a, + x + (y - x) * a)); static double step (double edge, double x) { -- 2.7.4