From: Jarkko Pöyry Date: Fri, 1 May 2015 18:15:21 +0000 (-0700) Subject: Assume border color is always in linear space. X-Git-Tag: upstream/0.1.0~1069^2~193 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5be8ad612a000b4ad2caf14c8d93501f3558eb8;p=platform%2Fupstream%2FVK-GL-CTS.git Assume border color is always in linear space. Bug: 20755158 Change-Id: I18e048e1537ef5b02020d139eb58a498ab917722 --- diff --git a/framework/common/tcuTexLookupVerifier.cpp b/framework/common/tcuTexLookupVerifier.cpp index e7d7ccb..4a70168 100644 --- a/framework/common/tcuTexLookupVerifier.cpp +++ b/framework/common/tcuTexLookupVerifier.cpp @@ -65,14 +65,13 @@ template<> inline Vector lookup (const ConstPixelBufferAccess& access, const Sampler& sampler, int i, int j, int k) { // Specialization for float lookups: sRGB conversion is performed as specified in format. - Vec4 p; - if (coordsInBounds(access, i, j, k)) - p = access.getPixel(i, j, k); + { + const Vec4 p = access.getPixel(i, j, k); + return isSRGB(access.getFormat()) ? sRGBToLinear(p) : p; + } else - p = sampleTextureBorder(access.getFormat(), sampler); - - return isSRGB(access.getFormat()) ? sRGBToLinear(p) : p; + return sampleTextureBorder(access.getFormat(), sampler); } static inline bool isColorValid (const LookupPrecision& prec, const Vec4& ref, const Vec4& result) diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp index 713cc4c..6fb69f0 100644 --- a/framework/common/tcuTexture.cpp +++ b/framework/common/tcuTexture.cpp @@ -1249,10 +1249,7 @@ static inline Vec4 lookupBorder (const tcu::TextureFormat& format, const tcu::Sa const bool isPureUnsignedInteger = channelClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER; if (isFloat || isFixed) - { - const Vec4 p = sampleTextureBorder(format, sampler); - return isSRGB(format) ? sRGBToLinear(p) : p; - } + return sampleTextureBorder(format, sampler); else if (isPureInteger) return sampleTextureBorder(format, sampler).cast(); else if (isPureUnsignedInteger) diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index df7c20c..0de34c6 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -1348,7 +1348,7 @@ static tcu::Vec4 getTextureBorderColorFloat (const TextureFormat& format, const } } - return isSRGB(format) ? sRGBToLinear(result) : result; + return result; } static tcu::IVec4 getTextureBorderColorInt (const TextureFormat& format, const Sampler& sampler) diff --git a/modules/gles31/functional/es31fTextureBorderClampTests.cpp b/modules/gles31/functional/es31fTextureBorderClampTests.cpp index 92324a5..74eedb7 100644 --- a/modules/gles31/functional/es31fTextureBorderClampTests.cpp +++ b/modules/gles31/functional/es31fTextureBorderClampTests.cpp @@ -417,6 +417,25 @@ rr::GenericVec4 mapToFormatColorRepresentable (const tcu::TextureFormat& texForm de::ArrayBuffer buffer (texFormat.getPixelSize()); tcu::PixelBufferAccess access (texFormat, tcu::IVec3(1, 1, 1), buffer.getPtr()); + if (tcu::isSRGB(texFormat)) + { + DE_ASSERT(texFormat.type == tcu::TextureFormat::UNORM_INT8); + + // make sure border color (in linear space) can be converted to 8-bit sRGB space without + // significant loss. + const tcu::Vec4 sRGB = tcu::linearToSRGB(normalizedRange); + const tcu::IVec4 sRGB8 = tcu::IVec4(tcu::floatToU8(sRGB[0]), + tcu::floatToU8(sRGB[1]), + tcu::floatToU8(sRGB[2]), + tcu::floatToU8(sRGB[3])); + const tcu::Vec4 linearized = tcu::sRGBToLinear(tcu::Vec4(sRGB8[0] / 255.0f, + sRGB8[1] / 255.0f, + sRGB8[2] / 255.0f, + sRGB8[3] / 255.0f)); + + return rr::GenericVec4(tcu::select(linearized, tcu::Vec4(0.0f), channelMask)); + } + switch (tcu::getTextureChannelClass(texFormat.type)) { case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT: