Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_window.c
| Show First 20 Lines • Show All 550 Lines • ▼ Show 20 Lines | static void wm_window_ghostwindow_add(wmWindowManager *wm, | ||||
| if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { | if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP) { | ||||
| glSettings.flags |= GHOST_glStereoVisual; | glSettings.flags |= GHOST_glStereoVisual; | ||||
| } | } | ||||
| if (G.debug & G_DEBUG_GPU) { | if (G.debug & G_DEBUG_GPU) { | ||||
| glSettings.flags |= GHOST_glDebugContext; | glSettings.flags |= GHOST_glDebugContext; | ||||
| } | } | ||||
| eGPUBackendType gpu_backend = GPU_backend_type_selection_get(); | |||||
| glSettings.context_type = wm_ghost_drawing_context_type(gpu_backend); | |||||
| int scr_w, scr_h; | int scr_w, scr_h; | ||||
| wm_get_desktopsize(&scr_w, &scr_h); | wm_get_desktopsize(&scr_w, &scr_h); | ||||
| int posy = (scr_h - win->posy - win->sizey); | int posy = (scr_h - win->posy - win->sizey); | ||||
| /* Clear drawable so we can set the new window. */ | /* Clear drawable so we can set the new window. */ | ||||
| wmWindow *prev_windrawable = wm->windrawable; | wmWindow *prev_windrawable = wm->windrawable; | ||||
| wm_window_clear_drawable(wm); | wm_window_clear_drawable(wm); | ||||
| GHOST_WindowHandle ghostwin = GHOST_CreateWindow(g_system, | GHOST_WindowHandle ghostwin = GHOST_CreateWindow(g_system, | ||||
| (win->parent) ? win->parent->ghostwin : NULL, | (win->parent) ? win->parent->ghostwin : NULL, | ||||
| title, | title, | ||||
| win->posx, | win->posx, | ||||
| posy, | posy, | ||||
| win->sizex, | win->sizex, | ||||
| win->sizey, | win->sizey, | ||||
| (GHOST_TWindowState)win->windowstate, | (GHOST_TWindowState)win->windowstate, | ||||
| is_dialog, | is_dialog, | ||||
| GHOST_kDrawingContextTypeOpenGL, | |||||
| glSettings); | glSettings); | ||||
| if (ghostwin) { | if (ghostwin) { | ||||
| win->gpuctx = GPU_context_create(ghostwin, NULL); | win->gpuctx = GPU_context_create(ghostwin, NULL); | ||||
| GPU_render_begin(); | GPU_render_begin(); | ||||
| /* needed so we can detect the graphics card below */ | /* needed so we can detect the graphics card below */ | ||||
| GPU_init(); | GPU_init(); | ||||
| ▲ Show 20 Lines • Show All 1,025 Lines • ▼ Show 20 Lines | |||||
| #else | #else | ||||
| /* While this could be supported, at the moment it's only needed with GHOST X11/WAYLAND | /* While this could be supported, at the moment it's only needed with GHOST X11/WAYLAND | ||||
| * to check which was selected and the API call may be removed after that's no longer needed. | * to check which was selected and the API call may be removed after that's no longer needed. | ||||
| * Use dummy values to prevent this being used on other systems. */ | * Use dummy values to prevent this being used on other systems. */ | ||||
| return g_system ? "DEFAULT" : "NONE"; | return g_system ? "DEFAULT" : "NONE"; | ||||
| #endif | #endif | ||||
| } | } | ||||
| GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gpu_backend) | |||||
| { | |||||
| switch (gpu_backend) { | |||||
| case GPU_BACKEND_NONE: | |||||
| return GHOST_kDrawingContextTypeNone; | |||||
| case GPU_BACKEND_ANY: | |||||
| case GPU_BACKEND_OPENGL: | |||||
| return GHOST_kDrawingContextTypeOpenGL; | |||||
| #ifdef WITH_METAL_BACKEND | |||||
| case GPU_BACKEND_METAL: | |||||
| return GHOST_kDrawingContextTypeMetal; | |||||
| #endif | |||||
| } | |||||
| BLI_assert_unreachable(); | |||||
| return GHOST_kDrawingContextTypeNone; | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Event Timer | /** \name Event Timer | ||||
| * \{ */ | * \{ */ | ||||
| void WM_event_timer_sleep(wmWindowManager *wm, | void WM_event_timer_sleep(wmWindowManager *wm, | ||||
| wmWindow *UNUSED(win), | wmWindow *UNUSED(win), | ||||
| ▲ Show 20 Lines • Show All 782 Lines • Show Last 20 Lines | |||||