[Bf-blender-cvs] [6b8555e01cb] master: VR: Fix big performance bottleneck for simple scenes

Julian Eisel noreply at git.blender.org
Sun May 24 17:38:14 CEST 2020


Commit: 6b8555e01cb127479286f603e3f0b772bd1f416e
Author: Julian Eisel
Date:   Sun May 24 17:26:31 2020 +0200
Branches: master
https://developer.blender.org/rB6b8555e01cb127479286f603e3f0b772bd1f416e

VR: Fix big performance bottleneck for simple scenes

Blender's main loop puts the main thread to sleep for 5ms if no user input was
received from the OS. We never want that to happen while the VR session is
running, which runs on the main thread too.

For simpler scenes, where the viewport already draws fast, this may have quite
some impact. E.g. in my tests, the classroom scene went from ~55 to quite
stable 90 FPS in solid mode (total render time as measured and averaged by
Windows Mixed Reality utilities). With Eevee, it only went from 41 to 47 FPS.
In complex files, there's barely a difference. E.g. less than 1 FPS increase in
a Spring file (both Solid mode and Eevee).

===================================================================

M	source/blender/windowmanager/xr/intern/wm_xr.c

===================================================================

diff --git a/source/blender/windowmanager/xr/intern/wm_xr.c b/source/blender/windowmanager/xr/intern/wm_xr.c
index 69c9034d51f..90f30809136 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr.c
@@ -126,7 +126,12 @@ void wm_xr_exit(wmWindowManager *wm)
 bool wm_xr_events_handle(wmWindowManager *wm)
 {
   if (wm->xr.runtime && wm->xr.runtime->context) {
-    return GHOST_XrEventsHandle(wm->xr.runtime->context);
+    GHOST_XrEventsHandle(wm->xr.runtime->context);
+
+    /* wm_window_process_events() uses the return value to determine if it can put the main thread
+     * to sleep for some milliseconds. We never want that to happen while the VR session runs on
+     * the main thread. So always return true. */
+    return true;
   }
   return false;
 }



More information about the Bf-blender-cvs mailing list