浏览代码

Do not crash the application if webVR submitFrame fails

Trevor Baron 6 年之前
父节点
当前提交
d1c420461f
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 0
      dist/preview release/what's new.md
  2. 5 1
      src/Engines/engine.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -160,6 +160,7 @@
 - Warn of motor with maxForce in Oimo, cannonJS support no impostor, cannonJS cylinder axis, ammoJS wake up impostor when apply force/impulse ([TrevorDev](https://github.com/TrevorDev)))
 - Utility layer should render on last active camera ([TrevorDev](https://github.com/TrevorDev))
 - PointerDragBehavior should not let the drag plane get out of sync when rotating the object during dragging ([TrevorDev](https://github.com/TrevorDev))
+- Do not crash the application if webVR submitFrame fails ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))

+ 5 - 1
src/Engines/engine.ts

@@ -2146,7 +2146,11 @@ export class Engine {
         // Submit frame to the vr device, if enabled
         if (this._vrDisplay && this._vrDisplay.isPresenting) {
             // TODO: We should only submit the frame if we read frameData successfully.
-            this._vrDisplay.submitFrame();
+            try {
+                this._vrDisplay.submitFrame();
+            }catch (e) {
+                Tools.Warn("webVR submitFrame has had an unexpected failure: " + e);
+            }
         }
 
         this.onEndFrameObservable.notifyObservers(this);