Check configs before mutable_render_buffer negative test
authorPablo Ceballos <pceballos@google.com>
Wed, 18 May 2016 23:11:26 +0000 (16:11 -0700)
committerPablo Ceballos <pceballos@google.com>
Thu, 19 May 2016 20:39:04 +0000 (13:39 -0700)
Some implementations don't expose any configs without support for
mutable render buffer. Don't test those.

Bug 27129258

Change-Id: I5186630ac81abc31002881c092d9ca50607eb1c4

modules/egl/teglMutableRenderBufferTests.cpp

index 2fd036b..d004a79 100644 (file)
@@ -36,6 +36,8 @@
 
 using namespace eglw;
 
+using std::vector;
+
 namespace deqp
 {
 namespace egl
@@ -119,9 +121,30 @@ void MutableRenderBufferTest::init (void)
                EGL_RENDERABLE_TYPE,    EGL_OPENGL_ES2_BIT,
                EGL_NONE
        };
-       m_eglConfig                     = m_enableConfigBit ?
-                                                               eglu::chooseSingleConfig(egl, m_eglDisplay, attribs) :
-                                                               eglu::chooseSingleConfig(egl, m_eglDisplay, attribsNoBit);
+
+       if (m_enableConfigBit)
+       {
+               m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, attribs);
+       }
+       else
+       {
+               const vector<EGLConfig> configs = eglu::chooseConfigs(egl, m_eglDisplay, attribsNoBit);
+
+               for (vector<EGLConfig>::const_iterator config = configs.begin(); config != configs.end(); ++config)
+               {
+                       EGLint surfaceType = -1;
+                       EGLU_CHECK_CALL(egl, getConfigAttrib(m_eglDisplay, *config, EGL_SURFACE_TYPE, &surfaceType));
+
+                       if (!(surfaceType & EGL_MUTABLE_RENDER_BUFFER_BIT_KHR))
+                       {
+                               m_eglConfig = *config;
+                               break;
+                       }
+               }
+
+               if (m_eglConfig == DE_NULL)
+                       TCU_THROW(NotSupportedError, "No config without support for mutable_render_buffer found");
+       }
 
        // create surface
        const eglu::NativeWindowFactory& factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());