Skip to content

Commit

Permalink
Fix XR pre_draw
Browse files Browse the repository at this point in the history
  • Loading branch information
addmix committed Feb 21, 2024
1 parent b09f793 commit c2c979b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion servers/rendering/renderer_viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,9 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
XRServer *xr_server = XRServer::get_singleton();
if (xr_server != nullptr) {
// let our XR server know we're about to render our frames so we can get our frame timing
xr_server->pre_render();

//commented out to match https://github.com/godotengine/godot/compare/master...V-Sekai:godot:move_pre_render
//xr_server->pre_render();

// retrieve the interface responsible for rendering
xr_interface = xr_server->get_primary_interface();
Expand Down
12 changes: 11 additions & 1 deletion servers/rendering/rendering_server_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ void RenderingServerDefault::request_frame_drawn_callback(const Callable &p_call
}

void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
//added to match https://github.com/godotengine/godot/compare/master...V-Sekai:godot:move_pre_render
XRServer *xr_server = XRServer::get_singleton();
if (xr_server != nullptr) {
// let our XR server know we're about to render our frames so we can get our frame timing
xr_server->pre_render();
}



//needs to be done before changes is reset to 0, to not force the editor to redraw
RS::get_singleton()->emit_signal(SNAME("frame_pre_draw"));

Expand Down Expand Up @@ -96,7 +105,8 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
RSG::rasterizer->end_frame(p_swap_buffers);
}

XRServer *xr_server = XRServer::get_singleton();
//commented out to match https://github.com/godotengine/godot/compare/master...V-Sekai:godot:move_pre_render
//XRServer *xr_server = XRServer::get_singleton();
if (xr_server != nullptr) {
// let our XR server know we're done so we can get our frame timing
xr_server->end_frame();
Expand Down

0 comments on commit c2c979b

Please sign in to comment.