File tree Expand file tree Collapse file tree 4 files changed +10
-2
lines changed
Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ export interface PhysicsStatistics {
148148export interface GraphicsStatistics {
149149 drawCalls : number ;
150150 drawnImages : number ;
151+ rendererSwaps : number ;
151152}
152153
153154/**
@@ -424,7 +425,8 @@ export class FrameStats implements FrameStatistics {
424425
425426 private _graphicsStats : GraphicsStatistics = {
426427 drawCalls : 0 ,
427- drawnImages : 0
428+ drawnImages : 0 ,
429+ rendererSwaps : 0
428430 } ;
429431
430432 /**
@@ -444,12 +446,13 @@ export class FrameStats implements FrameStatistics {
444446 this . _physicsStats . reset ( otherStats . physics ) ;
445447 this . graphics . drawCalls = otherStats . graphics . drawCalls ;
446448 this . graphics . drawnImages = otherStats . graphics . drawnImages ;
449+ this . graphics . rendererSwaps = otherStats . graphics . rendererSwaps ;
447450 } else {
448451 this . id = this . elapsedMs = this . fps = 0 ;
449452 this . actors . alive = this . actors . killed = this . actors . ui = 0 ;
450453 this . duration . update = this . duration . draw = 0 ;
451454 this . _physicsStats . reset ( ) ;
452- this . graphics . drawnImages = this . graphics . drawCalls = 0 ;
455+ this . graphics . drawnImages = this . graphics . drawCalls = this . graphics . rendererSwaps = 0 ;
453456 }
454457 }
455458
Original file line number Diff line number Diff line change @@ -1801,6 +1801,7 @@ O|===|* >________________>\n\
18011801 this . stats . currFrame . duration . draw = afterDraw - afterUpdate ;
18021802 this . stats . currFrame . graphics . drawnImages = GraphicsDiagnostics . DrawnImagesCount ;
18031803 this . stats . currFrame . graphics . drawCalls = GraphicsDiagnostics . DrawCallCount ;
1804+ this . stats . currFrame . graphics . rendererSwaps = GraphicsDiagnostics . RendererSwaps ;
18041805
18051806 this . emit ( 'postframe' , new PostFrameEvent ( this , this . stats . currFrame ) ) ;
18061807 this . stats . prevFrame . reset ( this . stats . currFrame ) ;
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ import { ParticleRenderer } from './particle-renderer/particle-renderer';
4343import { ImageRendererV2 } from './image-renderer-v2/image-renderer-v2' ;
4444import { Flags } from '../../Flags' ;
4545import { Debug } from '../Debug' ;
46+ import { GraphicsDiagnostics } from '../GraphicsDiagnostics' ;
4647
4748export const pixelSnapEpsilon = 0.0001 ;
4849
@@ -804,6 +805,7 @@ export class ExcaliburGraphicsContextWebGL implements ExcaliburGraphicsContext {
804805 currentRenderer ! . flush ( ) ;
805806 currentRendererName = this . _drawCalls [ i ] . renderer ;
806807 currentRenderer = this . get ( currentRendererName ) ;
808+ GraphicsDiagnostics . RendererSwaps ++ ;
807809 }
808810
809811 // ! hack to grab screen texture before materials run because they might want it
Original file line number Diff line number Diff line change 11export class GraphicsDiagnostics {
22 public static DrawCallCount : number = 0 ;
33 public static DrawnImagesCount : number = 0 ;
4+ public static RendererSwaps : number = 0 ;
45 public static clear ( ) : void {
56 GraphicsDiagnostics . DrawCallCount = 0 ;
67 GraphicsDiagnostics . DrawnImagesCount = 0 ;
8+ GraphicsDiagnostics . RendererSwaps = 0 ;
79 }
810}
You can’t perform that action at this time.
0 commit comments