This patch adds a render stats overlay, toggled by cvar
renderstats. A new function
I_GetTimeMicros is added for getting microsecond timestamps and is used by render stats.
The overlay shows the time taken by the main rendering code parts in microseconds or in milliseconds if rendering takes more than 10 ms. Also there are counters of various on-screen objects. This feature could be used to inspect game performance details in various maps and situations and compare performance between renderers/versions/configurations/hardware etc. I have been using this feature while working on OpenGL improvements.
Screenshot in OpenGL mode.
Screenshot in Software mode.
FT: Frame time. Time between each frame rendered.
RTOT: Total time spent in (HW)R_RenderPlayerView.
BSP: Time spent in (HW)R_RenderBSPNode.
NSRT (OpenGL): Drawnode sorting.
NDRW (OpenGL): Drawnode rendering.
SSRT (OpenGL): Sprite sorting.
SDRW (OpenGL): Sprite rendering.
PRTL (Software): Portal rendering, including skybox.
PLNS (Software): R_DrawPlanes.
MSKD (Software): R_DrawMasked.
NBSP: Number of (HW)R_RenderBSPNode calls.
NSPR: Number of sprites.
NNOD: Number of drawnodes. (drawnodes mean slightly different things in OpenGL and Software modes)
NPOB: Number of polyobjects.
Note: In OpenGL mode the timings can become misleading because OpenGL can sometimes postpone the execution of rendering calls. For example, draw calls from HWR_RenderBSPNode can be postponed to occur inside drawnode or sprite rendering. This might depend on GPU vendor and GPU drivers.