David Catuhe 7 gadi atpakaļ
vecāks
revīzija
09be535947

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 9548 - 9541
Playground/babylon.d.txt


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 12516 - 12509
dist/preview release/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 44 - 44
dist/preview release/babylon.js


+ 36 - 14
dist/preview release/babylon.max.js

@@ -8952,6 +8952,12 @@ var BABYLON;
             this._webGLVersion = 1.0;
             this._badOS = false;
             this._badDesktopOS = false;
+            /**
+             * Gets or sets a value indicating if we want to disable texture binding optmization.
+             * This could be required on some buggy drivers which wants to have textures bound in a progressive order
+             * By default Babylon.js will try to let textures bound and only update the samplers to point where the texture is.
+             */
+            this.disableTextureBindingOptimization = false;
             this.onVRDisplayChangedObservable = new BABYLON.Observable();
             this.onVRRequestPresentComplete = new BABYLON.Observable();
             this.onVRRequestPresentStart = new BABYLON.Observable();
@@ -8995,6 +9001,7 @@ var BABYLON;
             this._vaoRecordInProgress = false;
             this._mustWipeVertexAttributes = false;
             this._nextFreeTextureSlots = new Array();
+            this._maxSimultaneousTextures = 0;
             this._activeRequests = new Array();
             // Hardware supported Compressed Textures
             this._texturesSupported = new Array();
@@ -9070,6 +9077,9 @@ var BABYLON;
                                     case "uniformBuffer":
                                         this.disableUniformBuffers = true;
                                         break;
+                                    case "textureBindingOptimization":
+                                        this.disableTextureBindingOptimization = true;
+                                        break;
                                 }
                             }
                             break;
@@ -9850,7 +9860,8 @@ var BABYLON;
             this.setDepthFunctionToLessOrEqual();
             this.setDepthWrite(true);
             // Texture maps
-            for (var slot = 0; slot < this._caps.maxCombinedTexturesImageUnits; slot++) {
+            this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;
+            for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {
                 this._nextFreeTextureSlots.push(slot);
             }
         };
@@ -9890,7 +9901,7 @@ var BABYLON;
                 this._boundTexturesCache[key] = null;
             }
             this._nextFreeTextureSlots = [];
-            for (var slot = 0; slot < this._caps.maxCombinedTexturesImageUnits; slot++) {
+            for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {
                 this._nextFreeTextureSlots.push(slot);
             }
             this._activeChannel = -1;
@@ -12743,7 +12754,7 @@ var BABYLON;
             this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);
         };
         Engine.prototype.unbindAllTextures = function () {
-            for (var channel = 0; channel < this._caps.maxCombinedTexturesImageUnits; channel++) {
+            for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {
                 this._activateTextureChannel(channel);
                 this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                 this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -12766,18 +12777,28 @@ var BABYLON;
                 return -1;
             }
             internalTexture._initialSlot = channel;
-            if (channel !== internalTexture._designatedSlot) {
-                if (internalTexture._designatedSlot > -1) {
-                    return internalTexture._designatedSlot;
-                }
-                else {
-                    // No slot for this texture, let's pick a new one (if we find a free slot)
-                    if (this._nextFreeTextureSlots.length) {
-                        return this._nextFreeTextureSlots[0];
+            if (this.disableTextureBindingOptimization) {
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) {
+                        this._removeDesignatedSlot(internalTexture);
                     }
-                    // We need to recycle the oldest bound texture, sorry.
                     this._textureCollisions.addCount(1, false);
-                    return this._removeDesignatedSlot(this._boundTexturesStack[0]);
+                }
+            }
+            else {
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) {
+                        return internalTexture._designatedSlot;
+                    }
+                    else {
+                        // No slot for this texture, let's pick a new one (if we find a free slot)
+                        if (this._nextFreeTextureSlots.length) {
+                            return this._nextFreeTextureSlots[0];
+                        }
+                        // We need to recycle the oldest bound texture, sorry.
+                        this._textureCollisions.addCount(1, false);
+                        return this._removeDesignatedSlot(this._boundTexturesStack[0]);
+                    }
                 }
             }
             return channel;
@@ -13551,7 +13572,8 @@ var BABYLON;
         /** Use this array to turn off some WebGL2 features on known buggy browsers version */
         Engine.ExceptionList = [
             { key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] },
-            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }
+            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
+            { key: "Macintosh", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] },
         ];
         Engine.Instances = new Array();
         // Const statics

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 44 - 44
dist/preview release/babylon.worker.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 11238 - 11231
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 44 - 44
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 36 - 14
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -8952,6 +8952,12 @@ var BABYLON;
             this._webGLVersion = 1.0;
             this._badOS = false;
             this._badDesktopOS = false;
