Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-05-24 18:26:31 +0300
committerJulian Eisel <julian@blender.org>2020-05-24 18:26:31 +0300
commit6b8555e01cb127479286f603e3f0b772bd1f416e (patch)
treeade6ad077468bfc44149ddf4d919cabbe8ccc8b4
parent8e4c74292a76b7e22aafb63c65d474fa9d886001 (diff)
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).
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr.c7
1 files changed, 6 insertions, 1 deletions
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;
}