Selaa lähdekoodia

Fix issue with query on Edge

David Catuhe 8 vuotta sitten
vanhempi
commit
e65db6ee0c
24 muutettua tiedostoa jossa 24236 lisäystä ja 24197 poistoa
  1. 4199 4198
      dist/preview release/babylon.d.ts
  2. 43 42
      dist/preview release/babylon.js
  3. 21 12
      dist/preview release/babylon.max.js
  4. 4199 4198
      dist/preview release/babylon.module.d.ts
  5. 45 44
      dist/preview release/babylon.worker.js
  6. 7684 7683
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 31 31
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 21 12
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 7684 7683
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  10. 1 1
      dist/preview release/gui/babylon.gui.min.js
  11. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  12. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  13. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  14. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  16. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  20. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  21. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  22. 24 14
      src/Mesh/babylon.abstractMesh.ts
  23. 6 2
      src/babylon.engine.ts
  24. 1 0
      src/babylon.mixins.ts

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4199 - 4198
dist/preview release/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 43 - 42
dist/preview release/babylon.js


+ 21 - 12
dist/preview release/babylon.max.js

@@ -10986,6 +10986,9 @@ var BABYLON;
         Engine.prototype.createQuery = function () {
             return this._gl.createQuery();
         };
+        Engine.prototype.deleteQuery = function (query) {
+            this.deleteQuery(query);
+        };
         Engine.prototype.isQueryResultAvailable = function (query) {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);
         };
@@ -11818,14 +11821,12 @@ var BABYLON;
             // Properties
             _this.definedFacingForward = true; // orientation for POV movement & rotation
             _this.position = BABYLON.Vector3.Zero();
-            _this._webGLVersion = _this.getEngine().webGLVersion;
-            _this._occlusionInternalRetryCounter = 0;
+            _this.isOcclusionQueryInProgress = false;
+            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
             _this.occlusionRetryCount = -1;
+            _this._occlusionInternalRetryCounter = 0;
             _this._isOccluded = false;
-            _this.occlusionQuery = _this.getEngine().createQuery();
-            _this.isOcclusionQueryInProgress = false;
-            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
@@ -13417,8 +13418,14 @@ var BABYLON;
                     sceneOctree.dynamicContent.splice(index, 1);
                 }
             }
+            // Query
+            var engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
             // Remove from scene
             this.getScene().removeMesh(this);
             if (!doNotRecurse) {
@@ -13859,15 +13866,15 @@ var BABYLON;
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
         };
         AbstractMesh.prototype.checkOcclusionQuery = function () {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
-            var engine = this.getEngine();
             if (this.isOcclusionQueryInProgress) {
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
                     this.isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
                     this._isOccluded = occlusionQueryResult === 1 ? false : true;
@@ -13875,7 +13882,6 @@ var BABYLON;
                 else {
                     this._occlusionInternalRetryCounter++;
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
                         this.isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
                         // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
@@ -13889,7 +13895,10 @@ var BABYLON;
             }
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
             this.isOcclusionQueryInProgress = true;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4199 - 4198
dist/preview release/babylon.module.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 45 - 44
dist/preview release/babylon.worker.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7684 - 7683
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 31 - 31
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 21 - 12
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -10986,6 +10986,9 @@ var BABYLON;
         Engine.prototype.createQuery = function () {
             return this._gl.createQuery();
         };
+        Engine.prototype.deleteQuery = function (query) {
+            this.deleteQuery(query);
+        };
         Engine.prototype.isQueryResultAvailable = function (query) {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE);
         };
@@ -11818,14 +11821,12 @@ var BABYLON;
             // Properties
             _this.definedFacingForward = true; // orientation for POV movement & rotation
             _this.position = BABYLON.Vector3.Zero();
-            _this._webGLVersion = _this.getEngine().webGLVersion;
-            _this._occlusionInternalRetryCounter = 0;
+            _this.isOcclusionQueryInProgress = false;
+            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this.occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
             _this.occlusionRetryCount = -1;
+            _this._occlusionInternalRetryCounter = 0;
             _this._isOccluded = false;
-            _this.occlusionQuery = _this.getEngine().createQuery();
-            _this.isOcclusionQueryInProgress = false;
-            _this.occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
             _this._rotation = BABYLON.Vector3.Zero();
             _this._scaling = BABYLON.Vector3.One();
             _this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
@@ -13417,8 +13418,14 @@ var BABYLON;
                     sceneOctree.dynamicContent.splice(index, 1);
                 }
             }
