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
}
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);
}
}
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());
}
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);
}
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);
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()");
}
{
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;
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()");
}
{
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;
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[] =
{
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;
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);
{
}
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");
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 (...)
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 (...)
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)
{
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;
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;
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;
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;
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;
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;
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);
}
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);
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);
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);
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);
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);
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);
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,
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()");
{
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));
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[] =
{
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);
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));
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)