Merge "Check configs before mutable_render_buffer negative test"
authorTreeHugger Robot <treehugger-gerrit@google.com>
Thu, 19 May 2016 21:58:12 +0000 (21:58 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Thu, 19 May 2016 21:58:13 +0000 (21:58 +0000)
1  2 
modules/egl/teglMutableRenderBufferTests.cpp

@@@ -36,6 -36,8 +36,8 @@@
  
  using namespace eglw;
  
+ using std::vector;
  namespace deqp
  {
  namespace egl
@@@ -119,9 -121,30 +121,30 @@@ void MutableRenderBufferTest::init (voi
                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());
@@@ -179,7 -202,7 +202,7 @@@ void MutableRenderBufferTest::deinit (v
  deUint32 MutableRenderBufferTest::drawAndSwap (const Library& egl, deUint32 color, bool flush)
  {
        DE_ASSERT(color < 256);
 -      m_gl.clearColor(color/255.f, color/255.f, color/255.f, color/255.f);
 +      m_gl.clearColor((float)color/255.f, (float)color/255.f, (float)color/255.f, (float)color/255.f);
        m_gl.clear(GL_COLOR_BUFFER_BIT);
        if (flush)
        {