+            // Query
+            var engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
             // Remove from scene
             this.getScene().removeMesh(this);
             if (!doNotRecurse) {
@@ -13859,15 +13866,15 @@ var BABYLON;
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
         };
         AbstractMesh.prototype.checkOcclusionQuery = function () {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
-            var engine = this.getEngine();
             if (this.isOcclusionQueryInProgress) {
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
                     this.isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
                     this._isOccluded = occlusionQueryResult === 1 ? false : true;
@@ -13875,7 +13882,6 @@ var BABYLON;
                 else {
                     this._occlusionInternalRetryCounter++;
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
                         this.isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
                         // if optimistic set isOccluded to false regardless of the status of isOccluded. (Render in the current render loop)
@@ -13889,7 +13895,10 @@ var BABYLON;
             }
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
             this.isOcclusionQueryInProgress = true;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7684 - 7683
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


+ 24 - 14
src/Mesh/babylon.abstractMesh.ts

@@ -128,10 +128,12 @@
         public definedFacingForward = true; // orientation for POV movement & rotation
         public position = Vector3.Zero();
 
-        private _webGLVersion = this.getEngine().webGLVersion;
-        private _occlusionInternalRetryCounter = 0;
+        public isOcclusionQueryInProgress = false;
+        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
         public occlusionType = AbstractMesh.OCCLUSION_TYPE_NONE;
         public occlusionRetryCount = -1;
+        private _occlusionInternalRetryCounter = 0;
+
         protected _isOccluded = false;
         get isOccluded(): boolean {
             return this._isOccluded;
@@ -140,10 +142,7 @@
             this._isOccluded = value;
         }
 
-        public occlusionQuery = this.getEngine().createQuery();
-        public isOcclusionQueryInProgress = false;
-
-        public occlusionQueryAlgorithmType = AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE;
+        private _occlusionQuery: WebGLQuery;
 
         private _rotation = Vector3.Zero();
         private _rotationQuaternion: Quaternion;
@@ -1788,8 +1787,15 @@
                 }
             }
 
+            // Query
+            let engine = this.getScene().getEngine();
+            if (this._occlusionQuery) {
+                engine.deleteQuery(this._occlusionQuery);
+                this._occlusionQuery = null;
+            }
+
             // Engine
-            this.getScene().getEngine().wipeCaches();
+            engine.wipeCaches();
 
             // Remove from scene
             this.getScene().removeMesh(this);
@@ -2271,18 +2277,18 @@
         }
 
         protected checkOcclusionQuery() {
-            if (this._webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
+            var engine = this.getEngine();
+
+            if (engine.webGLVersion < 2 || this.occlusionType === AbstractMesh.OCCLUSION_TYPE_NONE) {
                 this._isOccluded = false;
                 return;
             }
 
-            var engine = this.getEngine();
-
             if (this.isOcclusionQueryInProgress) {
                 
-                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this.occlusionQuery);
+                var isOcclusionQueryAvailable = engine.isQueryResultAvailable(this._occlusionQuery);
                 if (isOcclusionQueryAvailable) {
-                    var occlusionQueryResult = engine.getQueryResult(this.occlusionQuery);
+                    var occlusionQueryResult = engine.getQueryResult(this._occlusionQuery);
 
                     this.isOcclusionQueryInProgress = false;
                     this._occlusionInternalRetryCounter = 0;
@@ -2293,7 +2299,6 @@
                     this._occlusionInternalRetryCounter++;
 
                     if (this.occlusionRetryCount !== -1 && this._occlusionInternalRetryCounter > this.occlusionRetryCount) {
-                        // break;
                         this.isOcclusionQueryInProgress = false;
                         this._occlusionInternalRetryCounter = 0;
 
@@ -2311,7 +2316,12 @@
 
             var scene = this.getScene();
             var occlusionBoundingBoxRenderer = scene.getBoundingBoxRenderer();
-            engine.beginQuery(this.occlusionQueryAlgorithmType, this.occlusionQuery);
+
+            if (!this._occlusionQuery) {
+                this._occlusionQuery = engine.createQuery();
+            }
+
+            engine.beginQuery(this.occlusionQueryAlgorithmType, this._occlusionQuery);
             occlusionBoundingBoxRenderer.renderOcclusionBoundingBox(this);
             engine.endQuery(this.occlusionQueryAlgorithmType);
             this.isOcclusionQueryInProgress = true;

+ 6 - 2
src/babylon.engine.ts

@@ -4395,11 +4395,15 @@
             return this._gl.createQuery();
         }
 
-        public isQueryResultAvailable(query: WebGLQuery) {
+        public deleteQuery(query: WebGLQuery): void {
+            this.deleteQuery(query);
+        }
+
+        public isQueryResultAvailable(query: WebGLQuery): boolean {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT_AVAILABLE) as boolean;
         }
 
-        public getQueryResult(query: WebGLQuery) {
+        public getQueryResult(query: WebGLQuery): number {
             return this._gl.getQueryParameter(query, this._gl.QUERY_RESULT) as number;
         }
 

+ 1 - 0
src/babylon.mixins.ts

@@ -46,6 +46,7 @@ interface WebGLRenderingContext {
 
     // Occlusion Query
     createQuery(): WebGLQuery;
+    deleteQuery(query: WebGLQuery);
     beginQuery(target: number, query: WebGLQuery);
     endQuery(target: number): void;
     getQueryParameter(query: WebGLQuery, pname: number): any;