selectNative*Factory() throws exception when no factories available.
authorMika Isojärvi <misojarvi@google.com>
Wed, 11 Mar 2015 23:09:13 +0000 (16:09 -0700)
committerMika Isojärvi <misojarvi@google.com>
Tue, 17 Mar 2015 18:04:29 +0000 (11:04 -0700)
Instead of checking everywhere, if EGL native type factories for type existed
throw tcu::NotSupportedError from selectNative*Factory -function.

Change-Id: Iff416008a7499da7a6536e40dc0e1d376e9acfec

19 files changed:
framework/egl/egluGLContextFactory.cpp
framework/egl/egluUtil.cpp
framework/egl/egluUtil.hpp
modules/egl/teglCreateContextExtTests.cpp
modules/egl/teglCreateSurfaceTests.cpp
modules/egl/teglGLES2SharingTests.cpp
modules/egl/teglImageFormatTests.cpp
modules/egl/teglImageUtil.cpp
modules/egl/teglMakeCurrentPerfTests.cpp
modules/egl/teglMultiThreadTests.cpp
modules/egl/teglNativeColorMappingTests.cpp
modules/egl/teglNativeCoordMappingTests.cpp
modules/egl/teglPreservingSwapTests.cpp
modules/egl/teglQuerySurfaceTests.cpp
modules/egl/teglRenderCase.cpp
modules/egl/teglResizeTests.cpp
modules/egl/teglSwapBuffersTests.cpp
modules/egl/teglSyncTests.cpp
modules/egl/teglTestPackage.cpp

index 5885381..29cc642 100644 (file)
@@ -557,18 +557,30 @@ GLContextFactory::GLContextFactory (const NativeDisplayFactoryRegistry& displayF
 
 glu::RenderContext* GLContextFactory::createContext (const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) const
 {
-       const NativeDisplayFactory* displayFactory = selectNativeDisplayFactory(m_displayFactoryRegistry, cmdLine);
+       const NativeDisplayFactory& displayFactory = selectNativeDisplayFactory(m_displayFactoryRegistry, cmdLine);
 
-       if (displayFactory)
+       const NativeWindowFactory*      windowFactory;
+       const NativePixmapFactory*      pixmapFactory;
+
+       try
+       {
+               windowFactory = &selectNativeWindowFactory(displayFactory, cmdLine);
+       }
+       catch (const tcu::NotSupportedError&)
        {
-               // \note windowFactory & pixmapFactory are not mandatory
-               const NativeWindowFactory*      windowFactory   = selectNativeWindowFactory(*displayFactory, cmdLine);
-               const NativePixmapFactory*      pixmapFactory   = selectNativePixmapFactory(*displayFactory, cmdLine);
+               windowFactory = DE_NULL;
+       }
 
-               return new RenderContext(displayFactory, windowFactory, pixmapFactory, config);
+       try
+       {
+               pixmapFactory = &selectNativePixmapFactory(displayFactory, cmdLine);
        }
-       else
-               TCU_THROW(NotSupportedError, "No EGL displays available");
+       catch (const tcu::NotSupportedError&)
+       {
+               pixmapFactory = DE_NULL;
+       }
+
+       return new RenderContext(&displayFactory, windowFactory, pixmapFactory, config);
 }
 
 } // eglu
index d1cb1be..da126cc 100644 (file)
@@ -438,14 +438,14 @@ vector<EGLint> toLegacyAttribList (const EGLAttrib* attribs)
 }
 
 template<typename Factory>
