X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=framework%2Fcommon%2FtcuVectorUtil.hpp;h=0797463e064954b29451e02ba129547974f25621;hb=2144b4467573ebe95ff07af75ded35a7157c410a;hp=622bffa006383505388bc98d53eb8f215ee00999;hpb=575a540083c3cec751606dabb1092d6161eeb2d8;p=platform%2Fupstream%2FVK-GL-CTS.git diff --git a/framework/common/tcuVectorUtil.hpp b/framework/common/tcuVectorUtil.hpp index 622bffa..0797463 100644 --- a/framework/common/tcuVectorUtil.hpp +++ b/framework/common/tcuVectorUtil.hpp @@ -25,6 +25,7 @@ #include "tcuDefs.hpp" #include "tcuVector.hpp" +#include "deRandom.hpp" #include "deMeta.hpp" #include "deMath.h" #include "deInt32.h" @@ -368,6 +369,32 @@ static inline Vector absDiff (const Vector& a, const Vector +inline tcu::Vector randomVector (de::Random& rnd, const tcu::Vector& minValue, const tcu::Vector& maxValue) +{ + tcu::Vector res; + + for (int ndx = 0; ndx < Size; ndx++) + res[ndx] = de::randomScalar(rnd, minValue[ndx], maxValue[ndx]); + + return res; +} + +inline Vector randomVec2 (de::Random& rnd) +{ + return randomVector(rnd, tcu::Vector(0.0f), tcu::Vector(1.0f)); +} + +inline Vector randomVec3 (de::Random& rnd) +{ + return randomVector(rnd, tcu::Vector(0.0f), tcu::Vector(1.0f)); +} + +inline Vector randomVec4 (de::Random& rnd) +{ + return randomVector(rnd, tcu::Vector(0.0f), tcu::Vector(1.0f)); +} + // Macros for component-wise ops. #define TCU_DECLARE_VECTOR_UNARY_FUNC(FUNC_NAME, OP_NAME) \