Merge "Fixes threshold in texture size tests" am: b12117312e am: 01caaa4073
authorMatthew Netsch <mnetsch@codeaurora.org>
Tue, 30 Jan 2018 22:10:17 +0000 (22:10 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Tue, 30 Jan 2018 22:10:17 +0000 (22:10 +0000)
am: 1d86edd7f9

Change-Id: If41ae8201828f86d76b7191d57c91b4780f91721

1  2 
modules/gles2/functional/es2fTextureSizeTests.cpp
modules/gles3/functional/es3fTextureSizeTests.cpp

@@@ -122,12 -122,13 +122,15 @@@ Texture2DSizeCase::IterateResult Textur
        RandomViewport                  viewport                (m_renderCtx.getRenderTarget(), 128, 128, deStringHash(getName()));
        tcu::Surface                    renderedFrame   (viewport.width, viewport.height);
        tcu::Surface                    referenceFrame  (viewport.width, viewport.height);
-       tcu::RGBA                               threshold               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7,7,7,7);
+       const tcu::IVec4                texBits                 = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
+       const tcu::PixelFormat& rtFmt                   = m_renderCtx.getRenderTarget().getPixelFormat();
+       const tcu::PixelFormat  thresholdFormat(std::min(texBits[0], rtFmt.redBits), std::min(texBits[1], rtFmt.greenBits), std::min(texBits[2], rtFmt.blueBits), std::min(texBits[3], rtFmt.alphaBits));
+       tcu::RGBA                               threshold               = thresholdFormat.getColorThreshold() + tcu::RGBA(7,7,7,7);
        deUint32                                wrapS                   = GL_CLAMP_TO_EDGE;
        deUint32                                wrapT                   = GL_CLAMP_TO_EDGE;
 -      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
 +      // Do not minify with GL_NEAREST. A large POT texture with a small POT render target will produce
 +      // indeterminate results.
 +      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_LINEAR;
        deUint32                                magFilter               = GL_NEAREST;
        vector<float>                   texCoord;
  
@@@ -267,12 -268,13 +270,15 @@@ bool TextureCubeSizeCase::testFace (tcu
        RandomViewport                  viewport                (m_renderCtx.getRenderTarget(), 128, 128, deStringHash(getName())+(deUint32)face);
        tcu::Surface                    renderedFrame   (viewport.width, viewport.height);
        tcu::Surface                    referenceFrame  (viewport.width, viewport.height);
-       tcu::RGBA                               threshold               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7,7,7,7);
+       const tcu::IVec4                texBits                 = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
+       const tcu::PixelFormat& rtFmt                   = m_renderCtx.getRenderTarget().getPixelFormat();
+       const tcu::PixelFormat  thresholdFormat(std::min(texBits[0], rtFmt.redBits), std::min(texBits[1], rtFmt.greenBits), std::min(texBits[2], rtFmt.blueBits), std::min(texBits[3], rtFmt.alphaBits));
+       tcu::RGBA                               threshold               = thresholdFormat.getColorThreshold() + tcu::RGBA(7,7,7,7);
        deUint32                                wrapS                   = GL_CLAMP_TO_EDGE;
        deUint32                                wrapT                   = GL_CLAMP_TO_EDGE;
 -      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
 +      // Do not minify with GL_NEAREST. A large POT texture with a small POT render target will produce
 +      // indeterminate results.
 +      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_LINEAR;
        deUint32                                magFilter               = GL_NEAREST;
        vector<float>                   texCoord;
  
@@@ -123,12 -123,13 +123,15 @@@ Texture2DSizeCase::IterateResult Textur
        RandomViewport                  viewport                (m_renderCtx.getRenderTarget(), 128, 128, deStringHash(getName()));
        tcu::Surface                    renderedFrame   (viewport.width, viewport.height);
        tcu::Surface                    referenceFrame  (viewport.width, viewport.height);
-       tcu::RGBA                               threshold               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7,7,7,7);
+       const tcu::IVec4                texBits                 = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
+       const tcu::PixelFormat& rtFmt                   = m_renderCtx.getRenderTarget().getPixelFormat();
+       const tcu::PixelFormat  thresholdFormat(std::min(texBits[0], rtFmt.redBits), std::min(texBits[1], rtFmt.greenBits), std::min(texBits[2], rtFmt.blueBits), std::min(texBits[3], rtFmt.alphaBits));
+       tcu::RGBA                               threshold               = thresholdFormat.getColorThreshold() + tcu::RGBA(7,7,7,7);
        deUint32                                wrapS                   = GL_CLAMP_TO_EDGE;
        deUint32                                wrapT                   = GL_CLAMP_TO_EDGE;
 -      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
 +      // Do not minify with GL_NEAREST. A large POT texture with a small POT render target will produce
 +      // indeterminate results.
 +      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_LINEAR;
        deUint32                                magFilter               = GL_NEAREST;
        vector<float>                   texCoord;
  
@@@ -268,12 -269,13 +271,15 @@@ bool TextureCubeSizeCase::testFace (tcu
        RandomViewport                  viewport                (m_renderCtx.getRenderTarget(), 128, 128, deStringHash(getName())+(deUint32)face);
        tcu::Surface                    renderedFrame   (viewport.width, viewport.height);
        tcu::Surface                    referenceFrame  (viewport.width, viewport.height);
-       tcu::RGBA                               threshold               = m_renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(7,7,7,7);
+       const tcu::IVec4                texBits                 = tcu::getTextureFormatBitDepth(glu::mapGLTransferFormat(m_format, m_dataType));
+       const tcu::PixelFormat& rtFmt                   = m_renderCtx.getRenderTarget().getPixelFormat();
+       const tcu::PixelFormat  thresholdFormat(std::min(texBits[0], rtFmt.redBits), std::min(texBits[1], rtFmt.greenBits), std::min(texBits[2], rtFmt.blueBits), std::min(texBits[3], rtFmt.alphaBits));
+       tcu::RGBA                               threshold               = thresholdFormat.getColorThreshold() + tcu::RGBA(7,7,7,7);
        deUint32                                wrapS                   = GL_CLAMP_TO_EDGE;
        deUint32                                wrapT                   = GL_CLAMP_TO_EDGE;
 -      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_NEAREST;
 +      // Do not minify with GL_NEAREST. A large POT texture with a small POT render target will produce
 +      // indeterminate results.
 +      deUint32                                minFilter               = m_useMipmaps ? GL_NEAREST_MIPMAP_NEAREST : GL_LINEAR;
        deUint32                                magFilter               = GL_NEAREST;
        vector<float>                   texCoord;