-static const Factory* selectFactory (const tcu::FactoryRegistry<Factory>& registry, const char* objectTypeName, const char* cmdLineArg)
+static const Factory& selectFactory (const tcu::FactoryRegistry<Factory>& registry, const char* objectTypeName, const char* cmdLineArg)
 {
        if (cmdLineArg)
        {
                const Factory* factory = registry.getFactoryByName(cmdLineArg);
 
                if (factory)
-                       return factory;
+                       return *factory;
                else
                {
                        tcu::print("ERROR: Unknown or unsupported EGL %s type '%s'", objectTypeName, cmdLineArg);
@@ -457,22 +457,22 @@ static const Factory* selectFactory (const tcu::FactoryRegistry<Factory>& regist
                }
        }
        else if (!registry.empty())
-               return registry.getDefaultFactory();
+               return *registry.getDefaultFactory();
        else
-               return DE_NULL;
+               TCU_THROW(NotSupportedError, (string("No factory supporting EGL '") + objectTypeName + "' type").c_str());
 }
 
-const NativeDisplayFactory* selectNativeDisplayFactory (const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine)
+const NativeDisplayFactory& selectNativeDisplayFactory (const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine)
 {
        return selectFactory(registry, "display", cmdLine.getEGLDisplayType());
 }
 
-const NativeWindowFactory* selectNativeWindowFactory (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine)
+const NativeWindowFactory& selectNativeWindowFactory (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine)
 {
        return selectFactory(factory.getNativeWindowRegistry(), "window", cmdLine.getEGLWindowType());
 }
 
-const NativePixmapFactory* selectNativePixmapFactory (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine)
+const NativePixmapFactory& selectNativePixmapFactory (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine)
 {
        return selectFactory(factory.getNativePixmapRegistry(), "pixmap", cmdLine.getEGLPixmapType());
 }
index 3d56c77..8c5dd3d 100644 (file)
@@ -80,9 +80,9 @@ eglw::EGLDisplay                              getAndInitDisplay                       (NativeDisplay& nativeDisplay, Version*
 eglw::EGLSurface                               createWindowSurface                     (NativeDisplay& nativeDisplay, NativeWindow& window, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
 eglw::EGLSurface                               createPixmapSurface                     (NativeDisplay& nativeDisplay, NativePixmap& pixmap, eglw::EGLDisplay display, eglw::EGLConfig config, const eglw::EGLAttrib* attribList);
 
-const NativeDisplayFactory*            selectNativeDisplayFactory      (const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine);
-const NativeWindowFactory*             selectNativeWindowFactory       (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
-const NativePixmapFactory*             selectNativePixmapFactory       (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
+const NativeDisplayFactory&            selectNativeDisplayFactory      (const NativeDisplayFactoryRegistry& registry, const tcu::CommandLine& cmdLine);
+const NativeWindowFactory&             selectNativeWindowFactory       (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
+const NativePixmapFactory&             selectNativePixmapFactory       (const NativeDisplayFactory& factory, const tcu::CommandLine& cmdLine);
 
 WindowParams::Visibility               parseWindowVisibility           (const tcu::CommandLine& commandLine);
 eglw::EGLenum                                  parseClientAPI                          (const std::string& api);
index fdd6f09..31cceaa 100644 (file)
@@ -920,24 +920,18 @@ TestCase::IterateResult CreateContextExtCase::iterate (void)
                }
                else if ((surfaceTypes & EGL_WINDOW_BIT) != 0)
                {
-                       const eglu::NativeWindowFactory*        factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+                       const eglu::NativeWindowFactory&        factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-                       if (!factory)
-                               TCU_THROW(NotSupportedError, "Windows not supported");
-
-                       de::UniquePtr<eglu::NativeWindow>       window  (factory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, eglu::WindowParams(256, 256, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+                       de::UniquePtr<eglu::NativeWindow>       window  (factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, eglu::WindowParams(256, 256, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
                        eglu::UniqueSurface                                     surface (egl, m_display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, config, DE_NULL));
 
                        executeForSurface(config, *surface);
                }
                else if ((surfaceTypes & EGL_PIXMAP_BIT) != 0)
                {
-                       const eglu::NativePixmapFactory*        factory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-                       if (!factory)
-                               TCU_THROW(NotSupportedError, "Pixmaps not supported");
+                       const eglu::NativePixmapFactory&        factory = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-                       de::UniquePtr<eglu::NativePixmap>       pixmap  (factory->createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, 256, 256));
+                       de::UniquePtr<eglu::NativePixmap>       pixmap  (factory.createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, config, DE_NULL, 256, 256));
                        eglu::UniqueSurface                                     surface (egl, m_display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_display, config, DE_NULL));
 
                        executeForSurface(config, *surface);
index 1cbac4e..49c2381 100644 (file)
@@ -118,21 +118,18 @@ public:
                const Library&                                          egl                             = m_eglTestCtx.getLibrary();
                TestLog&                                                        log                             = m_testCtx.getLog();
                EGLint                                                          id                              = eglu::getConfigID(egl, display, config);
-               const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-               if (!windowFactory)
-                       TCU_THROW(NotSupportedError, "Windows not supported");
+               const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
                // \todo [2011-03-23 pyry] Iterate thru all possible combinations of EGL_RENDER_BUFFER, EGL_VG_COLORSPACE and EGL_VG_ALPHA_FORMAT
 
                if (m_useLegacyCreate)
                {
-                       if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
+                       if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
                                TCU_THROW(NotSupportedError, "Native window doesn't support legacy eglCreateWindowSurface()");
                }
                else
                {
-                       if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0)
+                       if ((windowFactory.getCapabilities() & eglu::NativeWindow::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0)
                                TCU_THROW(NotSupportedError, "Native window doesn't support eglCreatePlatformWindowSurfaceEXT()");
                }
 
@@ -142,7 +139,7 @@ public:
                {
                        const int                                                       width                   = 64;
                        const int                                                       height                  = 64;
-                       de::UniquePtr<eglu::NativeWindow>       window                  (windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+                       de::UniquePtr<eglu::NativeWindow>       window                  (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
                        eglu::UniqueSurface                                     surface                 (egl, display, createWindowSurface(display, config, m_eglTestCtx.getNativeDisplay(), *window, m_useLegacyCreate));
 
                        EGLint                                                          windowWidth             = 0;
@@ -179,21 +176,18 @@ public:
                const Library&                                          egl                             = m_eglTestCtx.getLibrary();
                TestLog&                                                        log                             = m_testCtx.getLog();
                EGLint                                                          id                              = eglu::getConfigID(egl, display, config);
-               const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-               if (!pixmapFactory)
-                       TCU_THROW(NotSupportedError, "Pixmaps not supported");
+               const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
                // \todo [2011-03-23 pyry] Iterate thru all possible combinations of EGL_RENDER_BUFFER, EGL_VG_COLORSPACE and EGL_VG_ALPHA_FORMAT
 
                if (m_useLegacyCreate)
                {
-                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
+                       if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
                                TCU_THROW(NotSupportedError, "Native pixmap doesn't support legacy eglCreatePixmapSurface()");
                }
                else
                {
-                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0)
+                       if ((pixmapFactory.getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_PLATFORM) == 0)
                                TCU_THROW(NotSupportedError, "Native pixmap doesn't support eglCreatePlatformPixmapSurfaceEXT()");
                }
 
@@ -203,7 +197,7 @@ public:
                {
                        const int                                                       width                   = 64;
                        const int                                                       height                  = 64;
-                       de::UniquePtr<eglu::NativePixmap>       pixmap                  (pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
+                       de::UniquePtr<eglu::NativePixmap>       pixmap                  (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
                        eglu::UniqueSurface                                     surface                 (egl, display, createPixmapSurface(display, config, m_eglTestCtx.getNativeDisplay(), *pixmap, m_useLegacyCreate));
                        EGLint                                                          pixmapWidth             = 0;
                        EGLint                                                          pixmapHeight    = 0;
index e073410..cde391d 100644 (file)
@@ -149,15 +149,12 @@ TestCase::IterateResult GLES2SharingTest::iterate (void)
        const Library&                                          egl                             = m_eglTestCtx.getLibrary();
        tcu::TestLog&                                           log                             = m_testCtx.getLog();
        eglu::UniqueDisplay                                     display                 (egl, eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay()));
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
        EGLConfig                                                       config;
        bool                                                            isOk                    = true;
        EGLContext                                                      contextA                = EGL_NO_CONTEXT;
        EGLContext                                                      contextB                = EGL_NO_CONTEXT;
 
-       if (!windowFactory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
        {
                const EGLint attribList[] =
                {
@@ -172,7 +169,7 @@ TestCase::IterateResult GLES2SharingTest::iterate (void)
 
        try
        {
-               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), *display, config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), *display, config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
                eglu::UniqueSurface                                     surface (egl, *display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, *display, config, DE_NULL));
 
                m_log << tcu::TestLog::Message << "Create context A (share_context = EGL_NO_CONTEXT)" << tcu::TestLog::EndMessage;
index 0a5b423..62df0ce 100644 (file)
@@ -801,16 +801,13 @@ void ImageFormatCase::checkExtensions (void)
 void ImageFormatCase::init (void)
 {
        const Library&                                          egl                             = m_eglTestCtx.getLibrary();
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-       if (!windowFactory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
+       const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
        try
        {
                m_display       = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
                m_config        = getConfig();
-               m_window        = windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+               m_window        = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
                m_surface       = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_display, m_config, DE_NULL);
 
                {
index d47b3ba..f4b5dbf 100644 (file)
@@ -112,31 +112,21 @@ MovePtr<ManagedSurface> createSurface (EglTestContext& eglTestCtx, EGLDisplay dp
        }
        else if (surfaceTypeBits & EGL_WINDOW_BIT)
        {
-               const NativeWindowFactory*      windowFactory   = selectNativeWindowFactory(displayFactory, eglTestCtx.getTestContext().getCommandLine());
+               const NativeWindowFactory&      windowFactory   = selectNativeWindowFactory(displayFactory, eglTestCtx.getTestContext().getCommandLine());
 
-               if (windowFactory)
-               {
-                       MovePtr<NativeWindow>   window  (windowFactory->createWindow(&nativeDisplay, dpy, config, DE_NULL, WindowParams(width, height, WindowParams::VISIBILITY_DONT_CARE)));
-                       const EGLSurface                surface = eglu::createWindowSurface(nativeDisplay, *window, dpy, config, DE_NULL);
+               MovePtr<NativeWindow>           window  (windowFactory.createWindow(&nativeDisplay, dpy, config, DE_NULL, WindowParams(width, height, WindowParams::VISIBILITY_DONT_CARE)));
+               const EGLSurface                        surface = eglu::createWindowSurface(nativeDisplay, *window, dpy, config, DE_NULL);
 
-                       return MovePtr<ManagedSurface>(new NativeWindowSurface(MovePtr<UniqueSurface>(new UniqueSurface(egl, dpy, surface)), window));
-               }
-               else
-                       TCU_THROW(NotSupportedError, "Windows not supported");
+               return MovePtr<ManagedSurface>(new NativeWindowSurface(MovePtr<UniqueSurface>(new UniqueSurface(egl, dpy, surface)), window));
        }
        else if (surfaceTypeBits & EGL_PIXMAP_BIT)
        {
-               const NativePixmapFactory*      pixmapFactory   = selectNativePixmapFactory(displayFactory, eglTestCtx.getTestContext().getCommandLine());
+               const NativePixmapFactory&      pixmapFactory   = selectNativePixmapFactory(displayFactory, eglTestCtx.getTestContext().getCommandLine());
 
-               if (pixmapFactory)
-               {
-                       MovePtr<NativePixmap>   pixmap  (pixmapFactory->createPixmap(&nativeDisplay, dpy, config, DE_NULL, width, height));
-                       const EGLSurface                surface = eglu::createPixmapSurface(eglTestCtx.getNativeDisplay(), *pixmap, dpy, config, DE_NULL);
+               MovePtr<NativePixmap>   pixmap  (pixmapFactory.createPixmap(&nativeDisplay, dpy, config, DE_NULL, width, height));
+               const EGLSurface                surface = eglu::createPixmapSurface(eglTestCtx.getNativeDisplay(), *pixmap, dpy, config, DE_NULL);
 
-                       return MovePtr<ManagedSurface>(new NativePixmapSurface(MovePtr<UniqueSurface>(new UniqueSurface(egl, dpy, surface)), pixmap));
-               }
-               else
-                       TCU_THROW(NotSupportedError, "Pixmaps not supported");
+               return MovePtr<ManagedSurface>(new NativePixmapSurface(MovePtr<UniqueSurface>(new UniqueSurface(egl, dpy, surface)), pixmap));
        }
        else
                TCU_FAIL("No valid surface types supported in config");
index 161069e..dd822f3 100644 (file)
@@ -272,17 +272,14 @@ void MakeCurrentPerfCase::createWindow (void)
        const EGLint                                            width                   = 256;
        const EGLint                                            height                  = 256;
 
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
        eglu::NativeWindow*                             window                  = DE_NULL;
        EGLSurface                                                      surface                 = EGL_NO_SURFACE;
 
-       if (!windowFactory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
        try
        {
-               window  = windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_eglTestCtx.getTestContext().getCommandLine())));
+               window  = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_eglTestCtx.getTestContext().getCommandLine())));
                surface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, m_config, DE_NULL);
        }
        catch (...)
@@ -304,17 +301,14 @@ void MakeCurrentPerfCase::createPixmap (void)
        const EGLint                                            width                   = 256;
        const EGLint                                            height                  = 256;
 
-       const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
        eglu::NativePixmap*                             pixmap                  = DE_NULL;
        EGLSurface                                                      surface                 = EGL_NO_SURFACE;
 
-       if (!pixmapFactory)
-               TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
        try
        {
-               pixmap  = pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, width, height);
+               pixmap  = pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, width, height);
                surface = eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_display, m_config, DE_NULL);
        }
        catch (...)
index 19201c7..e73e3d6 100644 (file)
@@ -1093,10 +1093,7 @@ void MultiThreadedObjectTest::createDestroyObjects (TestThread& thread, int coun
 
                                case TYPE_WINDOW:
                                {
-                                       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-                                       if (!windowFactory)
-                                               TCU_THROW(NotSupportedError, "Windows not supported");
+                                       const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
                                        if ((m_types & TYPE_SINGLE_WINDOW) != 0)
                                        {
@@ -1107,7 +1104,7 @@ void MultiThreadedObjectTest::createDestroyObjects (TestThread& thread, int coun
 
                                                        try
                                                        {
-                                                               window = windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(64, 64, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+                                                               window = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(64, 64, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
                                                                surface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, m_config, DE_NULL);
 
                                                                thread.getLog() << ThreadLog::BeginMessage << surface << " = eglCreateWindowSurface()" << ThreadLog::EndMessage;
@@ -1134,7 +1131,7 @@ void MultiThreadedObjectTest::createDestroyObjects (TestThread& thread, int coun
 
                                                try
                                                {
-                                                       window  = windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(64, 64, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+                                                       window  = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, eglu::WindowParams(64, 64, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
                                                        surface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_display, m_config, DE_NULL);
 
                                                        thread.getLog() << ThreadLog::BeginMessage << surface << " = eglCreateWindowSurface()" << ThreadLog::EndMessage;
@@ -1153,13 +1150,13 @@ void MultiThreadedObjectTest::createDestroyObjects (TestThread& thread, int coun
 
                                case TYPE_PIXMAP:
                                {
-                                       const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+                                       const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
                                        eglu::NativePixmap*                             pixmap                  = DE_NULL;
                                        EGLSurface                                                      surface                 = EGL_NO_SURFACE;
 
                                        try
                                        {
-                                               pixmap  = pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, 64, 64);
+                                               pixmap  = pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), m_display, m_config, DE_NULL, 64, 64);
                                                surface = eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_display, m_config, DE_NULL);
 
                                                thread.getLog() << ThreadLog::BeginMessage << surface << " = eglCreatePixmapSurface()" << ThreadLog::EndMessage;
index 8d625a0..415a732 100644 (file)
@@ -445,49 +445,6 @@ bool testNativePixmapCopy (TestLog& log, const Library& egl, eglu::NativePixmap&
        return isOk;
 }
 
-void checkSupport (NativeColorMappingCase::NativeType nativeType, const eglu::NativeWindowFactory* windowFactory, const eglu::NativePixmapFactory* pixmapFactory)
-{
-       switch (nativeType)
-       {
-               case NativeColorMappingCase::NATIVETYPE_WINDOW:
-               {
-                       if (!windowFactory)
-                               TCU_THROW(NotSupportedError, "Windows not supported");
-
-                       if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
-                               TCU_THROW(NotSupportedError, "Native window doesn't support readPixels()");
-
-                       break;
-               }
-
-               case NativeColorMappingCase::NATIVETYPE_PIXMAP:
-               {
-                       if (!pixmapFactory)
-                               TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
-                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0)
-                               TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels()");
-
-                       break;
-               }
-
-               case NativeColorMappingCase::NATIVETYPE_PBUFFER_COPY_TO_PIXMAP:
-               {
-                       if (!pixmapFactory)
-                               TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
-                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0 ||
-                               (pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
-                               TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels() or legacy create surface");
-
-                       break;
-               }
-
-               default:
-                       DE_ASSERT(DE_FALSE);
-       }
-}
-
 void NativeColorMappingCase::executeForConfig (EGLDisplay display, EGLConfig config)
 {
        const int width         = 128;
@@ -518,12 +475,52 @@ void NativeColorMappingCase::executeForConfig (EGLDisplay display, EGLConfig con
        const string                                            configIdStr             (de::toString(eglu::getConfigAttribInt(egl, display, config, EGL_CONFIG_ID)));
        tcu::ScopedLogSection                           logSection              (m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
        const int                                                       waitFrames              = 5;
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-       const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory*        windowFactory;
+       const eglu::NativePixmapFactory*        pixmapFactory;
 
        logConfigInfo(m_testCtx.getLog(), egl, display, config, m_nativeType, waitFrames);
 
-       checkSupport(m_nativeType, windowFactory, pixmapFactory);
+       try
+       {
+               windowFactory = &eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+
+               if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
+                       TCU_THROW(NotSupportedError, "Native window doesn't support readPixels()");
+       }
+       catch (const tcu::NotSupportedError&)
+       {
+               if (m_nativeType == NATIVETYPE_WINDOW)
+                       throw;
+               else
+                       windowFactory = DE_NULL;
+       }
+
+       try
+       {
+               pixmapFactory = &eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+
+               if (m_nativeType == NATIVETYPE_PIXMAP)
+               {
+                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0)
+                               TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels()");
+               }
+               else if (m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
+               {
+                       if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0 ||
+                               (pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
+                               TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels() or legacy create surface");
+               }
+       }
+       catch (const tcu::NotSupportedError&)
+       {
+               if (m_nativeType == NATIVETYPE_PIXMAP || m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
+                       throw;
+               else
+                       pixmapFactory = DE_NULL;
+       }
+
+       DE_ASSERT(m_nativeType != NATIVETYPE_WINDOW || windowFactory);
+       DE_ASSERT((m_nativeType != NATIVETYPE_PIXMAP && m_nativeType != NATIVETYPE_PBUFFER_COPY_TO_PIXMAP) || pixmapFactory);
 
        eglu::UniqueContext     context         (egl, display, createGLES2Context(egl, display, config));
        glw::Functions                  gl;
index 90b38d4..c704665 100644 (file)
@@ -500,63 +500,60 @@ bool testNativePixmapCopy (TestLog& log, const Library& egl, eglu::NativePixmap&
        return isOk;
 }
 
-void checkSupport (NativeCoordMappingCase::NativeType nativeType, const eglu::NativeWindowFactory* windowFactory, const eglu::NativePixmapFactory* pixmapFactory)
+void NativeCoordMappingCase::executeForConfig (EGLDisplay display, EGLConfig config)
 {
-       switch (nativeType)
+       const Library&                                          egl                             = m_eglTestCtx.getLibrary();
+       const string                                            configIdStr             (de::toString(eglu::getConfigAttribInt(egl, display, config, EGL_CONFIG_ID)));
+       tcu::ScopedLogSection                           logSection              (m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
+       const int                                                       waitFrames              = 5;
+       const int                                                       width                   = 128;
+       const int                                                       height                  = 128;
+       const eglu::NativeWindowFactory*        windowFactory;
+       const eglu::NativePixmapFactory*        pixmapFactory;
+
+       logConfigInfo(m_testCtx.getLog(), egl, display, config, m_nativeType, waitFrames);
+
+       try
        {
-               case NativeCoordMappingCase::NATIVETYPE_WINDOW:
-               {
-                       if (!windowFactory)
-                               TCU_THROW(NotSupportedError, "Windows not supported");
+               windowFactory = &eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-                       if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
-                               TCU_THROW(NotSupportedError, "Native window doesn't support readPixels()");
+               if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
+                       TCU_THROW(NotSupportedError, "Native window doesn't support readPixels()");
+       }
+       catch (const tcu::NotSupportedError&)
+       {
+               if (m_nativeType == NATIVETYPE_WINDOW)
+                       throw;
+               else
+                       windowFactory = DE_NULL;
+       }
 
-                       break;
-               }
+       try
+       {
+               pixmapFactory = &eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-               case NativeCoordMappingCase::NATIVETYPE_PIXMAP:
+               if (m_nativeType == NATIVETYPE_PIXMAP)
                {
-                       if (!pixmapFactory)
-                               TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
                        if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0)
                                TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels()");
-
-                       break;
                }
-
-               case NativeCoordMappingCase::NATIVETYPE_PBUFFER_COPY_TO_PIXMAP:
+               else if (m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
                {
-                       if (!pixmapFactory)
-                               TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
                        if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0 ||
                                (pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
                                TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels() or legacy create surface");
-
-                       break;
                }
-
-               default:
-                       DE_ASSERT(DE_FALSE);
        }
-}
-
-void NativeCoordMappingCase::executeForConfig (EGLDisplay display, EGLConfig config)
-{
-       const Library&                                          egl                             = m_eglTestCtx.getLibrary();
-       const string                                            configIdStr             (de::toString(eglu::getConfigAttribInt(egl, display, config, EGL_CONFIG_ID)));
-       tcu::ScopedLogSection                           logSection              (m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
-       const int                                                       waitFrames              = 5;
-       const int                                                       width                   = 128;
-       const int                                                       height                  = 128;
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-       const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
-
-       logConfigInfo(m_testCtx.getLog(), egl, display, config, m_nativeType, waitFrames);
+       catch (const tcu::NotSupportedError&)
+       {
+               if (m_nativeType == NATIVETYPE_PIXMAP || m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
+                       throw;
+               else
+                       pixmapFactory = DE_NULL;
+       }
 
-       checkSupport(m_nativeType, windowFactory, pixmapFactory);
+       DE_ASSERT(m_nativeType != NATIVETYPE_WINDOW || windowFactory);
+       DE_ASSERT((m_nativeType != NATIVETYPE_PIXMAP && m_nativeType != NATIVETYPE_PBUFFER_COPY_TO_PIXMAP) || pixmapFactory);
 
        eglu::UniqueContext     context         (egl, display, createGLES2Context(egl, display, config));
        glw::Functions                  gl;
index 11a377b..4e3e384 100644 (file)
@@ -328,12 +328,9 @@ void readPixels (const glw::Functions& gl, tcu::Surface* screen)
 
 void PreservingSwapTest::initEGLSurface (EGLConfig config)
 {
-       const eglu::NativeWindowFactory*        factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory&        factory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-       if (!factory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
-       m_window                = factory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+       m_window                = factory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, config, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
        m_eglSurface    = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_window, m_eglDisplay, config, DE_NULL);
 }
 
index 3db27f5..be44395 100644 (file)
@@ -306,18 +306,15 @@ public:
                tcu::TestLog&                                           log                             = m_testCtx.getLog();
                const int                                                       width                   = 64;
                const int                                                       height                  = 64;
-               const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+               const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
                ConfigInfo                                                      info;
 
-               if (!windowFactory)
-                       TCU_THROW(NotSupportedError, "Windows not supported");
-
                eglu::queryConfigInfo(egl, display, config, &info);
 
                log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
                EGLU_CHECK_MSG(egl, "before queries");
 
-               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
                eglu::UniqueSurface                                     surface (egl, display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL));
 
                logCommonSurfaceAttributes      (log, egl, display, *surface);
@@ -340,18 +337,15 @@ public:
                tcu::TestLog&                                           log                             = m_testCtx.getLog();
                const int                                                       width                   = 64;
                const int                                                       height                  = 64;
-               const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+               const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
                ConfigInfo                                                      info;
 
-               if (!pixmapFactory)
-                       TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
                eglu::queryConfigInfo(egl, display, config, &info);
 
                log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
                EGLU_CHECK_MSG(egl, "before queries");
 
-               de::UniquePtr<eglu::NativePixmap>       pixmap  (pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
+               de::UniquePtr<eglu::NativePixmap>       pixmap  (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
                eglu::UniqueSurface                                     surface (egl, display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL));
 
                logCommonSurfaceAttributes      (log, egl, display, *surface);
@@ -585,18 +579,15 @@ public:
                tcu::TestLog&                                           log                             = m_testCtx.getLog();
                const int                                                       width                   = 64;
                const int                                                       height                  = 64;
-               const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+               const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
                ConfigInfo                                                      info;
 
-               if (!windowFactory)
-                       TCU_THROW(NotSupportedError, "Windows not supported");
-
                eglu::queryConfigInfo(egl, display, config, &info);
 
                log << TestLog::Message << "Creating window surface with config ID " << info.configId << TestLog::EndMessage;
                EGLU_CHECK_MSG(egl, "before queries");
 
-               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
+               de::UniquePtr<eglu::NativeWindow>       window  (windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()))));
                eglu::UniqueSurface                                     surface (egl, display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL));
 
                testAttributes(display, *surface, EGL_WINDOW_BIT, info);
@@ -617,18 +608,15 @@ public:
                tcu::TestLog&                                           log                             = m_testCtx.getLog();
                const int                                                       width                   = 64;
                const int                                                       height                  = 64;
-               const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+               const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
                ConfigInfo                                                      info;
 
-               if (!pixmapFactory)
-                       TCU_THROW(NotSupportedError, "Pixmaps not supported");
-
                eglu::queryConfigInfo(egl, display, config, &info);
 
                log << TestLog::Message << "Creating pixmap surface with config ID " << info.configId << TestLog::EndMessage;
                EGLU_CHECK_MSG(egl, "before queries");
 
-               de::UniquePtr<eglu::NativePixmap>       pixmap  (pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
+               de::UniquePtr<eglu::NativePixmap>       pixmap  (pixmapFactory.createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
                eglu::UniqueSurface                                     surface (egl, display, eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, display, config, DE_NULL));
 
                testAttributes(display, *surface, EGL_PIXMAP_BIT, info);
index 01fd576..b2c81a0 100644 (file)
@@ -130,15 +130,12 @@ void RenderCase::executeForConfig (EGLDisplay display, EGLConfig config)
                                                          string("Config") + de::toString(configId) + "-Window",
                                                          string("Config ID ") + de::toString(configId) + ", window surface");
 
-               const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
-
-               if (!windowFactory)
-                       TCU_THROW(NotSupportedError, "Windows not supported");
+               const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
 
                try
                {
                        const eglu::WindowParams                        params          (width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()));
-                       de::UniquePtr<eglu::NativeWindow>       window          (windowFactory->createWindow(&nativeDisplay, display, config, DE_NULL, params));
+                       de::UniquePtr<eglu::NativeWindow>       window          (windowFactory.createWindow(&nativeDisplay, display, config, DE_NULL, params));
                        EGLSurface                                                      eglSurface      = createWindowSurface(nativeDisplay, *window, display, config, DE_NULL);
                        eglu::UniqueSurface                                     surface         (egl, display, eglSurface);
 
@@ -158,14 +155,11 @@ void RenderCase::executeForConfig (EGLDisplay display, EGLConfig config)
                                                          string("Config") + de::toString(configId) + "-Pixmap",
                                                          string("Config ID ") + de::toString(configId) + ", pixmap surface");
 
-               const eglu::NativePixmapFactory*        pixmapFactory   = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
-
-               if (!pixmapFactory)
-                       TCU_THROW(NotSupportedError, "Windows not supported");
+               const eglu::NativePixmapFactory&        pixmapFactory   = eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
 
                try
                {
-                       std::auto_ptr<eglu::NativePixmap>       pixmap          (pixmapFactory->createPixmap(&nativeDisplay, display, config, DE_NULL, width, height));
+                       std::auto_ptr<eglu::NativePixmap>       pixmap          (pixmapFactory.createPixmap(&nativeDisplay, display, config, DE_NULL, width, height));
                        EGLSurface                                                      eglSurface      = createPixmapSurface(nativeDisplay, *pixmap, display, config, DE_NULL);
                        eglu::UniqueSurface                                     surface         (egl, display, eglSurface);
 
index 4e829a6..fd250e4 100644 (file)
@@ -163,14 +163,11 @@ void ResizeTest::init (void)
                                                                                                                                                   EGL_CONFIG_ID);
        const Visibility                        visibility              = eglu::parseWindowVisibility(cmdLine);
        NativeDisplay&                          nativeDisplay   = m_eglTestCtx.getNativeDisplay();
-       const NativeWindowFactory*      windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(),
+       const NativeWindowFactory&      windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(),
                                                                                                                                                                  cmdLine);
 
-       if (!windowFactory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
        const WindowParams                      windowParams    (m_oldSize.x(), m_oldSize.y(), visibility);
-       MovePtr<NativeWindow>           nativeWindow    (windowFactory->createWindow(&nativeDisplay,
+       MovePtr<NativeWindow>           nativeWindow    (windowFactory.createWindow(&nativeDisplay,
                                                                                                                                                         eglDisplay,
                                                                                                                                                         eglConfig,
                                                                                                                                                         DE_NULL,
index 52243f4..525ce52 100644 (file)
@@ -270,12 +270,9 @@ void SwapBuffersTest::executeForConfig (EGLDisplay display, EGLConfig config)
        const string                                            configIdStr     (getConfigIdString(egl, display, config));
        tcu::ScopedLogSection                           logSection      (m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
        const int                                                       waitFrames      = 5;
-       const eglu::NativeWindowFactory*        factory         = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory&        factory         = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
-       if (!factory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
-       if ((factory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
+       if ((factory.getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
                TCU_THROW(NotSupportedError, "eglu::NativeWindow doesn't support readScreenPixels()");
 
        {
@@ -292,7 +289,7 @@ void SwapBuffersTest::executeForConfig (EGLDisplay display, EGLConfig config)
                log << TestLog::Message << "Waiting " << waitFrames * 16 << "ms after eglSwapBuffers() and glFinish() for frame to become visible" << TestLog::EndMessage;
        }
 
-       de::UniquePtr<eglu::NativeWindow>       window  (factory->createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(128, 128, eglu::WindowParams::VISIBILITY_VISIBLE)));
+       de::UniquePtr<eglu::NativeWindow>       window  (factory.createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(128, 128, eglu::WindowParams::VISIBILITY_VISIBLE)));
 
        eglu::UniqueSurface                                     surface (egl, display, eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display, config, DE_NULL));
        eglu::UniqueContext                                     context (egl, display, createGLES2Context(egl, display, config));
index f3b24fc..d2df358 100644 (file)
@@ -184,7 +184,7 @@ SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
 void SyncTest::init (void)
 {
        const Library&                                          egl                             = m_eglTestCtx.getLibrary();
-       const eglu::NativeWindowFactory*        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
+       const eglu::NativeWindowFactory&        windowFactory   = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
 
        const EGLint displayAttribList[] =
        {
@@ -200,9 +200,6 @@ void SyncTest::init (void)
                EGL_NONE
        };
 
-       if (!windowFactory)
-               TCU_THROW(NotSupportedError, "Windows not supported");
-
        m_eglDisplay    = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
        m_eglConfig     = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
 
@@ -217,7 +214,7 @@ void SyncTest::init (void)
        EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
 
        // Create surface
-       m_nativeWindow = windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
+       m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
        m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
 
        EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
index 461c137..1602778 100644 (file)
@@ -153,12 +153,9 @@ tcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* te
 
 static const eglu::NativeDisplayFactory& getDefaultDisplayFactory (tcu::TestContext& testCtx)
 {
-       const eglu::NativeDisplayFactory* factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
+       const eglu::NativeDisplayFactory& factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
 
-       if (!factory)
-               TCU_THROW(InternalError, "No native display factories available");
-
-       return *factory;
+       return factory;
 }
 
 PackageContext::PackageContext (tcu::TestContext& testCtx)