@@ -534,6 +534,15 @@ this.createjs = this.createjs||{};
534534 */
535535 this . _drawID = 0 ;
536536
537+ /**
538+ * Tracks how many renders have occurred this draw, used for performance monitoring and empty draw avoidance.
539+ * @property _renderPerDraw
540+ * @protected
541+ * @type {Number }
542+ * @default 0
543+ */
544+ this . _renderPerDraw = 0 ;
545+
537546 /**
538547 * Used to prevent textures in certain GPU slots from being replaced by an insert.
539548 * @property _slotBlackList
@@ -1397,6 +1406,7 @@ this.createjs = this.createjs||{};
13971406 var storeBatchTemp = this . _batchTextureTemp ;
13981407
13991408 // Use WebGL
1409+ this . _renderPerDraw = 0 ;
14001410 this . _batchVertexCount = 0 ;
14011411 this . _drawID ++ ;
14021412
@@ -1415,7 +1425,9 @@ this.createjs = this.createjs||{};
14151425 if ( ! this . _directDraw ) {
14161426 if ( this . autoClear ) { this . clear ( ) ; }
14171427 this . batchReason = "finalOutput" ;
1418- this . _drawCover ( null , this . _batchTextureOutput ) ;
1428+ if ( this . _renderPerDraw ) {
1429+ this . _drawCover ( null , this . _batchTextureOutput ) ;
1430+ }
14191431 }
14201432
14211433 // batches may generate or swap around textures. To be sure we capture them, store them back into buffer
@@ -2860,6 +2872,7 @@ this.createjs = this.createjs||{};
28602872 p . _renderBatch = function ( ) {
28612873 if ( this . _batchVertexCount <= 0 ) { return ; } // prevents error logs on stages filled with un-renederable content.
28622874 var gl = this . _webGLContext ;
2875+ this . _renderPerDraw ++ ;
28632876
28642877 if ( this . vocalDebug ) {
28652878 console . log ( "Batch[" + this . _drawID + ":" + this . _batchID + "] : " + this . batchReason ) ;
@@ -2908,6 +2921,7 @@ this.createjs = this.createjs||{};
29082921 */
29092922 p . _renderCover = function ( ) {
29102923 var gl = this . _webGLContext ;
2924+ this . _renderPerDraw ++ ;
29112925
29122926 if ( this . vocalDebug ) {
29132927 console . log ( "Cover[" + this . _drawID + ":" + this . _batchID + "] : " + this . batchReason ) ;
0 commit comments