Add benchmarkmode cvar which allows putting demo cameras in the map which can be used for automatic benchmarking of performance & correctness testing

git-svn-id: https://svn.eduke32.com/eduke32@7729 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-06-25 18:34:52 +00:00 committed by Christoph Oelckers
parent 87d3af7204
commit 281ee3358b
6 changed files with 25 additions and 1 deletions

View file

@ -1369,6 +1369,8 @@ extern int32_t gltexmaxsize;
void gltexapplyprops (void);
void texcache_invalidate(void);
extern int32_t benchmarkScreenshot;
# ifdef USE_GLEXT
extern int32_t r_detailmapping;
extern int32_t r_glowmapping;

View file

@ -130,6 +130,8 @@ static uint32_t *distrecip;
static int32_t *lookups = NULL;
static int32_t beforedrawrooms = 1;
int32_t benchmarkScreenshot = 0;
static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
// r_usenewaspect is the cvar, newaspect_enable to trigger the new behaviour in the code
@ -10158,6 +10160,12 @@ void videoNextPage(void)
}
videoEndDrawing(); //}}}
if (benchmarkScreenshot)
{
videoCaptureScreen("reference0000.png", 0);
benchmarkScreenshot = 0;
}
OSD_Draw();
videoShowFrame(0);

View file

@ -7560,7 +7560,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
case SE_27_DEMO_CAM:
{
if (pSprite->extra < 1 && (ud.recstat == 0 || !ud.democams)) break;
if (pSprite->extra < 1 && (ud.recstat == 0 || !ud.democams) && g_BenchmarkMode == BENCHMARKMODE_OFF) break;
if (klabs(pSprite->extra) == 2)
{
@ -7606,6 +7606,9 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
pData[8] = (((int32_t) getangle(-ksqrt(cameraDirection.x*cameraDirection.x+cameraDirection.y*cameraDirection.y), cameraDirection.z)*(400.f/1024.f)))-300;
}
}
//if we are benchmarking, take a screenshot at each waypoint (camera start point/locator)
benchmarkScreenshot = g_BenchmarkMode == BENCHMARKMODE_GENERATE_REFERENCE;
}
if (pSprite->owner == -1)
{

View file

@ -90,6 +90,8 @@ char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0};
int32_t voting = -1;
int32_t vote_map = -1, vote_episode = -1;
int32_t g_BenchmarkMode = BENCHMARKMODE_OFF;
int32_t g_Debug = 0;
const char *defaultrtsfilename[GAMECOUNT] = { "DUKE.RTS", "NAM.RTS", "NAPALM.RTS", "WW2GI.RTS" };

View file

@ -116,6 +116,12 @@ enum {
STATUSBAR_NOMODERN = 0x00000040,
};
enum {
BENCHMARKMODE_OFF = 0x0,
BENCHMARKMODE_PERFORMANCE = 0x1,
BENCHMARKMODE_GENERATE_REFERENCE = 0x2,
};
void A_DeleteSprite(int spriteNum);
static inline int32_t G_GetLogoFlags(void)
@ -312,6 +318,7 @@ extern char ror_protectedsectors[MAXSECTORS];
extern float r_ambientlight;
extern int32_t g_BenchmarkMode;
extern int32_t g_Debug;
extern int32_t g_Shareware;
#if !defined LUNATIC

View file

@ -1552,6 +1552,8 @@ int32_t registerosdcommands(void)
{
static osdcvardata_t cvars_game[] =
{
{ "benchmarkmode", "Set the benchmark mode (0: off, 1: performance test, 2: generate reference screenshots for correctness testing)", (void *) &g_BenchmarkMode, CVAR_INT|CVAR_NOSAVE, 0, 2 },
{ "crosshair", "enable/disable crosshair", (void *)&ud.crosshair, CVAR_BOOL, 0, 1 },
{ "cl_autoaim", "enable/disable weapon autoaim", (void *)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 3 },