Fix threshold calculation in EGLImage tests.
authorMika Isojärvi <misojarvi@google.com>
Fri, 20 Mar 2015 22:15:10 +0000 (15:15 -0700)
committerMika Isojärvi <misojarvi@google.com>
Sat, 21 Mar 2015 01:03:32 +0000 (18:03 -0700)
Bug: 18290284
Change-Id: I29684a4962e3d67d67f082e37300ef41a6f7b14a

modules/egl/teglImageFormatTests.cpp

index 62df0ce..1e06500 100644 (file)
@@ -549,6 +549,9 @@ bool GLES2ImageApi::RenderDepthbuffer::invokeGLES2 (GLES2ImageApi& api, MovePtr<
 bool GLES2ImageApi::RenderReadPixelsRenderbuffer::invokeGLES2 (GLES2ImageApi& api, MovePtr<UniqueImage>& img, tcu::Texture2D& reference) const
 {
        const glw::Functions&   gl                              = api.m_gl;
+       const tcu::IVec4                bitDepth                = tcu::getTextureFormatMantissaBitDepth(reference.getFormat());
+       const tcu::IVec4                threshold               (2 * (tcu::IVec4(1) << (tcu::IVec4(8) - bitDepth)));
+       const tcu::RGBA                 threshold8              ((deUint8)(de::clamp(threshold[0], 0, 255)), (deUint8)(de::clamp(threshold[1], 0, 255)), (deUint8)(de::clamp(threshold[2], 0, 255)), (deUint8)(de::clamp(threshold[3], 0, 255)));
        tcu::TestLog&                   log                             = api.getLog();
        Framebuffer                             framebuffer             (gl);
        Renderbuffer                    renderbuffer    (gl);
@@ -572,7 +575,7 @@ bool GLES2ImageApi::RenderReadPixelsRenderbuffer::invokeGLES2 (GLES2ImageApi& ap
 
        tcu::copy(refSurface.getAccess(), reference.getLevel(0));
 
-       return tcu::pixelThresholdCompare(log, "Renderbuffer read", "Result from reading renderbuffer", refSurface, screen, tcu::RGBA(1,1,1,1), tcu::COMPARE_LOG_RESULT);
+       return tcu::pixelThresholdCompare(log, "Renderbuffer read", "Result from reading renderbuffer", refSurface, screen, threshold8, tcu::COMPARE_LOG_RESULT);
 
 }