+            /**
+             * Gets or sets a value indicating if we want to disable texture binding optmization.
+             * This could be required on some buggy drivers which wants to have textures bound in a progressive order
+             * By default Babylon.js will try to let textures bound and only update the samplers to point where the texture is.
+             */
+            this.disableTextureBindingOptimization = false;
             this.onVRDisplayChangedObservable = new BABYLON.Observable();
             this.onVRRequestPresentComplete = new BABYLON.Observable();
             this.onVRRequestPresentStart = new BABYLON.Observable();
@@ -8995,6 +9001,7 @@ var BABYLON;
             this._vaoRecordInProgress = false;
             this._mustWipeVertexAttributes = false;
             this._nextFreeTextureSlots = new Array();
+            this._maxSimultaneousTextures = 0;
             this._activeRequests = new Array();
             // Hardware supported Compressed Textures
             this._texturesSupported = new Array();
@@ -9070,6 +9077,9 @@ var BABYLON;
                                     case "uniformBuffer":
                                         this.disableUniformBuffers = true;
                                         break;
+                                    case "textureBindingOptimization":
+                                        this.disableTextureBindingOptimization = true;
+                                        break;
                                 }
                             }
                             break;
@@ -9850,7 +9860,8 @@ var BABYLON;
             this.setDepthFunctionToLessOrEqual();
             this.setDepthWrite(true);
             // Texture maps
-            for (var slot = 0; slot < this._caps.maxCombinedTexturesImageUnits; slot++) {
+            this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;
+            for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {
                 this._nextFreeTextureSlots.push(slot);
             }
         };
@@ -9890,7 +9901,7 @@ var BABYLON;
                 this._boundTexturesCache[key] = null;
             }
             this._nextFreeTextureSlots = [];
-            for (var slot = 0; slot < this._caps.maxCombinedTexturesImageUnits; slot++) {
+            for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {
                 this._nextFreeTextureSlots.push(slot);
             }
             this._activeChannel = -1;
@@ -12743,7 +12754,7 @@ var BABYLON;
             this._bindTexture(channel, postProcess ? postProcess._textures.data[postProcess._currentRenderTextureInd] : null);
         };
         Engine.prototype.unbindAllTextures = function () {
-            for (var channel = 0; channel < this._caps.maxCombinedTexturesImageUnits; channel++) {
+            for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {
                 this._activateTextureChannel(channel);
                 this._bindTextureDirectly(this._gl.TEXTURE_2D, null);
                 this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);
@@ -12766,18 +12777,28 @@ var BABYLON;
                 return -1;
             }
             internalTexture._initialSlot = channel;
-            if (channel !== internalTexture._designatedSlot) {
-                if (internalTexture._designatedSlot > -1) {
-                    return internalTexture._designatedSlot;
-                }
-                else {
-                    // No slot for this texture, let's pick a new one (if we find a free slot)
-                    if (this._nextFreeTextureSlots.length) {
-                        return this._nextFreeTextureSlots[0];
+            if (this.disableTextureBindingOptimization) {
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) {
+                        this._removeDesignatedSlot(internalTexture);
                     }
-                    // We need to recycle the oldest bound texture, sorry.
                     this._textureCollisions.addCount(1, false);
-                    return this._removeDesignatedSlot(this._boundTexturesStack[0]);
+                }
+            }
+            else {
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) {
+                        return internalTexture._designatedSlot;
+                    }
+                    else {
+                        // No slot for this texture, let's pick a new one (if we find a free slot)
+                        if (this._nextFreeTextureSlots.length) {
+                            return this._nextFreeTextureSlots[0];
+                        }
+                        // We need to recycle the oldest bound texture, sorry.
+                        this._textureCollisions.addCount(1, false);
+                        return this._removeDesignatedSlot(this._boundTexturesStack[0]);
+                    }
                 }
             }
             return channel;
