Add r_showbatches command to debug builds. Shows a list of all draw calls for the next video frame.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6298 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-07-28 02:17:52 +00:00
parent 4fc23b4f4d
commit 6941032cc7
5 changed files with 61 additions and 10 deletions

View File

@ -6647,6 +6647,8 @@ double Host_Frame (double time)
}
else
fps_count++;
sh_config.showbatches = false;
}
if (host_speeds.ival)

View File

@ -2758,12 +2758,17 @@ static void Con_DrawModelPreview(model_t *model, float x, float y, float w, floa
ent.framestate.g[FS_REG].lerpweight[0] = 1;
ent.framestate.g[FS_REG].frametime[0] = ent.framestate.g[FS_REG].frametime[1] = realtime;
ent.framestate.g[FS_REG].endbone = 0x7fffffff;
ent.customskin = Mod_RegisterSkinFile(va("%s_0.skin", model->publicname));
if (ent.customskin == 0)
if (model->submodelof)
;
else
{
char haxxor[MAX_QPATH];
COM_StripExtension(model->publicname, haxxor, sizeof(haxxor));
ent.customskin = Mod_RegisterSkinFile(va("%s_default.skin", haxxor));
ent.customskin = Mod_RegisterSkinFile(va("%s_0.skin", model->publicname));
if (ent.customskin == 0)
{
char haxxor[MAX_QPATH];
COM_StripExtension(model->publicname, haxxor, sizeof(haxxor));
ent.customskin = Mod_RegisterSkinFile(va("%s_default.skin", haxxor));
}
}
Vector4Set(ent.shaderRGBAf, 1,1,1,1);

View File

@ -685,6 +685,13 @@ void R_ListSkins_f(void)
void R_SetRenderer_f (void);
void R_ReloadRenderer_f (void);
#ifdef _DEBUG
static void R_ShowBatches_f(void)
{
sh_config.showbatches = true;
}
#endif
void R_ToggleFullscreen_f(void)
{
double time;
@ -760,6 +767,10 @@ void Renderer_Init(void)
Cmd_AddCommand("r_remapshader", Shader_RemapShader_f);
Cmd_AddCommand("r_showshader", Shader_ShowShader_f);
#ifdef _DEBUG
Cmd_AddCommand("r_showbatches", R_ShowBatches_f);
#endif
#ifdef SWQUAKE
{
extern cvar_t sw_interlace;

View File

@ -1,11 +1,6 @@
#include "quakedef.h"
//#define FORCESTATE
#ifdef _DEBUG
#define DRAWCALL(f) if (developer.ival==-1) Con_Printf(f " (shader %s, ent %i)\n", shaderstate.curshader->name, (shaderstate.curbatch && shaderstate.curbatch->ent)?shaderstate.curbatch->ent->keynum:0)
#else
#define DRAWCALL(f)
#endif
void DumpGLState(void);
@ -219,6 +214,42 @@ struct {
batch_t *wbatches;
} shaderstate;
#ifdef _DEBUG
#define DRAWCALL(f) if (sh_config.showbatches) BE_PrintDrawCall(f)
#include "pr_common.h"
static void BE_PrintDrawCall(const char *msg)
{
char shadername[512];
char modelname[512];
int num;
Q_snprintfz(shadername, sizeof(shadername), "^[%-16s\\tipimg\\%s\\tipimgtype\\%i\\tip\\%s^]",
shaderstate.curshader->name,
shaderstate.curshader->name,shaderstate.curshader->usageflags,
shaderstate.curshader->name);
if (shaderstate.curbatch && shaderstate.curbatch->ent)
{
num = shaderstate.curbatch->ent->keynum;
if (shaderstate.curbatch->ent->model)
Q_snprintfz(modelname, sizeof(modelname), " - ^[%s\\modelviewer\\%s^]",
shaderstate.curbatch->ent->model->name, shaderstate.curbatch->ent->model->name);
else
*modelname = 0;
#ifdef HAVE_SERVER
if (num >= 1 && num < sv.world.num_edicts)
Con_Printf("%s shader %s ent %i%s - \"%s\"\n", msg, shadername, shaderstate.curbatch->ent->keynum, modelname, sv.world.progs->StringToNative(sv.world.progs, (WEDICT_NUM_PB(sv.world.progs, num))->v->classname));
else
#endif
Con_Printf("%s shader %s ent %i%s\n", msg, shadername, shaderstate.curbatch->ent->keynum, modelname);
}
else
Con_Printf("%s shader %s\n", msg, shadername);
}
#else
#define DRAWCALL(f)
#endif
static void BE_PolyOffset(void)
{
polyoffset_t po;

View File

@ -853,6 +853,8 @@ typedef struct
qboolean (*pCreateProgram) (program_t *prog, struct programpermu_s *permu, int ver, const char **precompilerconstants, const char *vert, const char *tcs, const char *tes, const char *geom, const char *frag, qboolean noerrors, vfsfile_t *blobfile);
qboolean (*pValidateProgram)(program_t *prog, struct programpermu_s *permu, qboolean noerrors, vfsfile_t *blobfile);
void (*pProgAutoFields) (program_t *prog, struct programpermu_s *permu, char **cvarnames, int *cvartypes);
qboolean showbatches; //print batches... cleared at end of video frame.
} sh_config_t;
extern sh_config_t sh_config;
#endif