Exemplo n.º 1
0
static void gfx_ctx_gdi_destroy(void *data)
{
   HWND     window  = win32_get_window();

   (void)data;

   switch (win32_gdi_api)
   {
      case GFX_CTX_NONE:
      default:
         break;
   }

   if (window && win32_gdi_hdc)
   {
      ReleaseDC(window, win32_gdi_hdc);
      win32_gdi_hdc = NULL;
   }

   if (window)
   {
      win32_monitor_from_window();
      win32_destroy_window();
   }

   if (g_restore_desktop)
   {
      win32_monitor_get_info();
      g_restore_desktop     = false;
   }

   g_inited                     = false;
   win32_gdi_major                  = 0;
   win32_gdi_minor                  = 0;
}
Exemplo n.º 2
0
static void gfx_ctx_wgl_destroy(void *data)
{
   HWND     window  = win32_get_window();

   (void)data;

   if (g_hrc)
   {
      glFinish();
      wglMakeCurrent(NULL, NULL);

      if (!video_driver_ctl(RARCH_DISPLAY_CTL_IS_VIDEO_CACHE_CONTEXT, NULL))
      {
         if (g_hw_hrc)
            wglDeleteContext(g_hw_hrc);
         wglDeleteContext(g_hrc);
         g_hrc = NULL;
         g_hw_hrc = NULL;
      }
   }

   if (window && g_hdc)
   {
      ReleaseDC(window, g_hdc);
      g_hdc = NULL;
   }

   if (window)
   {
      win32_monitor_from_window(window, true);
      win32_destroy_window();
   }

   if (g_restore_desktop)
   {
      win32_monitor_get_info();
      g_restore_desktop     = false;
   }

   g_core_hw_context_enable = false;
   g_inited                 = false;
   g_major                  = 0;
   g_minor                  = 0;
   p_swap_interval          = NULL;
}
Exemplo n.º 3
0
static void gfx_ctx_wgl_destroy(void *data)
{
   HWND            window  = win32_get_window();
   gfx_ctx_wgl_data_t *wgl = (gfx_ctx_wgl_data_t*)data;

   switch (win32_api)
   {
      case GFX_CTX_OPENGL_API:
#ifdef HAVE_OPENGL
         if (win32_hrc)
         {
            glFinish();
            wglMakeCurrent(NULL, NULL);

            if (!video_driver_is_video_cache_context())
            {
               if (win32_hw_hrc)
                  wglDeleteContext(win32_hw_hrc);
               wglDeleteContext(win32_hrc);
               win32_hrc = NULL;
               win32_hw_hrc = NULL;
            }
         }
#endif
         break;

      case GFX_CTX_VULKAN_API:
#ifdef HAVE_VULKAN
         vulkan_context_destroy(&win32_vk, win32_vk.vk_surface != VK_NULL_HANDLE);
         if (win32_vk.context.queue_lock)
            slock_free(win32_vk.context.queue_lock);
         memset(&win32_vk, 0, sizeof(win32_vk));
#endif
         break;

      case GFX_CTX_NONE:
      default:
         break;
   }

   if (window && win32_hdc)
   {
      ReleaseDC(window, win32_hdc);
      win32_hdc = NULL;
   }

   if (window)
   {
      win32_monitor_from_window();
      win32_destroy_window();
   }

   if (g_win32_restore_desktop)
   {
      win32_monitor_get_info();
      g_win32_restore_desktop     = false;
   }

#ifdef HAVE_DYNAMIC
   dylib_close(dll_handle);
#endif

   if (wgl)
      free(wgl);

   wgl_adaptive_vsync           = false;
   win32_core_hw_context_enable = false;
   g_win32_inited               = false;
   win32_major                  = 0;
   win32_minor                  = 0;
   p_swap_interval              = NULL;
}