diff --git a/src/d_main.c b/src/d_main.c index 28e134d65..2e1badc69 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -607,17 +607,25 @@ static void D_Display(void) V_DrawThinString(30, 10, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "rtot %d", rs_rendercalltime / divisor); V_DrawThinString(30, 20, V_MONOSPACE | V_YELLOWMAP, s); - if (rendermode == render_opengl)// dont show unimplemented stats + snprintf(s, sizeof s - 1, "bsp %d", rs_bsptime / divisor); + V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, s); + snprintf(s, sizeof s - 1, "nbsp %d", rs_numbspcalls); + V_DrawThinString(80, 10, V_MONOSPACE | V_BLUEMAP, s); + snprintf(s, sizeof s - 1, "nspr %d", rs_numsprites); + V_DrawThinString(80, 20, V_MONOSPACE | V_BLUEMAP, s); + snprintf(s, sizeof s - 1, "nnod %d", rs_numdrawnodes); + V_DrawThinString(80, 30, V_MONOSPACE | V_BLUEMAP, s); + snprintf(s, sizeof s - 1, "npob %d", rs_numpolyobjects); + V_DrawThinString(80, 40, V_MONOSPACE | V_BLUEMAP, s); + if (rendermode == render_opengl) // OpenGL specific stats { - snprintf(s, sizeof s - 1, "bsp %d", rs_bsptime / divisor); - V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "nsrt %d", rs_nodesorttime / divisor); + snprintf(s, sizeof s - 1, "nsrt %d", rs_hw_nodesorttime / divisor); V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "ndrw %d", rs_nodedrawtime / divisor); + snprintf(s, sizeof s - 1, "ndrw %d", rs_hw_nodedrawtime / divisor); V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "ssrt %d", rs_spritesorttime / divisor); + snprintf(s, sizeof s - 1, "ssrt %d", rs_hw_spritesorttime / divisor); V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "sdrw %d", rs_spritedrawtime / divisor); + snprintf(s, sizeof s - 1, "sdrw %d", rs_hw_spritedrawtime / divisor); V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s); /*snprintf(s, sizeof s - 1, "post %d", rs_posttime / divisor); V_DrawThinString(30, 80, V_MONOSPACE | V_YELLOWMAP, s);*/ @@ -626,14 +634,6 @@ static void D_Display(void) /*snprintf(s, sizeof s - 1, "test %d", rs_test / divisor); V_DrawThinString(30, 100, V_MONOSPACE | V_YELLOWMAP, s);*/ - snprintf(s, sizeof s - 1, "nbsp %d", rs_numbspcalls); - V_DrawThinString(80, 10, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "nnod %d", rs_numdrawnodes); - V_DrawThinString(80, 20, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "nspr %d", rs_numsprites); - V_DrawThinString(80, 30, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "npob %d", rs_numpolyobjects); - V_DrawThinString(80, 40, V_MONOSPACE | V_BLUEMAP, s); /* if (cv_enable_batching.value) { @@ -658,10 +658,16 @@ static void D_Display(void) V_DrawThinString(185, 30, V_MONOSPACE | V_PURPLEMAP, s); }*/ } - else + else // software specific stats { + snprintf(s, sizeof s - 1, "prtl %d", rs_sw_portaltime / divisor); + V_DrawThinString(30, 40, V_MONOSPACE | V_YELLOWMAP, s); + snprintf(s, sizeof s - 1, "plns %d", rs_sw_planetime / divisor); + V_DrawThinString(30, 50, V_MONOSPACE | V_YELLOWMAP, s); + snprintf(s, sizeof s - 1, "mskd %d", rs_sw_maskedtime / divisor); + V_DrawThinString(30, 60, V_MONOSPACE | V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "fin %d", rs_swaptime / divisor); - V_DrawThinString(30, 30, V_MONOSPACE | V_YELLOWMAP, s); + V_DrawThinString(30, 70, V_MONOSPACE | V_YELLOWMAP, s); } } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 79cc83bba..bd2c5c9f4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -147,17 +147,10 @@ static angle_t gr_aimingangle; static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox); // Render stats -int rs_bsptime = 0; -int rs_nodetime = 0; -int rs_nodesorttime = 0; -int rs_nodedrawtime = 0; -int rs_spritesorttime = 0; -int rs_spritedrawtime = 0; - -int rs_numdrawnodes = 0; -int rs_numbspcalls = 0; -int rs_numsprites = 0; -int rs_numpolyobjects = 0; +int rs_hw_nodesorttime = 0; +int rs_hw_nodedrawtime = 0; +int rs_hw_spritesorttime = 0; +int rs_hw_spritedrawtime = 0; //int rs_posttime = 0; @@ -4794,7 +4787,7 @@ static void HWR_CreateDrawNodes(void) // If true, swap the draw order. boolean shift = false; - rs_nodesorttime = I_GetTimeMicros(); + rs_hw_nodesorttime = I_GetTimeMicros(); for (i = 0; i < numplanes; i++, p++) { @@ -4917,9 +4910,9 @@ static void HWR_CreateDrawNodes(void) } //i++ } // loop++ - rs_nodesorttime = I_GetTimeMicros() - rs_nodesorttime; + rs_hw_nodesorttime = I_GetTimeMicros() - rs_hw_nodesorttime; - rs_nodedrawtime = I_GetTimeMicros(); + rs_hw_nodedrawtime = I_GetTimeMicros(); // Okay! Let's draw it all! Woo! HWD.pfnSetTransform(&atransform); @@ -4956,7 +4949,7 @@ static void HWR_CreateDrawNodes(void) } } - rs_nodedrawtime = I_GetTimeMicros() - rs_nodedrawtime; + rs_hw_nodedrawtime = I_GetTimeMicros() - rs_hw_nodedrawtime; numwalls = 0; numplanes = 0; @@ -6083,12 +6076,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // Draw MD2 and sprites rs_numsprites = gr_visspritecount; - rs_spritesorttime = I_GetTimeMicros(); + rs_hw_spritesorttime = I_GetTimeMicros(); HWR_SortVisSprites(); - rs_spritesorttime = I_GetTimeMicros() - rs_spritesorttime; - rs_spritedrawtime = I_GetTimeMicros(); + rs_hw_spritesorttime = I_GetTimeMicros() - rs_hw_spritesorttime; + rs_hw_spritedrawtime = I_GetTimeMicros(); HWR_DrawSprites(); - rs_spritedrawtime = I_GetTimeMicros() - rs_spritedrawtime; + rs_hw_spritedrawtime = I_GetTimeMicros() - rs_hw_spritedrawtime; #ifdef NEWCORONAS //Hurdler: they must be drawn before translucent planes, what about gl fog? @@ -6096,8 +6089,8 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) #endif rs_numdrawnodes = 0; - rs_nodesorttime = 0; - rs_nodedrawtime = 0; + rs_hw_nodesorttime = 0; + rs_hw_nodedrawtime = 0; if (numplanes || numpolyplanes || numwalls) //Hurdler: render 3D water and transparent walls after everything { HWR_CreateDrawNodes(); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index f89809cc7..631593d6f 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -105,18 +105,12 @@ extern fixed_t *hwbbox; extern FTransform atransform; -extern int rs_bsptime; -extern int rs_nodetime; -extern int rs_nodesorttime; -extern int rs_nodedrawtime; -extern int rs_spritesorttime; -extern int rs_spritedrawtime; +// Render stats +extern int rs_hw_nodesorttime; +extern int rs_hw_nodedrawtime; +extern int rs_hw_spritesorttime; +extern int rs_hw_spritedrawtime; //extern int rs_posttime; -extern int rs_numdrawnodes; -extern int rs_numbspcalls; -extern int rs_numsprites; -extern int rs_numpolyobjects; - #endif diff --git a/src/r_bsp.c b/src/r_bsp.c index c0011f4b9..355d55bc6 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -812,6 +812,9 @@ static void R_AddPolyObjects(subsector_t *sub) po = (polyobj_t *)(po->link.next); } + // for render stats + rs_numpolyobjects += numpolys; + // sort polyobjects R_SortPolyObjects(sub); @@ -1363,6 +1366,9 @@ void R_RenderBSPNode(INT32 bspnum) { node_t *bsp; INT32 side; + + rs_numbspcalls++; + while (!(bspnum & NF_SUBSECTOR)) // Found a subsector? { bsp = &nodes[bspnum]; diff --git a/src/r_main.c b/src/r_main.c index 17eae9495..4d1be4b14 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -34,6 +34,7 @@ #include "m_random.h" // quake camera shake #include "r_portal.h" #include "r_main.h" +#include "i_system.h" // I_GetTimeMicros #ifdef HWRENDER #include "hardware/hw_main.h" @@ -103,6 +104,17 @@ int rs_prevframetime = 0; int rs_rendercalltime = 0; int rs_swaptime = 0; +int rs_bsptime = 0; + +int rs_sw_portaltime = 0; +int rs_sw_planetime = 0; +int rs_sw_maskedtime = 0; + +int rs_numbspcalls = 0; +int rs_numsprites = 0; +int rs_numdrawnodes = 0; +int rs_numpolyobjects = 0; + static CV_PossibleValue_t drawdist_cons_t[] = { {256, "256"}, {512, "512"}, {768, "768"}, {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, @@ -1452,7 +1464,11 @@ void R_RenderPlayerView(player_t *player) mytotal = 0; ProfZeroTimer(); #endif + rs_numbspcalls = rs_numpolyobjects = rs_numdrawnodes = 0; + rs_bsptime = I_GetTimeMicros(); R_RenderBSPNode((INT32)numnodes - 1); + rs_bsptime = I_GetTimeMicros() - rs_bsptime; + rs_numsprites = visspritecount; #ifdef TIMING RDMSR(0x10, &mycount); mytotal += mycount; // 64bit add @@ -1470,6 +1486,7 @@ void R_RenderPlayerView(player_t *player) Portal_AddSkyboxPortals(); // Portal rendering. Hijacks the BSP traversal. + rs_sw_portaltime = I_GetTimeMicros(); if (portal_base) { portal_t *portal; @@ -1509,15 +1526,20 @@ void R_RenderPlayerView(player_t *player) Portal_Remove(portal); } } + rs_sw_portaltime = I_GetTimeMicros() - rs_sw_portaltime; + rs_sw_planetime = I_GetTimeMicros(); R_DrawPlanes(); #ifdef FLOORSPLATS R_DrawVisibleFloorSplats(); #endif + rs_sw_planetime = I_GetTimeMicros() - rs_sw_planetime; // draw mid texture and sprite // And now 3D floors/sides! + rs_sw_maskedtime = I_GetTimeMicros(); R_DrawMasked(masks, nummasks); + rs_sw_maskedtime = I_GetTimeMicros() - rs_sw_maskedtime; free(masks); } diff --git a/src/r_main.h b/src/r_main.h index 72d340bd9..99a25d86e 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -82,6 +82,17 @@ extern int rs_prevframetime;// time when previous frame was rendered extern int rs_rendercalltime; extern int rs_swaptime; +extern int rs_bsptime; + +extern int rs_sw_portaltime; +extern int rs_sw_planetime; +extern int rs_sw_maskedtime; + +extern int rs_numbspcalls; +extern int rs_numsprites; +extern int rs_numdrawnodes; +extern int rs_numpolyobjects; + // // REFRESH - the actual rendering functions. // diff --git a/src/r_things.c b/src/r_things.c index d2f3b4902..02c347929 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2552,6 +2552,8 @@ static drawnode_t *R_CreateDrawNode(drawnode_t *link) node->thickseg = NULL; node->ffloor = NULL; node->sprite = NULL; + + rs_numdrawnodes++; return node; }