From: Jarkko Pöyry Date: Mon, 2 Mar 2015 21:51:30 +0000 (-0800) Subject: Fix TextureTestUtil::toRGBA(Masked) behavior with infinities. X-Git-Tag: upstream/0.1.0~1904^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27b5856bb11af6bd900f11aeaf00d723a96783a5;p=platform%2Fupstream%2FVK-GL-CTS.git Fix TextureTestUtil::toRGBA(Masked) behavior with infinities. - toRGBA(Masked) incorrectly returned 0 for infinity. This change makes the functions return 255 as expected. Change-Id: I7d013d0abb9c395fc5e74b000fec2ae8db32f0d2 --- diff --git a/modules/glshared/glsTextureTestUtil.hpp b/modules/glshared/glsTextureTestUtil.hpp index f918985..69d2b5a 100644 --- a/modules/glshared/glsTextureTestUtil.hpp +++ b/modules/glshared/glsTextureTestUtil.hpp @@ -34,13 +34,16 @@ #include "tcuPixelFormat.hpp" #include "tcuRenderTarget.hpp" #include "tcuTestContext.hpp" -#include "deMath.h" -#include "deInt32.h" -#include "gluShaderProgram.hpp" #include "tcuTestLog.hpp" #include "tcuCompressedTexture.hpp" +#include "tcuTextureUtil.hpp" + +#include "gluShaderProgram.hpp" #include "gluShaderUtil.hpp" +#include "deMath.h" +#include "deInt32.h" + #include namespace tcu @@ -239,20 +242,18 @@ public: inline tcu::RGBA toRGBA (const tcu::Vec4& v) { - // \todo [2011-10-24 pyry] Rounding mode? - return tcu::RGBA(deClamp32(deRoundFloatToInt32(v.x()*255.0f), 0, 255), - deClamp32(deRoundFloatToInt32(v.y()*255.0f), 0, 255), - deClamp32(deRoundFloatToInt32(v.z()*255.0f), 0, 255), - deClamp32(deRoundFloatToInt32(v.w()*255.0f), 0, 255)); + return tcu::RGBA(tcu::floatToU8(v.x()), + tcu::floatToU8(v.y()), + tcu::floatToU8(v.z()), + tcu::floatToU8(v.w())); } inline tcu::RGBA toRGBAMasked (const tcu::Vec4& v, deUint8 mask) { - // \todo [2011-10-24 pyry] Rounding mode? - return tcu::RGBA((mask&tcu::RGBA::RED_MASK) ? deClamp32(deRoundFloatToInt32(v.x()*255.0f), 0, 255) : 0, - (mask&tcu::RGBA::GREEN_MASK) ? deClamp32(deRoundFloatToInt32(v.y()*255.0f), 0, 255) : 0, - (mask&tcu::RGBA::BLUE_MASK) ? deClamp32(deRoundFloatToInt32(v.z()*255.0f), 0, 255) : 0, - (mask&tcu::RGBA::ALPHA_MASK) ? deClamp32(deRoundFloatToInt32(v.w()*255.0f), 0, 255) : 0xff); + return tcu::RGBA((mask&tcu::RGBA::RED_MASK) ? tcu::floatToU8(v.x()) : 0, + (mask&tcu::RGBA::GREEN_MASK) ? tcu::floatToU8(v.y()) : 0, + (mask&tcu::RGBA::BLUE_MASK) ? tcu::floatToU8(v.z()) : 0, + (mask&tcu::RGBA::ALPHA_MASK) ? tcu::floatToU8(v.w()) : 0); } inline tcu::Vec4 toVec4 (const tcu::RGBA& c)