static void d3d_free(void *data) { d3d_video_t *d3d = (d3d_video_t*)data; HWND window = win32_get_window(); if (!d3d) return; d3d_deinitialize(d3d); #ifdef HAVE_OVERLAY d3d_free_overlays(d3d); #endif gfx_ctx_free(); #ifndef _XBOX #ifdef HAVE_MENU d3d_free_overlay(d3d, d3d->menu); if (d3d->menu) delete d3d->menu; #endif #endif d3d_device_free(d3d->dev, g_pD3D); d3d->dev = NULL; g_pD3D = NULL; win32_monitor_from_window(window, true); if (d3d) delete d3d; win32_destroy_window(); }
void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id) { unsigned i, fs_monitor; settings_t *settings = config_get_ptr(); MONITORINFOEX *mon = (MONITORINFOEX*)data; HMONITOR *hm_to_use = (HMONITOR*)hm_data; if (!win32_monitor_last) win32_monitor_from_window(GetDesktopWindow(), false); *hm_to_use = win32_monitor_last; fs_monitor = settings->video.monitor_index; if (fs_monitor && fs_monitor <= win32_monitor_count && win32_monitor_all[fs_monitor - 1]) { *hm_to_use = win32_monitor_all[fs_monitor - 1]; *mon_id = fs_monitor - 1; } else { for (i = 0; i < win32_monitor_count; i++) { if (win32_monitor_all[i] != *hm_to_use) continue; *mon_id = i; break; } } memset(mon, 0, sizeof(*mon)); mon->cbSize = sizeof(MONITORINFOEX); GetMonitorInfo(*hm_to_use, (MONITORINFO*)mon); }
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; }
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; }
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; }