ソースを参照

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 6 年 前
コミット
7399e7d43f

+ 3 - 0
src/Engines/IPipelineContext.ts

@@ -11,4 +11,7 @@ export interface IPipelineContext {
      * Gets a boolean indicating that the context is ready to be used (like shaders / pipelines are compiled and ready for instance)
      */
     isReady: boolean;
+
+    /** @hidden */
+    _handlesSpectorRebuildCallback(onCompiled: (compiledObject: any) => void): void;
 }

+ 6 - 0
src/Engines/WebGL/webGLPipelineContext.ts

@@ -27,4 +27,10 @@ export class WebGLPipelineContext implements IPipelineContext {
 
         return false;
     }
+
+    public _handlesSpectorRebuildCallback(onCompiled: (program: WebGLProgram) => void): void {
+        if (onCompiled && this.program) {
+            onCompiled(this.program);
+        }
+    }
 }

+ 2 - 6
src/Materials/effect.ts

@@ -793,9 +793,7 @@ export class Effect implements IDisposable {
                 scenes[i].markAllMaterialsAsDirty(Constants.MATERIAL_AllDirtyFlag);
             }
 
-            if (onCompiled) {
-                onCompiled(this._pipelineContext);
-            }
+            this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);
         };
         this._fallbacks = null;
         this._prepareEffect();
@@ -816,9 +814,7 @@ export class Effect implements IDisposable {
         try {
             let engine = this._engine;
 
-            if (!this._pipelineContext) {
-                this._pipelineContext = engine.createPipelineContext();
-            }
+            this._pipelineContext = engine.createPipelineContext();
 
             let rebuildRebind = this._rebuildProgram.bind(this);
             if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {