From: Jarkko Pöyry Date: Fri, 6 Mar 2015 02:40:55 +0000 (-0800) Subject: Expose isSRGB publicly to avoid duplication. X-Git-Tag: upstream/0.1.0~1901^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89a729134d6a1880d2b59426dfe14d615381e314;p=platform%2Fupstream%2FVK-GL-CTS.git Expose isSRGB publicly to avoid duplication. Change-Id: I4244748cdd043a6c6b395a7b9a2e07200a9c6139 --- diff --git a/framework/common/tcuTexLookupVerifier.cpp b/framework/common/tcuTexLookupVerifier.cpp index de6254a..83af974 100644 --- a/framework/common/tcuTexLookupVerifier.cpp +++ b/framework/common/tcuTexLookupVerifier.cpp @@ -52,11 +52,6 @@ static inline bool coordsInBounds (const ConstPixelBufferAccess& access, int x, return de::inBounds(x, 0, access.getWidth()) && de::inBounds(y, 0, access.getHeight()) && de::inBounds(z, 0, access.getDepth()); } -static inline bool isSRGB (TextureFormat format) -{ - return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA; -} - template inline Vector lookup (const ConstPixelBufferAccess& access, const Sampler& sampler, int i, int j, int k) { diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp index a8a691f..f4d221f 100644 --- a/framework/common/tcuTexture.cpp +++ b/framework/common/tcuTexture.cpp @@ -1143,11 +1143,6 @@ static inline float unnormalize (Sampler::WrapMode mode, float c, int size) } } -static inline bool isSRGB (TextureFormat format) -{ - return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA; -} - static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format) { const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type); diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp index 1e10fc9..2f15696 100644 --- a/framework/common/tcuTextureUtil.cpp +++ b/framework/common/tcuTextureUtil.cpp @@ -70,6 +70,11 @@ Vec4 linearToSRGB (const Vec4& cl) cl[3]); } +bool isSRGB (TextureFormat format) +{ + return format.order == TextureFormat::sRGB || format.order == TextureFormat::sRGBA; +} + //! Get texture channel class for format TextureChannelClass getTextureChannelClass (TextureFormat::ChannelType channelType) { diff --git a/framework/common/tcuTextureUtil.hpp b/framework/common/tcuTextureUtil.hpp index a973812..cfba85b 100644 --- a/framework/common/tcuTextureUtil.hpp +++ b/framework/common/tcuTextureUtil.hpp @@ -42,6 +42,7 @@ ConstPixelBufferAccess flipYAccess (const ConstPixelBufferAccess& access); // sRGB - linear conversion. Vec4 sRGBToLinear (const Vec4& cs); Vec4 linearToSRGB (const Vec4& cl); +bool isSRGB (TextureFormat format); /*--------------------------------------------------------------------*//*! * \brief Color channel storage type diff --git a/framework/opengl/simplereference/sglrReferenceContext.cpp b/framework/opengl/simplereference/sglrReferenceContext.cpp index db1eb44..1bead80 100644 --- a/framework/opengl/simplereference/sglrReferenceContext.cpp +++ b/framework/opengl/simplereference/sglrReferenceContext.cpp @@ -3004,8 +3004,8 @@ deUint32 ReferenceContext::blitResolveMultisampleFramebuffer (deUint32 mask, con bool dstIsFloat = dstClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT || dstClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT || dstClass == tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT; - bool srcIsSRGB = src.raw().getFormat().order == tcu::TextureFormat::sRGB || src.raw().getFormat().order == tcu::TextureFormat::sRGBA; - bool dstIsSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB || dst.getFormat().order == tcu::TextureFormat::sRGBA; + bool srcIsSRGB = tcu::isSRGB(src.raw().getFormat()); + bool dstIsSRGB = tcu::isSRGB(dst.getFormat()); const bool convertSRGB = m_sRGBUpdateEnabled && glu::isContextTypeES(getType()); if (!convertSRGB) @@ -3156,8 +3156,8 @@ void ReferenceContext::blitFramebuffer (int srcX0, int srcY0, int srcX1, int src tcu::Sampler::FilterMode sFilter = (scale && filter == GL_LINEAR) ? tcu::Sampler::LINEAR : tcu::Sampler::NEAREST; tcu::Sampler sampler (tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, tcu::Sampler::CLAMP_TO_EDGE, sFilter, sFilter, 0.0f /* lod threshold */, false /* non-normalized coords */); - bool srcIsSRGB = src.getFormat().order == tcu::TextureFormat::sRGB || src.getFormat().order == tcu::TextureFormat::sRGBA; - bool dstIsSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB || dst.getFormat().order == tcu::TextureFormat::sRGBA; + bool srcIsSRGB = tcu::isSRGB(src.getFormat()); + bool dstIsSRGB = tcu::isSRGB(dst.getFormat()); const bool convertSRGB = m_sRGBUpdateEnabled && glu::isContextTypeES(getType()); if (!convertSRGB) @@ -3350,7 +3350,7 @@ void ReferenceContext::clear (deUint32 buffers) { IVec4 colorArea = intersect(baseArea, getBufferRect(colorBuf0)); rr::MultisamplePixelBufferAccess access = rr::getSubregion(colorBuf0, colorArea.x(), colorArea.y(), colorArea.z(), colorArea.w()); - bool isSRGB = colorBuf0.raw().getFormat().order == tcu::TextureFormat::sRGB || colorBuf0.raw().getFormat().order == tcu::TextureFormat::sRGBA; + bool isSRGB = tcu::isSRGB(colorBuf0.raw().getFormat()); Vec4 c = (isSRGB && m_sRGBUpdateEnabled) ? tcu::linearToSRGB(m_clearColor) : m_clearColor; bool maskUsed = !m_colorMask[0] || !m_colorMask[1] || !m_colorMask[2] || !m_colorMask[3]; bool maskZero = !m_colorMask[0] && !m_colorMask[1] && !m_colorMask[2] && !m_colorMask[3]; @@ -3499,8 +3499,7 @@ void ReferenceContext::clearBufferfv (deUint32 buffer, int drawbuffer, const flo rr::MultisamplePixelBufferAccess access = rr::getSubregion(colorBuf, area.x(), area.y(), area.z(), area.w()); Vec4 color (value[0], value[1], value[2], value[3]); - if (m_sRGBUpdateEnabled && (access.raw().getFormat().order == tcu::TextureFormat::sRGB || - access.raw().getFormat().order == tcu::TextureFormat::sRGBA)) + if (m_sRGBUpdateEnabled && tcu::isSRGB(access.raw().getFormat())) color = tcu::linearToSRGB(color); if (!maskUsed) diff --git a/framework/referencerenderer/rrFragmentOperations.cpp b/framework/referencerenderer/rrFragmentOperations.cpp index b8451e6..fa8ad92 100644 --- a/framework/referencerenderer/rrFragmentOperations.cpp +++ b/framework/referencerenderer/rrFragmentOperations.cpp @@ -768,8 +768,7 @@ void FragmentProcessor::render (const rr::MultisamplePixelBufferAccess& msColor const StencilState& stencilState = state.stencilStates[fragmentFacing]; Vec4 colorMaskFactor (state.colorMask[0] ? 1.0f : 0.0f, state.colorMask[1] ? 1.0f : 0.0f, state.colorMask[2] ? 1.0f : 0.0f, state.colorMask[3] ? 1.0f : 0.0f); Vec4 colorMaskNegationFactor (state.colorMask[0] ? 0.0f : 1.0f, state.colorMask[1] ? 0.0f : 1.0f, state.colorMask[2] ? 0.0f : 1.0f, state.colorMask[3] ? 0.0f : 1.0f); - bool sRGBTarget = state.sRGBEnabled && (colorBuffer.getFormat().order == tcu::TextureFormat::sRGBA || - colorBuffer.getFormat().order == tcu::TextureFormat::sRGB); + bool sRGBTarget = state.sRGBEnabled && tcu::isSRGB(colorBuffer.getFormat()); DE_ASSERT(SAMPLE_REGISTER_SIZE % numSamplesPerFragment == 0); diff --git a/modules/gles3/functional/es3fFboTestUtil.cpp b/modules/gles3/functional/es3fFboTestUtil.cpp index 78d2a5a..cd8e7c7 100644 --- a/modules/gles3/functional/es3fFboTestUtil.cpp +++ b/modules/gles3/functional/es3fFboTestUtil.cpp @@ -1099,7 +1099,7 @@ static int getToSRGB8ConversionError (int srcBits) tcu::RGBA getToSRGBConversionThreshold (const tcu::TextureFormat& src, const tcu::TextureFormat& dst) { // Only SRGB8 and SRGB8_ALPHA8 formats are supported. - DE_ASSERT(dst.type == tcu::TextureFormat::UNORM_INT8 && (dst.order == tcu::TextureFormat::sRGB || dst.order == tcu::TextureFormat::sRGBA)); + DE_ASSERT(dst.type == tcu::TextureFormat::UNORM_INT8 && tcu::isSRGB(dst)); const tcu::IVec4 bits = tcu::getTextureFormatMantissaBitDepth(src); const bool dstHasAlpha = dst.order == tcu::TextureFormat::sRGBA; diff --git a/modules/gles3/functional/es3fFragmentOutputTests.cpp b/modules/gles3/functional/es3fFragmentOutputTests.cpp index 13de888..71f8422 100644 --- a/modules/gles3/functional/es3fFragmentOutputTests.cpp +++ b/modules/gles3/functional/es3fFragmentOutputTests.cpp @@ -395,7 +395,7 @@ static inline IVec4 readIVec4 (const int* ptr, int numComponents) static void renderFloatReference (const tcu::PixelBufferAccess& dst, int gridWidth, int gridHeight, int numComponents, const float* vertices) { - const bool isSRGB = dst.getFormat().order == tcu::TextureFormat::sRGB ||dst.getFormat().order == tcu::TextureFormat::sRGBA; + const bool isSRGB = tcu::isSRGB(dst.getFormat()); const float cellW = (float)dst.getWidth() / (float)(gridWidth-1); const float cellH = (float)dst.getHeight() / (float)(gridHeight-1); diff --git a/modules/gles3/functional/es3fFramebufferBlitTests.cpp b/modules/gles3/functional/es3fFramebufferBlitTests.cpp index efcdef3..74e79a7 100644 --- a/modules/gles3/functional/es3fFramebufferBlitTests.cpp +++ b/modules/gles3/functional/es3fFramebufferBlitTests.cpp @@ -426,8 +426,8 @@ protected: { const tcu::TextureFormat srcFormat = glu::mapGLInternalFormat(m_srcFormat); const tcu::TextureFormat dstFormat = glu::mapGLInternalFormat(m_dstFormat); - const bool srcIsSRGB = (srcFormat.order == tcu::TextureFormat::sRGBA); - const bool dstIsSRGB = (dstFormat.order == tcu::TextureFormat::sRGBA); + const bool srcIsSRGB = tcu::isSRGB(srcFormat); + const bool dstIsSRGB = tcu::isSRGB(dstFormat); tcu::RGBA threshold; diff --git a/modules/gles3/functional/es3fTextureWrapTests.cpp b/modules/gles3/functional/es3fTextureWrapTests.cpp index 06cd78f..e137304 100644 --- a/modules/gles3/functional/es3fTextureWrapTests.cpp +++ b/modules/gles3/functional/es3fTextureWrapTests.cpp @@ -330,7 +330,7 @@ TextureWrapCase::IterateResult TextureWrapCase::iterate (void) { const tcu::ScopedLogSection section (log, string("Test") + de::toString(m_caseNdx), string("Test ") + de::toString(m_caseNdx)); const bool isNearestOnly = m_minFilter == GL_NEAREST && m_magFilter == GL_NEAREST; - const bool isSRGB = texFormat.order == tcu::TextureFormat::sRGB || texFormat.order == tcu::TextureFormat::sRGBA; + const bool isSRGB = tcu::isSRGB(texFormat); const tcu::PixelFormat pixelFormat = m_renderCtx.getRenderTarget().getPixelFormat(); const tcu::IVec4 colorBits = tcu::max(getBitsVec(pixelFormat) - (isNearestOnly && !isSRGB ? 1 : 2), tcu::IVec4(0)); tcu::LodPrecision lodPrecision;