return triangles;
}
+extern cvar_t r_viewscale;
+extern float viewscalefpsadjusted;
void R_TimeReport_EndFrame(void)
{
int i, j, lines, y;
loc = CL_Locs_FindNearest(cl.movement_origin);
viewleaf = (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->brush.PointInLeaf) ? r_refdef.scene.worldmodel->brush.PointInLeaf(r_refdef.scene.worldmodel, r_refdef.view.origin) : NULL;
dpsnprintf(string, sizeof(string),
-"%s%s\n"
+"%6.0fus rendertime %3.0f%% viewscale %s%s\n"
"%3i renders org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n"
"%5i viewleaf%5i cluster%2i area%4i brushes%4i surfaces(%7i triangles)\n"
"%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n"
"%6i draws%8i vertices%8i triangles bloompixels%8i copied%8i drawn\n"
"updated%5i indexbuffers%8i bytes%5i vertexbuffers%8i bytes\n"
"%s"
-, loc ? "Location: " : "", loc ? loc->name : ""
+, r_refdef.lastdrawscreentime * 1000000.0, r_viewscale.value * sqrt(viewscalefpsadjusted) * 100.0f, loc ? "Location: " : "", loc ? loc->name : ""
, r_refdef.stats.renders, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], r_refdef.view.forward[0], r_refdef.view.forward[1], r_refdef.view.forward[2]
, viewleaf ? (int)(viewleaf - r_refdef.scene.worldmodel->brush.data_leafs) : -1, viewleaf ? viewleaf->clusterindex : -1, viewleaf ? viewleaf->areaindex : -1, viewleaf ? viewleaf->numleafbrushes : 0, viewleaf ? viewleaf->numleafsurfaces : 0, viewleaf ? R_CountLeafTriangles(r_refdef.scene.worldmodel, viewleaf) : 0
, r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles
extern cvar_t cl_minfps_qualitymin;
extern cvar_t cl_minfps_qualitypower;
extern cvar_t cl_minfps_qualityscale;
+extern cvar_t r_viewscale_fpsscaling;
static double cl_updatescreen_rendertime = 0;
static double cl_updatescreen_quality = 1;
extern void Sbar_ShowFPS_Update(void);
{
vec3_t vieworigin;
double rendertime1;
+ double drawscreenstart;
float conwidth, conheight;
float f;
r_viewport_t viewport;
}
}
+ if (r_viewscale_fpsscaling.integer && qglFinish)
+ qglFinish();
+ drawscreenstart = Sys_DoubleTime();
if (R_Stereo_Active())
{
r_stereo_side = 0;
}
else
SCR_DrawScreen();
+ if (r_viewscale_fpsscaling.integer && qglFinish)
+ qglFinish();
+ r_refdef.lastdrawscreentime = Sys_DoubleTime() - drawscreenstart;
SCR_CaptureVideo();
R_View_UpdateEntityLighting();
}
-static float viewscalefpsadjusted = 1.0f;
+float viewscalefpsadjusted = 1.0f;
void R_GetScaledViewSize(int width, int height, int *outwidth, int *outheight)
{
if (r_viewscale_fpsscaling.integer)
{
- static double lastrealtime;
double actualframetime;
double targetframetime;
double adjust;
- actualframetime = realtime - lastrealtime;
+ actualframetime = r_refdef.lastdrawscreentime;
targetframetime = (1.0 / r_viewscale_fpsscaling_target.value);
adjust = (targetframetime - actualframetime) * r_viewscale_fpsscaling_multiply.value;
adjust = bound(-r_viewscale_fpsscaling_stepmax.value, adjust, r_viewscale_fpsscaling_stepmax.value);
if (r_viewscale_fpsscaling_stepsize.value > 0)
adjust = (int)(adjust / r_viewscale_fpsscaling_stepsize.value) * r_viewscale_fpsscaling_stepsize.value;
viewscalefpsadjusted += adjust;
- lastrealtime = realtime;
viewscalefpsadjusted = bound(r_viewscale_fpsscaling_min.value, viewscalefpsadjusted, 1.0f);
}
else