Exemplo n.º 1
0
bool menu_display_font_init_first(const void **font_driver,
      void **font_handle, void *video_data, const char *font_path,
      float font_size)
{
   settings_t *settings = config_get_ptr();
   global_t   *global   = global_get_ptr();

   if (settings->video.threaded
         && !global->system.hw_render_callback.context_type)
   {
      driver_t *driver    = driver_get_ptr();
      thread_video_t *thr = (thread_video_t*)driver->video_data;

      if (!thr)
         return false;

      thr->cmd_data.font_init.method      = font_init_first;
      thr->cmd_data.font_init.font_driver = (const void**)font_driver;
      thr->cmd_data.font_init.font_handle = font_handle;
      thr->cmd_data.font_init.video_data  = video_data;
      thr->cmd_data.font_init.font_path   = font_path;
      thr->cmd_data.font_init.font_size   = font_size;
      thr->cmd_data.font_init.api         = FONT_DRIVER_RENDER_OPENGL_API;

      thr->send_cmd_func(thr,   CMD_FONT_INIT);
      thr->wait_reply_func(thr, CMD_FONT_INIT);

      return thr->cmd_data.font_init.return_value;
   }

   return font_init_first(font_driver, font_handle, video_data,
         font_path, font_size, FONT_DRIVER_RENDER_OPENGL_API);
}
Exemplo n.º 2
0
static bool menu_display_d3d_font_init_first(const void **font_driver,
      void **font_handle, void *video_data, const char *font_path,
      float font_size)
{
   settings_t *settings = config_get_ptr();
   const struct retro_hw_render_callback *hw_render =
      (const struct retro_hw_render_callback*)video_driver_callback();

   if (settings->video.threaded && !hw_render->context_type)
   {
      thread_packet_t pkt;
      driver_t *driver    = driver_get_ptr();
      thread_video_t *thr = (thread_video_t*)driver->video_data;

      if (!thr)
         return false;

      pkt.type                       = CMD_FONT_INIT;
      pkt.data.font_init.method      = font_init_first;
      pkt.data.font_init.font_driver = (const void**)font_driver;
      pkt.data.font_init.font_handle = font_handle;
      pkt.data.font_init.video_data  = video_data;
      pkt.data.font_init.font_path   = font_path;
      pkt.data.font_init.font_size   = font_size;
      pkt.data.font_init.api         = FONT_DRIVER_RENDER_DIRECT3D_API;

      thr->send_and_wait(thr, &pkt);

      return pkt.data.font_init.return_value;
   }

   return font_init_first(font_driver, font_handle, video_data,
         font_path, font_size, FONT_DRIVER_RENDER_DIRECT3D_API);
}
Exemplo n.º 3
0
font_data_t *font_driver_init_first(
      void *video_data, const char *font_path, float font_size,
      bool threading_hint, enum font_driver_render_api api)
{
   const void *font_driver;
   void *font_handle;
   bool ok = false;

#ifdef HAVE_THREADS
   settings_t *settings = config_get_ptr();

   if (threading_hint 
         && settings->video.threaded 
         && !video_driver_is_hw_context())
      ok = video_thread_font_init(&font_driver, &font_handle,
            video_data, font_path, font_size, api, font_init_first);
   else
#endif
   ok = font_init_first(&font_driver, &font_handle,
         video_data, font_path, font_size, api);

   if (ok)
   {
      font_data_t *font   = (font_data_t*)calloc(1, sizeof(*font));
      font->renderer      = (const font_renderer_t*)font_driver;
      font->renderer_data = font_handle;
      font->size          = font_size;
      return font;
   }

   return NULL;
}
Exemplo n.º 4
0
bool font_driver_init_first(const void **font_driver, void **font_handle,
      void *data, const char *font_path, float font_size,
      bool threading_hint,
      enum font_driver_render_api api)
{
   const void **new_font_driver = font_driver ? font_driver 
      : (const void**)&font_osd_driver;
   void **new_font_handle        = font_handle ? font_handle 
      : (void**)&font_osd_data;
#ifdef HAVE_THREADS
   settings_t *settings = config_get_ptr();
   const struct retro_hw_render_callback *hw_render =
      (const struct retro_hw_render_callback*)video_driver_callback();

   if (threading_hint && settings->video.threaded && !hw_render->context_type)
      return rarch_threaded_video_font_init(new_font_driver, new_font_handle,
            data, font_path, font_size, api, font_init_first);
#endif

   return font_init_first(new_font_driver, new_font_handle,
         data, font_path, font_size, api);
}
Exemplo n.º 5
0
bool font_driver_init_first(
      const void **font_driver, void **font_handle,
      void *data, const char *font_path, float font_size,
      bool threading_hint,
      enum font_driver_render_api api)
{
   const void **new_font_driver = font_driver ? font_driver 
      : (const void**)&font_osd_driver;
   void **new_font_handle        = font_handle ? font_handle 
      : (void**)&font_osd_data;
#ifdef HAVE_THREADS
   settings_t *settings = config_get_ptr();

   if (threading_hint 
         && settings->video.threaded 
         && !video_driver_ctl(RARCH_DISPLAY_CTL_IS_HW_CONTEXT, NULL))
      return rarch_threaded_video_font_init(new_font_driver, new_font_handle,
            data, font_path, font_size, api, font_init_first);
#endif

   return font_init_first(new_font_driver, new_font_handle,
         data, font_path, font_size, api);
}