diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index d437990db..f40f86e0e 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -6647,6 +6647,8 @@ double Host_Frame (double time) } else fps_count++; + + sh_config.showbatches = false; } if (host_speeds.ival) diff --git a/engine/client/console.c b/engine/client/console.c index aa979d992..e128b4396 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -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); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index aa2c80f70..0f65ad489 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -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; diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index ffc392035..96e296225 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -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; diff --git a/engine/gl/shader.h b/engine/gl/shader.h index 1a0ffc06d..131c9ef9f 100644 --- a/engine/gl/shader.h +++ b/engine/gl/shader.h @@ -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