Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/xr/intern/wm_xr_draw.c
| Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | static void wm_xr_draw_viewport_buffers_to_active_framebuffer( | ||||
| wmViewport(&rect); | wmViewport(&rect); | ||||
| /* For upside down contexts, draw with inverted y-values. */ | /* For upside down contexts, draw with inverted y-values. */ | ||||
| if (is_upside_down) { | if (is_upside_down) { | ||||
| SWAP(int, rect.ymin, rect.ymax); | SWAP(int, rect.ymin, rect.ymax); | ||||
| } | } | ||||
| GPU_viewport_draw_to_screen_ex( | GPU_viewport_draw_to_screen_ex( | ||||
| surface_data->viewport, 0, &rect, draw_view->expects_srgb_buffer, true); | surface_data->viewport[draw_view->view_idx], 0, &rect, draw_view->expects_srgb_buffer, true); | ||||
| } | } | ||||
| /** | /** | ||||
| * \brief Draw a viewport for a single eye. | * \brief Draw a viewport for a single eye. | ||||
| * | * | ||||
| * This is the main viewport drawing function for VR sessions. It's assigned to Ghost-XR as a | * This is the main viewport drawing function for VR sessions. It's assigned to Ghost-XR as a | ||||
| * callback (see GHOST_XrDrawViewFunc()) and executed for each view (read: eye). | * callback (see GHOST_XrDrawViewFunc()) and executed for each view (read: eye). | ||||
| */ | */ | ||||
| Show All 35 Lines | ED_view3d_draw_offscreen_simple(draw_data->depsgraph, | ||||
| viewmat, | viewmat, | ||||
| winmat, | winmat, | ||||
| settings->clip_start, | settings->clip_start, | ||||
| settings->clip_end, | settings->clip_end, | ||||
| false, | false, | ||||
| true, | true, | ||||
| NULL, | NULL, | ||||
| false, | false, | ||||
| surface_data->offscreen, | surface_data->offscreen[draw_view->view_idx], | ||||
| surface_data->viewport); | surface_data->viewport[draw_view->view_idx]); | ||||
| /* The draw-manager uses both GPUOffscreen and GPUViewport to manage frame and texture buffers. A | /* The draw-manager uses both GPUOffscreen and GPUViewport to manage frame and texture buffers. A | ||||
| * call to GPU_viewport_draw_to_screen() is still needed to get the final result from the | * call to GPU_viewport_draw_to_screen() is still needed to get the final result from the | ||||
| * viewport buffers composited together and potentially color managed for display on screen. | * viewport buffers composited together and potentially color managed for display on screen. | ||||
| * It needs a bound frame-buffer to draw into, for which we simply reuse the GPUOffscreen one. | * It needs a bound frame-buffer to draw into, for which we simply reuse the GPUOffscreen one. | ||||
| * | * | ||||
| * In a next step, Ghost-XR will use the currently bound frame-buffer to retrieve the image | * In a next step, Ghost-XR will use the currently bound frame-buffer to retrieve the image | ||||
| * to be submitted to the OpenXR swap-chain. So do not un-bind the off-screen yet! */ | * to be submitted to the OpenXR swap-chain. So do not un-bind the off-screen yet! */ | ||||
| GPU_offscreen_bind(surface_data->offscreen, false); | GPU_offscreen_bind(surface_data->offscreen[draw_view->view_idx], false); | ||||
| wm_xr_draw_viewport_buffers_to_active_framebuffer(xr_data->runtime, surface_data, draw_view); | wm_xr_draw_viewport_buffers_to_active_framebuffer(xr_data->runtime, surface_data, draw_view); | ||||
| } | } | ||||