@@ -13551,7 +13572,8 @@ var BABYLON;
         /** Use this array to turn off some WebGL2 features on known buggy browsers version */
         Engine.ExceptionList = [
             { key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] },
-            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }
+            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
+            { key: "Macintosh", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] },
         ];
         Engine.Instances = new Array();
         // Const statics

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 44 - 44
dist/preview release/viewer/babylon.viewer.js


+ 35 - 23
src/Engine/babylon.engine.ts

@@ -281,7 +281,8 @@
         /** Use this array to turn off some WebGL2 features on known buggy browsers version */
         public static ExceptionList = [
             { key: "Chrome/63.0", capture: "63\\.0\\.3239\\.(\\d+)", captureConstraint: 108, targets: ["uniformBuffer"] },
-            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] }
+            { key: "Firefox/58", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
+            { key: "Macintosh", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] },
         ];
 
         public static Instances = new Array<Engine>();
@@ -646,8 +647,14 @@
             return this._badDesktopOS;
         }
 
-        public static audioEngine: AudioEngine;
+        /**
+         * Gets or sets a value indicating if we want to disable texture binding optmization.
+         * This could be required on some buggy drivers which wants to have textures bound in a progressive order
+         * By default Babylon.js will try to let textures bound and only update the samplers to point where the texture is.
+         */
+        public disableTextureBindingOptimization = false;
 
+        public static audioEngine: AudioEngine;       
 
         // Focus
         private _onFocus: () => void;
@@ -886,6 +893,9 @@
                                     case "uniformBuffer":
                                         this.disableUniformBuffers = true;
                                         break;
+                                    case "textureBindingOptimization":
+                                        this.disableTextureBindingOptimization = true;    
+                                        break;    
                                 }
                             }
                             break;
@@ -4847,28 +4857,30 @@
 
             internalTexture._initialSlot = channel;
 
-            if (channel !== internalTexture._designatedSlot) {
-                if (internalTexture._designatedSlot > -1) { // Texture is already assigned to a slot
-                    this._removeDesignatedSlot(internalTexture);
-                }
+            if (this.disableTextureBindingOptimization) { // We want texture sampler ID == texture channel
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) { // Texture is already assigned to a slot
+                        this._removeDesignatedSlot(internalTexture);
+                    }
                 
-                this._textureCollisions.addCount(1, false);
-            }
-           
-            // if (channel !== internalTexture._designatedSlot) {
-            //     if (internalTexture._designatedSlot > -1) { // Texture is already assigned to a slot
-            //         return internalTexture._designatedSlot;
-            //     } else {
-            //         // No slot for this texture, let's pick a new one (if we find a free slot)
-            //         if (this._nextFreeTextureSlots.length) {
-            //             return this._nextFreeTextureSlots[0];
-            //         }
-
-            //         // We need to recycle the oldest bound texture, sorry.
-            //         this._textureCollisions.addCount(1, false);
-            //         return this._removeDesignatedSlot(this._boundTexturesStack[0]);
-            //     }
-            // }
+                    this._textureCollisions.addCount(1, false);
+                }
+            } else {          
+                if (channel !== internalTexture._designatedSlot) {
+                    if (internalTexture._designatedSlot > -1) { // Texture is already assigned to a slot
+                        return internalTexture._designatedSlot;
+                    } else {
+                        // No slot for this texture, let's pick a new one (if we find a free slot)
+                        if (this._nextFreeTextureSlots.length) {
+                            return this._nextFreeTextureSlots[0];
+                        }
+
+                        // We need to recycle the oldest bound texture, sorry.
+                        this._textureCollisions.addCount(1, false);
+                        return this._removeDesignatedSlot(this._boundTexturesStack[0]);
+                    }
+                }
+            }    
 
             return channel;
         }