Skip to content

Pipelines are not initialized correctly if added after the game boots #5251

@telinc1

Description

@telinc1

Version

  • Phaser Version: 3.50.0-beta.0 (on commit 6aaf54e)

Description

A custom pipeline added after the game has booted will never have its boot method called. Before the changes in 3.50, almost no pipeline used this method. In the beta, however, the Texture Tint Pipeline, which is commonly used for custom shaders, will break.

Example Test Code

This occurs within the Custom Pipeline example. I've shared a version that works with multi-texturing (as far as I can tell, anyway) in this forum post.

Additional Information

This hack fixes the problem by calling boot in addPipeline if the renderer has already booted:

diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js
index a791ee2ac..7b58409f0 100644
--- a/src/renderer/webgl/WebGLRenderer.js
+++ b/src/renderer/webgl/WebGLRenderer.js
@@ -1031,6 +1031,11 @@ var WebGLRenderer = new Class({
 
         pipelineInstance.name = pipelineName;
 
+        if (this.blankTexture != null)
+        {
+            this.pipelines[pipelineName].boot();
+        }
+
         this.pipelines[pipelineName].resize(this.width, this.height, this.config.resolution);
 
         return pipelineInstance;

Using this.blankTexture for the check is probably far from ideal, which is why I'm not going to open a pull request right now. If there's a better way to work around this (or a better place to put it), I'd gladly help with the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions