Fix EGL_MIPMAP_LEVEL query checks.
authorMika Isojärvi <misojarvi@google.com>
Fri, 24 Oct 2014 08:32:35 +0000 (11:32 +0300)
committerPyry Haulos <phaulos@google.com>
Tue, 11 Nov 2014 16:52:59 +0000 (16:52 +0000)
Check that EGL_MIPMAP_LEVEL query returns 0 for pbuffers and
doesn't modify return value pointer for other surfaces.

Bug: 18329517
Change-Id: Iff769c93306821fa16889ba3298f28f061a4bfeb
(cherry picked from commit ff0bd4ba2ffca5c910035fbc37074ead9b4f5b4c)

modules/egl/teglQuerySurfaceTests.cpp

index 4a993aa..0817e9e 100644 (file)
@@ -476,14 +476,25 @@ void SurfaceAttribCase::testAttributes (tcu::egl::Surface& surface, const Config
        // Mipmap level
        if (info.renderableType & EGL_OPENGL_ES_BIT || info.renderableType & EGL_OPENGL_ES2_BIT)
        {
-               const EGLint    value   = surface.getAttribute(EGL_MIPMAP_LEVEL);
+               const EGLint initialValue = 0xDEADBAAD;
+               EGLint value = initialValue;
+
+               TCU_CHECK_EGL_CALL(eglQuerySurface(surface.getDisplay().getEGLDisplay(), surface.getEGLSurface(), EGL_MIPMAP_LEVEL, &value));
 
                logSurfaceAttribute(log, EGL_MIPMAP_LEVEL, value);
 
-               if (value != 0)
+               if (dynamic_cast<tcu::egl::PbufferSurface*>(&surface))
+               {
+                       if (value != 0)
+                       {
+                               log << TestLog::Message << "    Fail, initial mipmap level value should be 0, is " << value << TestLog::EndMessage;
+                               m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default mipmap level");
+                       }
+               }
+               else if (value != initialValue)
                {
-                       log << TestLog::Message << "    Fail, initial mipmap level value should be 0, is " << value << TestLog::EndMessage;
-                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid default mipmap level");
+                       log << TestLog::Message << "    Fail, eglQuerySurface changed value when querying EGL_MIPMAP_LEVEL for non-pbuffer surface. Result: " << value << ". Expected: " << initialValue << TestLog::EndMessage;
+                       m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "EGL_MIPMAP_LEVEL query modified result for non-pbuffer surface.");
                }
 
                eglSurfaceAttrib(display.getEGLDisplay(), surface.getEGLSurface(), EGL_MIPMAP_LEVEL, 1);