@@ -1271,6 +1271,7 @@ this.createjs = this.createjs||{};
12711271 if ( ! gl ) { return null ; }
12721272
12731273 gl . disable ( gl . DEPTH_TEST ) ;
1274+ gl . depthMask ( false ) ;
12741275 gl . enable ( gl . BLEND ) ;
12751276 gl . pixelStorei ( gl . UNPACK_FLIP_Y_WEBGL , true ) ;
12761277 gl . clearColor ( 0.0 , 0.0 , 0.0 , 0 ) ;
@@ -1416,7 +1417,7 @@ this.createjs = this.createjs||{};
14161417 var backupWidth = this . _viewportWidth , backupHeight = this . _viewportHeight ;
14171418 this . updateViewport ( manager . _drawWidth , manager . _drawHeight ) ;
14181419
1419- var out = this . _batchTextureOutput = ( manager . _filterCount % 2 ) ? manager . _bufferTextureConcat : manager . _bufferTextureOutput ;
1420+ this . _batchTextureOutput = ( manager . _filterCount % 2 ) ? manager . _bufferTextureConcat : manager . _bufferTextureOutput ;
14201421 this . _batchTextureConcat = ( manager . _filterCount % 2 ) ? manager . _bufferTextureOutput : manager . _bufferTextureConcat ;
14211422 this . _batchTextureTemp = manager . _bufferTextureTemp ;
14221423
@@ -1428,7 +1429,7 @@ this.createjs = this.createjs||{};
14281429 this . _drawContent ( container , true ) ;
14291430
14301431 // re-align buffers with fake filter passes to solve certain error cases
1431- if ( out !== ( ( manager . _filterCount % 2 ) ? this . _batchTextureConcat : this . _batchTextureOutput ) ) {
1432+ if ( manager . _cacheCanvas !== ( ( manager . _filterCount % 2 ) ? this . _batchTextureConcat : this . _batchTextureOutput ) ) {
14321433 // pre filter pass to align output, may of become misaligned due to composite operations
14331434 filtersLeft ++ ;
14341435 }
@@ -1951,10 +1952,10 @@ this.createjs = this.createjs||{};
19511952 for ( var i = 0 ; i < this . _gpuTextureCount ; i ++ ) {
19521953 samplers [ i ] = i ;
19531954 }
1954-
19551955 shaderProgram . samplerData = samplers ;
1956+
19561957 shaderProgram . samplerUniform = gl . getUniformLocation ( shaderProgram , "uSampler" ) ;
1957- gl . uniform1iv ( shaderProgram . samplerUniform , samplers ) ;
1958+ gl . uniform1iv ( shaderProgram . samplerUniform , shaderProgram . samplerData ) ;
19581959
19591960 shaderProgram . pMatrixUniform = gl . getUniformLocation ( shaderProgram , "pMatrix" ) ;
19601961 }
@@ -2270,9 +2271,10 @@ this.createjs = this.createjs||{};
22702271 if ( image && ( ( image . _invalid === undefined && image . _isCanvas ) || image . _invalid ) ) {
22712272 this . _updateTextureImageData ( gl , image ) ;
22722273 } else {
2273- gl . activeTexture ( gl . TEXTURE0 + found ) ;
2274- gl . bindTexture ( gl . TEXTURE_2D , texture ) ;
2275- this . setTextureParams ( gl ) ;
2274+ // probably redundant, confirm functionality then remove from codebase
2275+ //gl.activeTexture(gl.TEXTURE0 + found);
2276+ //gl.bindTexture(gl.TEXTURE_2D, texture);
2277+ //this.setTextureParams(gl);
22762278 }
22772279 this . _lastTextureInsert = found ;
22782280
@@ -2537,7 +2539,7 @@ this.createjs = this.createjs||{};
25372539 item . _updateState ( ) ;
25382540 }
25392541
2540- if ( ! ignoreCache && item . filters !== null && item . filters . length ) {
2542+ if ( ! ignoreCache && item . cacheCanvas === null && item . filters !== null && item . filters . length ) {
25412543 var bounds ;
25422544 if ( item . bitmapCache === null ) {
25432545 bounds = item . getBounds ( ) ;
@@ -2547,9 +2549,14 @@ this.createjs = this.createjs||{};
25472549 if ( item . bitmapCache . _autoGenerated ) {
25482550 this . batchReason = "cachelessFilterInterupt" ;
25492551 this . _renderBatch ( ) ; // <----------------------------------------------------
2552+
2553+ var shaderBackup = this . _activeShader ;
25502554 bounds = bounds || item . getBounds ( ) ;
25512555 item . bitmapCache . define ( item , bounds . x , bounds . y , bounds . width , bounds . height , 1 , { useGL :this } ) ;
25522556 useCache = item . bitmapCache . _cacheCanvas ;
2557+
2558+ this . _activeShader = shaderBackup ;
2559+ gl . bindFramebuffer ( gl . FRAMEBUFFER , this . _batchTextureOutput . _frameBuffer ) ;
25532560 }
25542561 }
25552562 }
@@ -2702,7 +2709,7 @@ this.createjs = this.createjs||{};
27022709 this . _batchVertexCount += StageGL . INDICIES_PER_CARD ;
27032710
27042711 if ( this . _immediateRender ) {
2705- this . _immediateBatchRender ( gl ) ;
2712+ this . _immediateBatchRender ( ) ;
27062713 }
27072714 }
27082715
@@ -2713,9 +2720,12 @@ this.createjs = this.createjs||{};
27132720
27142721 /**
27152722 * The shader or effect needs to be drawn immediately, sub function of `_appendToBatch`
2723+ * @method _immediateBatchRender
27162724 * @protected
27172725 */
2718- p . _immediateBatchRender = function ( gl ) {
2726+ p . _immediateBatchRender = function ( ) {
2727+ var gl = this . _webGLContext ;
2728+
27192729 if ( this . _batchTextureConcat === null ) {
27202730 this . _batchTextureConcat = this . getRenderBufferTexture ( this . _viewportWidth , this . _viewportHeight ) ;
27212731 } else {
@@ -2737,10 +2747,10 @@ this.createjs = this.createjs||{};
27372747 this . _batchTextureConcat = swap ;
27382748
27392749 this . _activeShader = this . _mainShader ;
2740- this . batchReason = "immediateBuffer " ;
2750+ this . batchReason = "immediatePrep " ;
27412751 this . _renderBatch ( ) ; //<-----------------------------------------------------------------------------------------
27422752
2743- this . batchReason = "immediateDraw " ;
2753+ this . batchReason = "immediateResults " ;
27442754 this . _drawCover ( this . _batchTextureOutput . _frameBuffer , this . _batchTextureConcat , this . _batchTextureTemp ) ;
27452755
27462756 gl . bindFramebuffer ( gl . FRAMEBUFFER , this . _batchTextureOutput . _frameBuffer ) ;
@@ -2756,7 +2766,7 @@ this.createjs = this.createjs||{};
27562766 var gl = this . _webGLContext ;
27572767
27582768 if ( this . vocalDebug ) {
2759- console . log ( "Draw [" + this . _drawID + ":" + this . _batchID + "] : " + this . batchReason ) ;
2769+ console . log ( "Batch [" + this . _drawID + ":" + this . _batchID + "] : " + this . batchReason ) ;
27602770 }
27612771 var shaderProgram = this . _activeShader ;
27622772 var vertexPositionBuffer = this . _vertexPositionBuffer ;
@@ -2824,7 +2834,7 @@ this.createjs = this.createjs||{};
28242834 gl . uniform1i ( shaderProgram . samplerUniform , 0 ) ;
28252835
28262836 gl . drawArrays ( gl . TRIANGLES , 0 , StageGL . INDICIES_PER_CARD ) ;
2827- this . _batchID ++ ;
2837+ this . _batchID ++ ; // while this isn't a batch, this fixes issues with expected textures in expected places
28282838 } ;
28292839
28302840 createjs . StageGL = createjs . promote ( StageGL , "Stage" ) ;
0 commit comments