From: Mika Isojärvi Date: Thu, 24 Mar 2016 23:05:56 +0000 (-0700) Subject: Allow more alternative forms of scalar reflect function X-Git-Tag: upstream/0.1.0~438^2~330^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=919e0bc33b7fa8a27131967a02c6ceca3c8d1009;p=platform%2Fupstream%2FVK-GL-CTS.git Allow more alternative forms of scalar reflect function Bug: 22859221 Change-Id: Iff34d861642b8d4b8a1cdc932529d98ac7c71005 --- diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp index fdb5295..3994a65 100644 --- a/modules/glshared/glsBuiltinPrecisionTests.cpp +++ b/modules/glshared/glsBuiltinPrecisionTests.cpp @@ -3073,6 +3073,33 @@ protected: } }; +template +struct ApplyReflect +{ + static ExprP apply (ExpandContext& ctx, + const ExprP& i, + const ExprP& n) + { + const ExprP dotNI = bindExpression("dotNI", ctx, dot(n, i)); + + return i - alternatives((n * dotNI) * constant(2.0f), + n * (dotNI * constant(2.0f))); + }; +}; + +template +struct ApplyReflect<1, Ret, Arg0, Arg1> +{ + static ExprP apply (ExpandContext& ctx, + const ExprP& i, + const ExprP& n) + { + return i - alternatives(alternatives((n * (n*i)) * constant(2.0f), + n * ((n*i) * constant(2.0f))), + (n * n) * (i * constant(2.0f))); + }; +}; + template class Reflect : public DerivedFunc< Signature::Container, @@ -3095,10 +3122,8 @@ protected: { const ExprP& i = args.a; const ExprP& n = args.b; - const ExprP dotNI = bindExpression("dotNI", ctx, dot(n, i)); - return i - alternatives((n * dotNI) * constant(2.0f), - n * (dotNI * constant(2.0f))); + return ApplyReflect::apply(ctx, i, n); } };