@@ -342,57 +342,37 @@ var UtilityPipeline = new Class({
342342 } ,
343343
344344 /**
345- * Binds this pipeline and draws the `source` Render Target to the `target` Render Target.
345+ * Pops the framebuffer from the renderers FBO stack and sets that as the active target,
346+ * then draws the `source` Render Target to it. It then resets the renderer textures.
346347 *
347- * If no `target` is specified, it will pop the framebuffer from the Renderers FBO stack
348- * and use that instead, which should be done when you need to draw the final results of
349- * this pipeline to the game canvas.
348+ * This should be done when you need to draw the _final_ results of a pipeline to the game
349+ * canvas, or the next framebuffer in line on the FBO stack. You should only call this once
350+ * in the `onDraw` handler and it should be the final thing called. Be careful not to call
351+ * this if you need to actually use the pipeline shader, instead of the copy shader. In
352+ * those cases, use the `bindAndDraw` method.
350353 *
351- * You can optionally set the shader to be used for the draw here, if this is a multi-shader
352- * pipeline. By default `currentShader` will be used. If you need to set a shader but not
353- * a target, just pass `null` as the `target` parameter.
354- *
355- * @method Phaser.Renderer.WebGL.Pipelines.PostFXPipeline#bindAndDraw
354+ * @method Phaser.Renderer.WebGL.Pipelines.UtilityPipeline#copyToGame
356355 * @since 3.50.0
357356 *
358357 * @param {Phaser.Renderer.WebGL.RenderTarget } source - The Render Target to draw from.
359- * @param {Phaser.Renderer.WebGL.RenderTarget } [target] - The Render Target to draw to. If not set, it will pop the fbo from the stack.
360- * @param {Phaser.Renderer.WebGL.WebGLShader } [currentShader] - The shader to use during the draw.
361- bindAndDraw: function (source, target)
358+ */
359+ copyToGame : function ( source )
362360 {
363361 var gl = this . gl ;
364362
365- this.bind(currentShader);
363+ this . set1i ( 'uMainSampler' , 0 , this . copyShader ) ;
364+ this . set1f ( 'uBrightness' , 1 , this . copyShader ) ;
366365
367- this.set1i('uMainSampler', 0);
368-
369- if (target)
370- {
371- gl.viewport(0, 0, target.width, target.height);
372- gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer);
373- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0);
374- }
375- else
376- {
377- this.renderer.popFramebuffer();
378- }
366+ this . renderer . popFramebuffer ( ) ;
379367
380368 gl . activeTexture ( gl . TEXTURE0 ) ;
381369 gl . bindTexture ( gl . TEXTURE_2D , source . texture ) ;
382370
383371 gl . bufferData ( gl . ARRAY_BUFFER , this . vertexData , gl . STATIC_DRAW ) ;
384372 gl . drawArrays ( gl . TRIANGLES , 0 , 6 ) ;
385373
386- if (!target)
387- {
388- this.renderer.resetTextures();
389- }
390- else
391- {
392- gl.bindTexture(gl.TEXTURE_2D, null);
393- }
374+ this . renderer . resetTextures ( ) ;
394375 } ,
395- */
396376
397377 /**
398378 * Copy the `source` Render Target to the `target` Render Target, using the
0 commit comments