From 358d99cacdf7a16393046dedd1dafc7db0b0f703 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mika=20Isoj=C3=A4rvi?= Date: Fri, 24 Oct 2014 11:32:35 +0300 Subject: [PATCH] Fix EGL_MIPMAP_LEVEL query checks. 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/egl/teglQuerySurfaceTests.cpp b/modules/egl/teglQuerySurfaceTests.cpp index 4a993aa..0817e9e 100644 --- a/modules/egl/teglQuerySurfaceTests.cpp +++ b/modules/egl/teglQuerySurfaceTests.cpp @@ -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(&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); -- 2.7.4