Exemplo n.º 1
0
/**
 * 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;

      plat_name = "DRM";
      nplat = native_get_drm_platform(&egl_g3d_native_event_handler);

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

      gdrv->platforms[plat] = nplat;
   }

   return gdrv->platforms[plat];
}
/**
 * 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];
}