Пример #1
0
	virtual HRESULT STDMETHODCALLTYPE EnumAdapters1(
		UINT adapter,
		IDXGIAdapter1 **out_adapter)
	{
		*out_adapter = 0;
		if(adapter == 0)
		{
			return GalliumDXGIAdapterCreate(this, platform, display, out_adapter);
		}
#if 0
		// TODO: enable this
		if(platform == native_get_x11_platform())
		{
			unsigned nscreens = ScreenCount((Display*)display);
			if(adapter < nscreens)
			{
				unsigned def_screen = DefaultScreen(display);
				if(adapter <= def_screen)
					--adapter;
				*out_adapter = GalliumDXGIAdapterCreate(this, platform, display, adapter);
				return S_OK;
			}
		}
#endif
		return DXGI_ERROR_NOT_FOUND;
	}
/**
 * Get the native platform.
 */
static const struct native_platform *
egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType plat)
{
   struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);

   if (!gdrv->platforms[plat]) {
      const char *plat_name = NULL;
      const struct native_platform *nplat = NULL;

      switch (plat) {
      case _EGL_PLATFORM_WINDOWS:
         plat_name = "Windows";
#ifdef HAVE_GDI_BACKEND
         nplat = native_get_gdi_platform(&egl_g3d_native_event_handler);
#endif
         break;
      case _EGL_PLATFORM_X11:
         plat_name = "X11";
#ifdef HAVE_X11_BACKEND
         nplat = native_get_x11_platform(&egl_g3d_native_event_handler);
#endif
	 break;
      case _EGL_PLATFORM_WAYLAND:
         plat_name = "wayland";
#ifdef HAVE_WAYLAND_BACKEND
         nplat = native_get_wayland_platform(&egl_g3d_native_event_handler);
#endif
         break;
      case _EGL_PLATFORM_DRM:
         plat_name = "DRM";
#ifdef HAVE_DRM_BACKEND
         nplat = native_get_drm_platform(&egl_g3d_native_event_handler);
#endif
         break;
      case _EGL_PLATFORM_FBDEV:
         plat_name = "FBDEV";
#ifdef HAVE_FBDEV_BACKEND
         nplat = native_get_fbdev_platform(&egl_g3d_native_event_handler);
#endif
         break;
      case _EGL_PLATFORM_NULL:
         plat_name = "NULL";
#ifdef HAVE_NULL_BACKEND
         nplat = native_get_null_platform(&egl_g3d_native_event_handler);
#endif
         break;
      case _EGL_PLATFORM_ANDROID:
         plat_name = "Android";
#ifdef HAVE_ANDROID_BACKEND
         nplat = native_get_android_platform(&egl_g3d_native_event_handler);
#endif
         break;
      default:
         break;
      }

      if (!nplat)
         _eglLog(_EGL_WARNING, "unsupported platform %s", plat_name);

      gdrv->platforms[plat] = nplat;
   }

   return gdrv->platforms[plat];
}