2001-05-22 06:00:38 +00:00
|
|
|
/*
|
|
|
|
r_graph.c
|
|
|
|
|
|
|
|
rednerer diagnostic graphs
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2021-07-11 01:59:27 +00:00
|
|
|
#include <string.h>
|
2001-05-22 06:00:38 +00:00
|
|
|
|
2021-07-11 01:59:27 +00:00
|
|
|
#include "QF/cvar.h"
|
2001-05-22 06:00:38 +00:00
|
|
|
#include "QF/draw.h"
|
|
|
|
#include "QF/render.h"
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "QF/plugin.h"
|
2001-05-22 06:00:38 +00:00
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2022-03-15 06:42:43 +00:00
|
|
|
#include "QF/ui/view.h"
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2001-05-22 06:00:38 +00:00
|
|
|
|
|
|
|
|
2022-12-02 01:52:16 +00:00
|
|
|
#define MAX_TIMINGS 200
|
2001-05-22 06:00:38 +00:00
|
|
|
int graphval;
|
|
|
|
|
2001-08-26 16:54:33 +00:00
|
|
|
|
2001-05-22 06:00:38 +00:00
|
|
|
/*
|
|
|
|
R_TimeGraph
|
|
|
|
|
|
|
|
Performance monitoring tool
|
|
|
|
*/
|
|
|
|
void
|
2022-11-10 12:23:04 +00:00
|
|
|
R_TimeGraph (view_pos_t abs, view_pos_t len)
|
2001-05-22 06:00:38 +00:00
|
|
|
{
|
|
|
|
static int timex;
|
|
|
|
int a;
|
|
|
|
int l;
|
2022-03-15 06:42:43 +00:00
|
|
|
double r_time2;
|
2021-07-11 01:59:27 +00:00
|
|
|
static int r_timings[MAX_TIMINGS];
|
|
|
|
int timings[MAX_TIMINGS];
|
2022-03-15 06:42:43 +00:00
|
|
|
int o;
|
2001-05-22 06:00:38 +00:00
|
|
|
|
2022-03-15 06:42:43 +00:00
|
|
|
r_time2 = Sys_DoubleTime ();
|
2001-05-22 06:00:38 +00:00
|
|
|
|
2022-03-15 06:42:43 +00:00
|
|
|
r_timings[timex] = (r_time2 - r_time1) * 10000;
|
|
|
|
//printf ("%d %g\n", r_timings[timex], r_time2 - r_time1);
|
2001-05-22 06:00:38 +00:00
|
|
|
|
|
|
|
l = MAX_TIMINGS;
|
|
|
|
if (l > r_refdef.vrect.width)
|
|
|
|
l = r_refdef.vrect.width;
|
2021-07-11 01:59:27 +00:00
|
|
|
o = 0;
|
2001-05-22 06:00:38 +00:00
|
|
|
a = timex - l;
|
|
|
|
if (a < 0) {
|
2021-07-11 01:59:27 +00:00
|
|
|
memcpy (timings + o, r_timings + a + MAX_TIMINGS,
|
|
|
|
-a * sizeof (timings[0]));
|
|
|
|
o -= a;
|
2001-05-22 06:00:38 +00:00
|
|
|
l += a;
|
|
|
|
a = 0;
|
|
|
|
}
|
2021-07-11 01:59:27 +00:00
|
|
|
memcpy (timings + o, r_timings + a, l * sizeof (timings[0]));
|
2022-10-31 15:40:52 +00:00
|
|
|
r_funcs->R_LineGraph (abs.x, abs.y, r_timings, MAX_TIMINGS, 200);
|
2022-12-02 01:52:16 +00:00
|
|
|
r_funcs->Draw_Line (abs.x, abs.y, abs.x + MAX_TIMINGS, abs.y, 0x0f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 10, abs.x + MAX_TIMINGS, abs.y - 10, 0x3f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 20, abs.x + MAX_TIMINGS, abs.y - 20, 0x3f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 25, abs.x + MAX_TIMINGS, abs.y - 25, 0x3f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 33, abs.x + MAX_TIMINGS, abs.y - 33, 0x3f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 50, abs.x + MAX_TIMINGS, abs.y - 50, 0x3f);
|
|
|
|
r_funcs->Draw_Line (abs.x, abs.y - 100, abs.x + MAX_TIMINGS, abs.y - 100, 0x3f);
|
2022-10-31 15:40:52 +00:00
|
|
|
//r_data->graphheight->int_val);
|
2001-05-22 06:00:38 +00:00
|
|
|
|
|
|
|
timex = (timex + 1) % MAX_TIMINGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-11-10 12:23:04 +00:00
|
|
|
R_ZGraph (view_pos_t abs, view_pos_t len)
|
2001-05-22 06:00:38 +00:00
|
|
|
{
|
2022-03-15 06:42:43 +00:00
|
|
|
int w;
|
2001-05-22 06:00:38 +00:00
|
|
|
static int height[256];
|
|
|
|
|
|
|
|
if (r_refdef.vrect.width <= 256)
|
|
|
|
w = r_refdef.vrect.width;
|
|
|
|
else
|
|
|
|
w = 256;
|
|
|
|
|
[renderer] Clean up use of vup/vright/vpn
This moves the common camera setup code out of the individual drivers,
and completely removes vup/vright/vpn from the non-software renderers.
This has highlighted the craziness around AngleVectors with it putting
+X forward, -Y right and +Z up. The main issue with this is it requires
a 90 degree pre-rotation about the Z axis to get the camera pointing in
the right direction, and that's for the native sw renderer (vulkan needs
a 90 degree pre-rotation about X, and gl and glsl need to invert an
axis, too), though at least it's just a matrix swizzle and vector
negation. However, it does mean the camera matrices can't be used
directly.
Also rename vpn to vfwd (still abbreviated, but fwd is much clearer in
meaning (to me, at least) than pn (plane normal, I guess, but which
way?)).
2022-03-14 00:34:24 +00:00
|
|
|
height[r_framecount & 255] = ((int) r_refdef.frame.position[2]) & 31;
|
2001-05-22 06:00:38 +00:00
|
|
|
|
2022-10-31 15:40:52 +00:00
|
|
|
r_funcs->R_LineGraph (abs.x, abs.y, height, w, *r_data->graphheight);
|
2001-05-22 06:00:38 +00:00
|
|
|
}
|