RSurf_ActiveWorldEntity();
- r_refdef.stats.drawndecals += numsurfaces;
+ r_refdef.stats[r_stat_drawndecals] += numsurfaces;
// R_Mesh_ResetTextureState();
GL_DepthMask(false);
GL_DepthRange(0, 1);
Mem_Free(olddecals);
}
- r_refdef.stats.totaldecals = cl.num_decals;
+ r_refdef.stats[r_stat_totaldecals] = cl.num_decals;
}
static void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtlight_t *rtlight, int numsurfaces, int *surfacelist)
Vector4Set(colormultiplier, r_refdef.view.colorscale * (1.0 / 256.0f), r_refdef.view.colorscale * (1.0 / 256.0f), r_refdef.view.colorscale * (1.0 / 256.0f), cl_particles_alpha.value * (1.0 / 256.0f));
- r_refdef.stats.particles += numsurfaces;
+ r_refdef.stats[r_stat_particles] += numsurfaces;
// R_Mesh_ResetTextureState();
GL_DepthMask(false);
GL_DepthRange(0, 1);
int drawparticles = r_drawparticles.integer;
float minparticledist_start;
particle_t *p;
- float gravity, frametime, f, dist, oldorg[3];
+ float gravity, frametime, f, dist, oldorg[3], decaldir[3];
float drawdist2;
int hitent;
trace_t trace;
cvar_t timedemo_screenshotframelist = {0, "timedemo_screenshotframelist", "", "when performing a timedemo, take screenshots of each frame in this space-separated list - example: 1 201 401"};
cvar_t vid_touchscreen_outlinealpha = {0, "vid_touchscreen_outlinealpha", "0.25", "opacity of touchscreen area outlines"};
cvar_t vid_touchscreen_overlayalpha = {0, "vid_touchscreen_overlayalpha", "0.25", "opacity of touchscreen area icons"};
+cvar_t r_speeds_graph = {CVAR_SAVE, "r_speeds_graph", "0", "display a graph of renderer statistics "};
+cvar_t r_speeds_graph_filter[8] =
+{
+ {CVAR_SAVE, "r_speeds_graph_filter_r", "timedelta", "Red - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_g", "batch_batches", "Green - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_b", "batch_triangles", "Blue - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_y", "fast_triangles", "Yellow - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_c", "copytriangles_triangles", "Cyan - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_m", "dynamic_triangles", "Magenta - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_w", "animcache_shade_vertices", "White - display the specified renderer statistic"},
+ {CVAR_SAVE, "r_speeds_graph_filter_o", "animcache_shape_vertices", "Orange - display the specified renderer statistic"},
+};
+cvar_t r_speeds_graph_length = {CVAR_SAVE, "r_speeds_graph_length", "1024", "number of frames in statistics graph, can be from 4 to 8192"};
+cvar_t r_speeds_graph_seconds = {CVAR_SAVE, "r_speeds_graph_seconds", "2", "number of seconds in graph, can be from 0.1 to 120"};
+cvar_t r_speeds_graph_x = {CVAR_SAVE, "r_speeds_graph_x", "0", "position of graph"};
+cvar_t r_speeds_graph_y = {CVAR_SAVE, "r_speeds_graph_y", "0", "position of graph"};
+cvar_t r_speeds_graph_width = {CVAR_SAVE, "r_speeds_graph_width", "256", "size of graph"};
+cvar_t r_speeds_graph_height = {CVAR_SAVE, "r_speeds_graph_height", "128", "size of graph"};
+
+
extern cvar_t v_glslgamma;
extern cvar_t sbar_info_pos;
float g[NETGRAPH_PACKETS][6];
float *a;
float *b;
- float vertex3f[(NETGRAPH_PACKETS+2)*5*2*3];
- float color4f[(NETGRAPH_PACKETS+2)*5*2*4];
- float *v;
- float *c;
+ r_vertexgeneric_t vertex[(NETGRAPH_PACKETS+2)*5*2];
+ r_vertexgeneric_t *v;
DrawQ_Fill(graphx, graphy, graphwidth, graphheight + textsize * 2, 0, 0, 0, 0.5, 0);
// draw the bar graph itself
memset(g, 0, sizeof(g));
}
// render the lines for the graph
numlines = 0;
- v = vertex3f;
- c = color4f;
+ v = vertex;
for (j = 0;j < NETGRAPH_PACKETS;j++)
{
a = g[j];
b = g[(j+1)%NETGRAPH_PACKETS];
if (a[0] < 0.0f || b[0] > 1.0f || b[0] < a[0])
continue;
- VectorSet(v, graphx + graphwidth * a[0], graphy + graphheight * a[2], 0.0f);v += 3;Vector4Set(c, 1.0f, 1.0f, 0.0f, 1.0f);c += 4;
- VectorSet(v, graphx + graphwidth * b[0], graphy + graphheight * b[2], 0.0f);v += 3;Vector4Set(c, 1.0f, 1.0f, 0.0f, 1.0f);c += 4;
+ VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[2], 0.0f);Vector4Set(v->color4f, 1.0f, 1.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
+ VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[2], 0.0f);Vector4Set(v->color4f, 1.0f, 1.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
- VectorSet(v, graphx + graphwidth * a[0], graphy + graphheight * a[1], 0.0f);v += 3;Vector4Set(c, 1.0f, 0.0f, 0.0f, 1.0f);c += 4;
- VectorSet(v, graphx + graphwidth * b[0], graphy + graphheight * b[1], 0.0f);v += 3;Vector4Set(c, 1.0f, 0.0f, 0.0f, 1.0f);c += 4;
+ VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[1], 0.0f);Vector4Set(v->color4f, 1.0f, 0.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
+ VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[1], 0.0f);Vector4Set(v->color4f, 1.0f, 0.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
- VectorSet(v, graphx + graphwidth * a[0], graphy + graphheight * a[5], 0.0f);v += 3;Vector4Set(c, 0.0f, 1.0f, 0.0f, 1.0f);c += 4;
- VectorSet(v, graphx + graphwidth * b[0], graphy + graphheight * b[5], 0.0f);v += 3;Vector4Set(c, 0.0f, 1.0f, 0.0f, 1.0f);c += 4;
+ VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[5], 0.0f);Vector4Set(v->color4f, 0.0f, 1.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
+ VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[5], 0.0f);Vector4Set(v->color4f, 0.0f, 1.0f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
- VectorSet(v, graphx + graphwidth * a[0], graphy + graphheight * a[4], 0.0f);v += 3;Vector4Set(c, 1.0f, 1.0f, 1.0f, 1.0f);c += 4;
- VectorSet(v, graphx + graphwidth * b[0], graphy + graphheight * b[4], 0.0f);v += 3;Vector4Set(c, 1.0f, 1.0f, 1.0f, 1.0f);c += 4;
+ VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[4], 0.0f);Vector4Set(v->color4f, 1.0f, 1.0f, 1.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
+ VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[4], 0.0f);Vector4Set(v->color4f, 1.0f, 1.0f, 1.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
- VectorSet(v, graphx + graphwidth * a[0], graphy + graphheight * a[3], 0.0f);v += 3;Vector4Set(c, 1.0f, 0.5f, 0.0f, 1.0f);c += 4;
- VectorSet(v, graphx + graphwidth * b[0], graphy + graphheight * b[3], 0.0f);v += 3;Vector4Set(c, 1.0f, 0.5f, 0.0f, 1.0f);c += 4;
+ VectorSet(v->vertex3f, graphx + graphwidth * a[0], graphy + graphheight * a[3], 0.0f);Vector4Set(v->color4f, 1.0f, 0.5f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
+ VectorSet(v->vertex3f, graphx + graphwidth * b[0], graphy + graphheight * b[3], 0.0f);Vector4Set(v->color4f, 1.0f, 0.5f, 0.0f, 1.0f);Vector2Set(v->texcoord2f, 0.0f, 0.0f);v++;
numlines += 5;
}
if (numlines > 0)
- DrawQ_Lines(0.0f, numlines, vertex3f, color4f, 0);
+ {
+ R_Mesh_PrepareVertices_Generic(numlines*2, vertex, NULL);
+ DrawQ_Lines(0.0f, numlines, 0, false);
+ }
x = graphx;
y = graphy + graphheight;
dpsnprintf(bytesstring, sizeof(bytesstring), "%i", totalbytes);
//=============================================================================
+const char *r_stat_name[r_stat_count] =
+{
+ "timedelta",
+ "quality",
+ "renders",
+ "entities",
+ "entities_surfaces",
+ "entities_triangles",
+ "world_leafs",
+ "world_portals",
+ "world_surfaces",
+ "world_triangles",
+ "lightmapupdates",
+ "lightmapupdatepixels",
+ "particles",
+ "drawndecals",
+ "totaldecals",
+ "draws",
+ "draws_vertices",
+ "draws_elements",
+ "lights",
+ "lights_clears",
+ "lights_scissored",
+ "lights_lighttriangles",
+ "lights_shadowtriangles",
+ "lights_dynamicshadowtriangles",
+ "bouncegrid_lights",
+ "bouncegrid_particles",
+ "bouncegrid_traces",
+ "bouncegrid_hits",
+ "bouncegrid_splats",
+ "bouncegrid_bounces",
+ "photoncache_animated",
+ "photoncache_cached",
+ "photoncache_traced",
+ "bloom",
+ "bloom_copypixels",
+ "bloom_drawpixels",
+ "indexbufferuploadcount",
+ "indexbufferuploadsize",
+ "vertexbufferuploadcount",
+ "vertexbufferuploadsize",
+ "framedatacurrent",
+ "framedatasize",
+ "animcache_vertexmesh_count",
+ "animcache_vertexmesh_vertices",
+ "animcache_vertexmesh_maxvertices",
+ "animcache_skeletal_count",
+ "animcache_skeletal_bones",
+ "animcache_skeletal_maxbones",
+ "animcache_shade_count",
+ "animcache_shade_vertices",
+ "animcache_shade_maxvertices",
+ "animcache_shape_count",
+ "animcache_shape_vertices",
+ "animcache_shape_maxvertices",
+ "batch_batches",
+ "batch_withgaps",
+ "batch_surfaces",
+ "batch_vertices",
+ "batch_triangles",
+ "fast_batches",
+ "fast_surfaces",
+ "fast_vertices",
+ "fast_triangles",
+ "copytriangles_batches",
+ "copytriangles_surfaces",
+ "copytriangles_vertices",
+ "copytriangles_triangles",
+ "dynamic_batches",
+ "dynamic_surfaces",
+ "dynamic_vertices",
+ "dynamic_triangles",
+ "dynamicskeletal_batches",
+ "dynamicskeletal_surfaces",
+ "dynamicskeletal_vertices",
+ "dynamicskeletal_triangles",
+ "dynamic_batches_because_cvar",
+ "dynamic_surfaces_because_cvar",
+ "dynamic_vertices_because_cvar",
+ "dynamic_triangles_because_cvar",
+ "dynamic_batches_because_lightmapvertex",
+ "dynamic_surfaces_because_lightmapvertex",
+ "dynamic_vertices_because_lightmapvertex",
+ "dynamic_triangles_because_lightmapvertex",
+ "dynamic_batches_because_deformvertexes_autosprite",
+ "dynamic_surfaces_because_deformvertexes_autosprite",
+ "dynamic_vertices_because_deformvertexes_autosprite",
+ "dynamic_triangles_because_deformvertexes_autosprite",
+ "dynamic_batches_because_deformvertexes_autosprite2",
+ "dynamic_surfaces_because_deformvertexes_autosprite2",
+ "dynamic_vertices_because_deformvertexes_autosprite2",
+ "dynamic_triangles_because_deformvertexes_autosprite2",
+ "dynamic_batches_because_deformvertexes_normal",
+ "dynamic_surfaces_because_deformvertexes_normal",
+ "dynamic_vertices_because_deformvertexes_normal",
+ "dynamic_triangles_because_deformvertexes_normal",
+ "dynamic_batches_because_deformvertexes_wave",
+ "dynamic_surfaces_because_deformvertexes_wave",
+ "dynamic_vertices_because_deformvertexes_wave",
+ "dynamic_triangles_because_deformvertexes_wave",
+ "dynamic_batches_because_deformvertexes_bulge",
+ "dynamic_surfaces_because_deformvertexes_bulge",
+ "dynamic_vertices_because_deformvertexes_bulge",
+ "dynamic_triangles_because_deformvertexes_bulge",
+ "dynamic_batches_because_deformvertexes_move",
+ "dynamic_surfaces_because_deformvertexes_move",
+ "dynamic_vertices_because_deformvertexes_move",
+ "dynamic_triangles_because_deformvertexes_move",
+ "dynamic_batches_because_tcgen_lightmap",
+ "dynamic_surfaces_because_tcgen_lightmap",
+ "dynamic_vertices_because_tcgen_lightmap",
+ "dynamic_triangles_because_tcgen_lightmap",
+ "dynamic_batches_because_tcgen_vector",
+ "dynamic_surfaces_because_tcgen_vector",
+ "dynamic_vertices_because_tcgen_vector",
+ "dynamic_triangles_because_tcgen_vector",
+ "dynamic_batches_because_tcgen_environment",
+ "dynamic_surfaces_because_tcgen_environment",
+ "dynamic_vertices_because_tcgen_environment",
+ "dynamic_triangles_because_tcgen_environment",
+ "dynamic_batches_because_tcmod_turbulent",
+ "dynamic_surfaces_because_tcmod_turbulent",
+ "dynamic_vertices_because_tcmod_turbulent",
+ "dynamic_triangles_because_tcmod_turbulent",
+ "dynamic_batches_because_interleavedarrays",
+ "dynamic_surfaces_because_interleavedarrays",
+ "dynamic_vertices_because_interleavedarrays",
+ "dynamic_triangles_because_interleavedarrays",
+ "dynamic_batches_because_nogaps",
+ "dynamic_surfaces_because_nogaps",
+ "dynamic_vertices_because_nogaps",
+ "dynamic_triangles_because_nogaps",
+ "dynamic_batches_because_derived",
+ "dynamic_surfaces_because_derived",
+ "dynamic_vertices_because_derived",
+ "dynamic_triangles_because_derived",
+};
+
char r_speeds_timestring[4096];
int speedstringcount, r_timereport_active;
double r_timereport_temp = 0, r_timereport_current = 0, r_timereport_start = 0;
return triangles;
}
+#define R_SPEEDS_GRAPH_COLORS 8
+#define R_SPEEDS_GRAPH_TEXTLENGTH 64
+static float r_speeds_graph_colors[R_SPEEDS_GRAPH_COLORS][4] = {{1, 0, 0, 1}, {0, 1, 0, 1}, {0, 0, 1, 1}, {1, 1, 0, 1}, {0, 1, 1, 1}, {1, 0, 1, 1}, {1, 1, 1, 1}, {1, 0.5f, 0, 1}};
+
extern cvar_t r_viewscale;
extern float viewscalefpsadjusted;
static void R_TimeReport_EndFrame(void)
cl_locnode_t *loc;
char string[1024+4096];
mleaf_t *viewleaf;
+ static double oldtime = 0;
+
+ r_refdef.stats[r_stat_timedelta] = (int)((realtime - oldtime) * 1000000.0);
+ oldtime = realtime;
+ r_refdef.stats[r_stat_quality] = (int)(100 * r_refdef.view.quality);
string[0] = 0;
if (r_speeds.integer)
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),
-"%6.0fus rendertime %3.0f%% viewscale %s%s %.3f cl.time%2.4f brightness\n"
+"%6ius time delta %s%s %.3f cl.time%2.4f brightness\n"
"%3i renders org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n"
"%5i viewleaf%5i cluster%3i area%4i brushes%4i surfaces(%7i triangles)\n"
"%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n"
"%5i leafs%5i portals%6i/%6i particles%6i/%6i decals %3i%% quality\n"
-"%7i lightmap updates (%7i pixels)%8iKB/%8iKB framedata\n"
+"%7i lightmap updates (%7i pixels)%8i/%8i framedata\n"
"%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n"
"bouncegrid:%4i lights%6i particles%6i traces%6i hits%6i splats%6i bounces\n"
-"collision cache efficiency:%6i cached%6i traced%6ianimated\n"
+"photon cache efficiency:%6i cached%6i traced%6ianimated\n"
"%6i draws%8i vertices%8i triangles bloompixels%8i copied%8i drawn\n"
"updated%5i indexbuffers%8i bytes%5i vertexbuffers%8i bytes\n"
+"animcache%5ib gpuskeletal%7i vertices (%7i with normals)\n"
+"fastbatch%5i count%5i surfaces%7i vertices %7i triangles\n"
+"copytris%5i count%5i surfaces%7i vertices %7i triangles\n"
+"dynamic%5i count%5i surfaces%7i vertices%7i triangles\n"
"%s"
-, r_refdef.lastdrawscreentime * 1000000.0, r_viewscale.value * sqrt(viewscalefpsadjusted) * 100.0f, loc ? "Location: " : "", loc ? loc->name : "", cl.time, r_refdef.view.colorscale
-, 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]
+, r_refdef.stats[r_stat_timedelta], loc ? "Location: " : "", loc ? loc->name : "", cl.time, r_refdef.view.colorscale
+, r_refdef.stats[r_stat_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
-, r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, cl.num_particles, r_refdef.stats.drawndecals, r_refdef.stats.totaldecals, (int)(100 * r_refdef.view.quality)
-, r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels, (r_refdef.stats.framedatacurrent+512) / 1024, (r_refdef.stats.framedatasize+512)/1024
-, r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles
-, r_refdef.stats.bouncegrid_lights, r_refdef.stats.bouncegrid_particles, r_refdef.stats.bouncegrid_traces, r_refdef.stats.bouncegrid_hits, r_refdef.stats.bouncegrid_splats, r_refdef.stats.bouncegrid_bounces
-, r_refdef.stats.collisioncache_cached, r_refdef.stats.collisioncache_traced, r_refdef.stats.collisioncache_animated
-, r_refdef.stats.draws, r_refdef.stats.draws_vertices, r_refdef.stats.draws_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels
-, r_refdef.stats.indexbufferuploadcount, r_refdef.stats.indexbufferuploadsize, r_refdef.stats.vertexbufferuploadcount, r_refdef.stats.vertexbufferuploadsize
+, r_refdef.stats[r_stat_world_surfaces], r_refdef.stats[r_stat_world_triangles], r_refdef.stats[r_stat_entities], r_refdef.stats[r_stat_entities_surfaces], r_refdef.stats[r_stat_entities_triangles]
+, r_refdef.stats[r_stat_world_leafs], r_refdef.stats[r_stat_world_portals], r_refdef.stats[r_stat_particles], cl.num_particles, r_refdef.stats[r_stat_drawndecals], r_refdef.stats[r_stat_totaldecals], r_refdef.stats[r_stat_quality]
+, r_refdef.stats[r_stat_lightmapupdates], r_refdef.stats[r_stat_lightmapupdatepixels], r_refdef.stats[r_stat_framedatacurrent], r_refdef.stats[r_stat_framedatasize]
+, r_refdef.stats[r_stat_lights], r_refdef.stats[r_stat_lights_clears], r_refdef.stats[r_stat_lights_scissored], r_refdef.stats[r_stat_lights_lighttriangles], r_refdef.stats[r_stat_lights_shadowtriangles], r_refdef.stats[r_stat_lights_dynamicshadowtriangles]
+, r_refdef.stats[r_stat_bouncegrid_lights], r_refdef.stats[r_stat_bouncegrid_particles], r_refdef.stats[r_stat_bouncegrid_traces], r_refdef.stats[r_stat_bouncegrid_hits], r_refdef.stats[r_stat_bouncegrid_splats], r_refdef.stats[r_stat_bouncegrid_bounces]
+, r_refdef.stats[r_stat_photoncache_cached], r_refdef.stats[r_stat_photoncache_traced], r_refdef.stats[r_stat_photoncache_animated]
+, r_refdef.stats[r_stat_draws], r_refdef.stats[r_stat_draws_vertices], r_refdef.stats[r_stat_draws_elements] / 3, r_refdef.stats[r_stat_bloom_copypixels], r_refdef.stats[r_stat_bloom_drawpixels]
+, r_refdef.stats[r_stat_indexbufferuploadcount], r_refdef.stats[r_stat_indexbufferuploadsize], r_refdef.stats[r_stat_vertexbufferuploadcount], r_refdef.stats[r_stat_vertexbufferuploadsize]
+, r_refdef.stats[r_stat_animcache_skeletal_bones], r_refdef.stats[r_stat_animcache_shape_vertices], r_refdef.stats[r_stat_animcache_shade_vertices]
+, r_refdef.stats[r_stat_batch_fast_batches], r_refdef.stats[r_stat_batch_fast_surfaces], r_refdef.stats[r_stat_batch_fast_vertices], r_refdef.stats[r_stat_batch_fast_triangles]
+, r_refdef.stats[r_stat_batch_copytriangles_batches], r_refdef.stats[r_stat_batch_copytriangles_surfaces], r_refdef.stats[r_stat_batch_copytriangles_vertices], r_refdef.stats[r_stat_batch_copytriangles_triangles]
+, r_refdef.stats[r_stat_batch_dynamic_batches], r_refdef.stats[r_stat_batch_dynamic_surfaces], r_refdef.stats[r_stat_batch_dynamic_vertices], r_refdef.stats[r_stat_batch_dynamic_triangles]
, r_speeds_timestring);
+ }
- memset(&r_refdef.stats, 0, sizeof(r_refdef.stats));
-
- speedstringcount = 0;
- r_speeds_timestring[0] = 0;
- r_timereport_active = false;
+ speedstringcount = 0;
+ r_speeds_timestring[0] = 0;
+ r_timereport_active = false;
- if (r_speeds.integer >= 2)
- {
- r_timereport_active = true;
- r_timereport_start = r_timereport_current = Sys_DirtyTime();
- }
+ if (r_speeds.integer >= 2)
+ {
+ r_timereport_active = true;
+ r_timereport_start = r_timereport_current = Sys_DirtyTime();
}
if (string[0])
}
r_draw2d_force = false;
}
+
+ if (r_speeds_graph_length.integer != bound(4, r_speeds_graph_length.integer, 8192))
+ Cvar_SetValueQuick(&r_speeds_graph_length, bound(4, r_speeds_graph_length.integer, 8192));
+ if (fabs(r_speeds_graph_seconds.value - bound(0.1f, r_speeds_graph_seconds.value, 120.0f)) > 0.01f)
+ Cvar_SetValueQuick(&r_speeds_graph_seconds, bound(0.1f, r_speeds_graph_seconds.value, 120.0f));
+ if (r_speeds_graph.integer)
+ {
+ // if we currently have no graph data, reset the graph data entirely
+ if (!cls.r_speeds_graph_data)
+ for (i = 0;i < r_stat_count;i++)
+ cls.r_speeds_graph_datamin[i] = cls.r_speeds_graph_datamax[i] = r_refdef.stats[i];
+ if (cls.r_speeds_graph_length != r_speeds_graph_length.integer)
+ {
+ int i, stat, index, d, graph_length, *graph_data;
+ cls.r_speeds_graph_length = r_speeds_graph_length.integer;
+ cls.r_speeds_graph_current = 0;
+ if (cls.r_speeds_graph_data)
+ Mem_Free(cls.r_speeds_graph_data);
+ cls.r_speeds_graph_data = Mem_Alloc(cls.permanentmempool, cls.r_speeds_graph_length * sizeof(r_refdef.stats));
+ // initialize the graph to have the current values throughout history
+ graph_data = cls.r_speeds_graph_data;
+ graph_length = cls.r_speeds_graph_length;
+ index = 0;
+ for (stat = 0;stat < r_stat_count;stat++)
+ {
+ d = r_refdef.stats[stat];
+ if (stat == r_stat_timedelta)
+ d = 0;
+ for (i = 0;i < graph_length;i++)
+ graph_data[index++] = d;
+ }
+ }
+ }
+ else
+ {
+ if (cls.r_speeds_graph_length)
+ {
+ cls.r_speeds_graph_length = 0;
+ Mem_Free(cls.r_speeds_graph_data);
+ cls.r_speeds_graph_data = NULL;
+ cls.r_speeds_graph_current = 0;
+ }
+ }
+
+ if (cls.r_speeds_graph_length)
+ {
+ char legend[128];
+ r_vertexgeneric_t *v;
+ int numlines;
+ const int *data;
+ float x, y, width, height, scalex, scaley;
+ int color, stat, stats, index, range_min, range_max;
+ int graph_current, graph_length, *graph_data;
+ int statindex[R_SPEEDS_GRAPH_COLORS];
+ int frameslastsecond;
+ int sum;
+
+ // add current stats to the graph_data
+ cls.r_speeds_graph_current++;
+ if (cls.r_speeds_graph_current >= cls.r_speeds_graph_length)
+ cls.r_speeds_graph_current = 0;
+ // poke each new stat into the current offset of its graph
+ graph_data = cls.r_speeds_graph_data;
+ graph_current = cls.r_speeds_graph_current;
+ graph_length = cls.r_speeds_graph_length;
+ for (stat = 0;stat < r_stat_count;stat++)
+ graph_data[stat * graph_length + graph_current] = r_refdef.stats[stat];
+
+ // update the graph ranges
+ for (stat = 0;stat < r_stat_count;stat++)
+ {
+ if (cls.r_speeds_graph_datamin[stat] > r_refdef.stats[stat])
+ cls.r_speeds_graph_datamin[stat] = r_refdef.stats[stat];
+ if (cls.r_speeds_graph_datamax[stat] < r_refdef.stats[stat])
+ cls.r_speeds_graph_datamax[stat] = r_refdef.stats[stat];
+ }
+
+ // force 2D drawing to occur even if r_render is 0
+ r_draw2d_force = true;
+
+ // position the graph
+ width = r_speeds_graph_width.value;
+ height = r_speeds_graph_height.value;
+ x = bound(0, r_speeds_graph_x.value, vid_conwidth.value - width);
+ y = bound(0, r_speeds_graph_y.value, vid_conheight.value - height);
+
+ // count how many frames were in the last second
+ data = graph_data + r_stat_timedelta * graph_length;
+ index = graph_current;
+ sum = 0;
+ for (i = 0;i < graph_length;i++)
+ {
+ sum += data[index];
+ if (sum >= 1000000)
+ break;
+ index--;
+ if (index < 0)
+ index = graph_length - 1;
+ }
+ frameslastsecond = i;
+
+ // fill background with a pattern of gray and black at one second intervals
+ scalex = (float)width / (float)r_speeds_graph_seconds.value;
+ for (i = 0;i < r_speeds_graph_seconds.integer + 1;i++)
+ {
+ float x1 = x + width - (i + 1) * scalex;
+ float x2 = x + width - i * scalex;
+ if (x1 < x)
+ x1 = x;
+ if (i & 1)
+ DrawQ_Fill(x1, y, x2 - x1, height, 0.0f, 0.0f, 0.0f, 0.5f, 0);
+ else
+ DrawQ_Fill(x1, y, x2 - x1, height, 0.2f, 0.2f, 0.2f, 0.5f, 0);
+ }
+
+ // count how many stats match our pattern
+ stats = 0;
+ color = 0;
+ for (color = 0;color < R_SPEEDS_GRAPH_COLORS;color++)
+ {
+ // look at all stat names and find ones matching the filter
+ statindex[color] = -1;
+ if (!r_speeds_graph_filter[color].string)
+ continue;
+ for (stat = 0;stat < r_stat_count;stat++)
+ if (!strcmp(r_stat_name[stat], r_speeds_graph_filter[color].string))
+ break;
+ if (stat >= r_stat_count)
+ continue;
+ // record that this color is this stat for the line drawing loop
+ statindex[color] = stat;
+ // draw the legend text in the background of the graph
+ dpsnprintf(legend, sizeof(legend), "%10i :%s", graph_data[stat * graph_length + graph_current], r_stat_name[stat]);
+ DrawQ_String(x, y + stats * 8, legend, 0, 8, 8, r_speeds_graph_colors[color][0], r_speeds_graph_colors[color][1], r_speeds_graph_colors[color][2], r_speeds_graph_colors[color][3] * 1.00f, 0, NULL, true, FONT_DEFAULT);
+ // count how many stats we need to graph in vertex buffer
+ stats++;
+ }
+ dpsnprintf(legend, sizeof(legend), "%10i frames last second", frameslastsecond);
+ DrawQ_String(x, y + stats * 8, legend, 0, 8, 8, 0.5f, 0.5f, 0.5f, 0.5f, 0, NULL, true, FONT_DEFAULT);
+
+ if (stats)
+ {
+ // legend text is drawn after the graphs
+ // render the graph lines, we'll go back and render the legend text later
+ scalex = (float)width / (1000000.0 * r_speeds_graph_seconds.value);
+ // get space in a vertex buffer to draw this
+ numlines = stats * (graph_length - 1);
+ v = R_Mesh_PrepareVertices_Generic_Lock(numlines * 2);
+ stats = 0;
+ for (color = 0;color < R_SPEEDS_GRAPH_COLORS;color++)
+ {
+ // look at all stat names and find ones matching the filter
+ stat = statindex[color];
+ if (stat < 0)
+ continue;
+ // prefer to graph stats with 0 base, but if they are
+ // negative we have no choice
+ range_min = min(cls.r_speeds_graph_datamin[stat], 0);
+ range_max = cls.r_speeds_graph_datamax[stat];
+ // some stats we specifically override the graph scale on
+ if (stat == r_stat_timedelta)
+ range_max = 100000;
+ if (range_max == range_min)
+ range_max++;
+ scaley = height / (range_max - range_min);
+ // generate lines (2 vertices each)
+ // to deal with incomplete data we walk right to left
+ data = graph_data + stat * graph_length;
+ index = graph_current;
+ sum = 0;
+ for (i = 0;i < graph_length - 1;)
+ {
+ v->vertex3f[0] = x + width - sum * scalex;
+ if (v->vertex3f[0] < x)
+ v->vertex3f[0] = x;
+ v->vertex3f[1] = y + height - (data[index] - range_min) * scaley;
+ v->vertex3f[2] = 0;
+ v->color4f[0] = r_speeds_graph_colors[color][0];
+ v->color4f[1] = r_speeds_graph_colors[color][1];
+ v->color4f[2] = r_speeds_graph_colors[color][2];
+ v->color4f[3] = r_speeds_graph_colors[color][3];
+ v->texcoord2f[0] = 0;
+ v->texcoord2f[1] = 0;
+ v++;
+ sum += graph_data[r_stat_timedelta * graph_length + index];
+ index--;
+ if (index < 0)
+ index = graph_length - 1;
+ i++;
+ v->vertex3f[0] = x + width - sum * scalex;
+ if (v->vertex3f[0] < x)
+ v->vertex3f[0] = x;
+ v->vertex3f[1] = y + height - (data[index] - range_min) * scaley;
+ v->vertex3f[2] = 0;
+ v->color4f[0] = r_speeds_graph_colors[color][0];
+ v->color4f[1] = r_speeds_graph_colors[color][1];
+ v->color4f[2] = r_speeds_graph_colors[color][2];
+ v->color4f[3] = r_speeds_graph_colors[color][3];
+ v->texcoord2f[0] = 0;
+ v->texcoord2f[1] = 0;
+ v++;
+ }
+ }
+ R_Mesh_PrepareVertices_Generic_Unlock();
+ DrawQ_Lines(0.0f, numlines, 0, false);
+ }
+
+ // return to not drawing anything if r_render is 0
+ r_draw2d_force = false;
+ }
+
+ memset(&r_refdef.stats, 0, sizeof(r_refdef.stats));
}
/*
void CL_Screen_Init(void)
{
+ int i;
Cvar_RegisterVariable (&scr_fov);
Cvar_RegisterVariable (&scr_viewsize);
Cvar_RegisterVariable (&scr_conalpha);
Cvar_RegisterVariable(&timedemo_screenshotframelist);
Cvar_RegisterVariable(&vid_touchscreen_outlinealpha);
Cvar_RegisterVariable(&vid_touchscreen_overlayalpha);
+ Cvar_RegisterVariable(&r_speeds_graph);
+ for (i = 0;i < (int)(sizeof(r_speeds_graph_filter)/sizeof(r_speeds_graph_filter[0]));i++)
+ Cvar_RegisterVariable(&r_speeds_graph_filter[i]);
+ Cvar_RegisterVariable(&r_speeds_graph_length);
+ Cvar_RegisterVariable(&r_speeds_graph_seconds);
+ Cvar_RegisterVariable(&r_speeds_graph_x);
+ Cvar_RegisterVariable(&r_speeds_graph_y);
+ Cvar_RegisterVariable(&r_speeds_graph_width);
+ Cvar_RegisterVariable(&r_speeds_graph_height);
// if we want no console, turn it off here too
if (COM_CheckParm ("-noconsole"))
#include "matrixlib.h"
#include "snd_main.h"
+// NOTE: r_stat_name[] must match this indexing
+typedef enum r_stat_e
+{
+ r_stat_timedelta,
+ r_stat_quality,
+ r_stat_renders,
+ r_stat_entities,
+ r_stat_entities_surfaces,
+ r_stat_entities_triangles,
+ r_stat_world_leafs,
+ r_stat_world_portals,
+ r_stat_world_surfaces,
+ r_stat_world_triangles,
+ r_stat_lightmapupdates,
+ r_stat_lightmapupdatepixels,
+ r_stat_particles,
+ r_stat_drawndecals,
+ r_stat_totaldecals,
+ r_stat_draws,
+ r_stat_draws_vertices,
+ r_stat_draws_elements,
+ r_stat_lights,
+ r_stat_lights_clears,
+ r_stat_lights_scissored,
+ r_stat_lights_lighttriangles,
+ r_stat_lights_shadowtriangles,
+ r_stat_lights_dynamicshadowtriangles,
+ r_stat_bouncegrid_lights,
+ r_stat_bouncegrid_particles,
+ r_stat_bouncegrid_traces,
+ r_stat_bouncegrid_hits,
+ r_stat_bouncegrid_splats,
+ r_stat_bouncegrid_bounces,
+ r_stat_photoncache_animated,
+ r_stat_photoncache_cached,
+ r_stat_photoncache_traced,
+ r_stat_bloom,
+ r_stat_bloom_copypixels,
+ r_stat_bloom_drawpixels,
+ r_stat_indexbufferuploadcount,
+ r_stat_indexbufferuploadsize,
+ r_stat_vertexbufferuploadcount,
+ r_stat_vertexbufferuploadsize,
+ r_stat_framedatacurrent,
+ r_stat_framedatasize,
+ r_stat_animcache_vertexmesh_count,
+ r_stat_animcache_vertexmesh_vertices,
+ r_stat_animcache_vertexmesh_maxvertices,
+ r_stat_animcache_skeletal_count,
+ r_stat_animcache_skeletal_bones,
+ r_stat_animcache_skeletal_maxbones,
+ r_stat_animcache_shade_count,
+ r_stat_animcache_shade_vertices,
+ r_stat_animcache_shade_maxvertices,
+ r_stat_animcache_shape_count,
+ r_stat_animcache_shape_vertices,
+ r_stat_animcache_shape_maxvertices,
+ r_stat_batch_batches,
+ r_stat_batch_withgaps,
+ r_stat_batch_surfaces,
+ r_stat_batch_vertices,
+ r_stat_batch_triangles,
+ r_stat_batch_fast_batches,
+ r_stat_batch_fast_surfaces,
+ r_stat_batch_fast_vertices,
+ r_stat_batch_fast_triangles,
+ r_stat_batch_copytriangles_batches,
+ r_stat_batch_copytriangles_surfaces,
+ r_stat_batch_copytriangles_vertices,
+ r_stat_batch_copytriangles_triangles,
+ r_stat_batch_dynamic_batches,
+ r_stat_batch_dynamic_surfaces,
+ r_stat_batch_dynamic_vertices,
+ r_stat_batch_dynamic_triangles,
+ r_stat_batch_dynamicskeletal_batches,
+ r_stat_batch_dynamicskeletal_surfaces,
+ r_stat_batch_dynamicskeletal_vertices,
+ r_stat_batch_dynamicskeletal_triangles,
+ r_stat_batch_dynamic_batches_because_cvar,
+ r_stat_batch_dynamic_surfaces_because_cvar,
+ r_stat_batch_dynamic_vertices_because_cvar,
+ r_stat_batch_dynamic_triangles_because_cvar,
+ r_stat_batch_dynamic_batches_because_lightmapvertex,
+ r_stat_batch_dynamic_surfaces_because_lightmapvertex,
+ r_stat_batch_dynamic_vertices_because_lightmapvertex,
+ r_stat_batch_dynamic_triangles_because_lightmapvertex,
+ r_stat_batch_dynamic_batches_because_deformvertexes_autosprite,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite,
+ r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2,
+ r_stat_batch_dynamic_batches_because_deformvertexes_normal,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_normal,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_normal,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_normal,
+ r_stat_batch_dynamic_batches_because_deformvertexes_wave,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_wave,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_wave,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_wave,
+ r_stat_batch_dynamic_batches_because_deformvertexes_bulge,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_bulge,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_bulge,
+ r_stat_batch_dynamic_batches_because_deformvertexes_move,
+ r_stat_batch_dynamic_surfaces_because_deformvertexes_move,
+ r_stat_batch_dynamic_vertices_because_deformvertexes_move,
+ r_stat_batch_dynamic_triangles_because_deformvertexes_move,
+ r_stat_batch_dynamic_batches_because_tcgen_lightmap,
+ r_stat_batch_dynamic_surfaces_because_tcgen_lightmap,
+ r_stat_batch_dynamic_vertices_because_tcgen_lightmap,
+ r_stat_batch_dynamic_triangles_because_tcgen_lightmap,
+ r_stat_batch_dynamic_batches_because_tcgen_vector,
+ r_stat_batch_dynamic_surfaces_because_tcgen_vector,
+ r_stat_batch_dynamic_vertices_because_tcgen_vector,
+ r_stat_batch_dynamic_triangles_because_tcgen_vector,
+ r_stat_batch_dynamic_batches_because_tcgen_environment,
+ r_stat_batch_dynamic_surfaces_because_tcgen_environment,
+ r_stat_batch_dynamic_vertices_because_tcgen_environment,
+ r_stat_batch_dynamic_triangles_because_tcgen_environment,
+ r_stat_batch_dynamic_batches_because_tcmod_turbulent,
+ r_stat_batch_dynamic_surfaces_because_tcmod_turbulent,
+ r_stat_batch_dynamic_vertices_because_tcmod_turbulent,
+ r_stat_batch_dynamic_triangles_because_tcmod_turbulent,
+ r_stat_batch_dynamic_batches_because_interleavedarrays,
+ r_stat_batch_dynamic_surfaces_because_interleavedarrays,
+ r_stat_batch_dynamic_vertices_because_interleavedarrays,
+ r_stat_batch_dynamic_triangles_because_interleavedarrays,
+ r_stat_batch_dynamic_batches_because_nogaps,
+ r_stat_batch_dynamic_surfaces_because_nogaps,
+ r_stat_batch_dynamic_vertices_because_nogaps,
+ r_stat_batch_dynamic_triangles_because_nogaps,
+ r_stat_batch_dynamic_batches_because_derived,
+ r_stat_batch_dynamic_surfaces_because_derived,
+ r_stat_batch_dynamic_vertices_because_derived,
+ r_stat_batch_dynamic_triangles_because_derived,
+ r_stat_count // size of array
+}
+r_stat_t;
+
// flags for rtlight rendering
#define LIGHTFLAG_NORMALMODE 1
#define LIGHTFLAG_REALTIMEMODE 2
// don't write-then-read csprogs.dat (useful for demo playback)
unsigned char *caughtcsprogsdata;
fs_offset_t caughtcsprogsdatasize;
+
+ int r_speeds_graph_length;
+ int r_speeds_graph_current;
+ int *r_speeds_graph_data;
+
+ // graph scales
+ int r_speeds_graph_datamin[r_stat_count];
+ int r_speeds_graph_datamax[r_stat_count];
}
client_static_t;
float RSurf_FogVertex(const vec3_t p);
float RSurf_FogPoint(const vec3_t p);
-typedef struct r_refdef_stats_s
-{
- int renders;
- int entities;
- int entities_surfaces;
- int entities_triangles;
- int world_leafs;
- int world_portals;
- int world_surfaces;
- int world_triangles;
- int lightmapupdates;
- int lightmapupdatepixels;
- int particles;
- int drawndecals;
- int totaldecals;
- int draws;
- int draws_vertices;
- int draws_elements;
- int lights;
- int lights_clears;
- int lights_scissored;
- int lights_lighttriangles;
- int lights_shadowtriangles;
- int lights_dynamicshadowtriangles;
- int bouncegrid_lights;
- int bouncegrid_particles;
- int bouncegrid_traces;
- int bouncegrid_hits;
- int bouncegrid_splats;
- int bouncegrid_bounces;
- int collisioncache_animated;
- int collisioncache_cached;
- int collisioncache_traced;
- int bloom;
- int bloom_copypixels;
- int bloom_drawpixels;
- int indexbufferuploadcount;
- int indexbufferuploadsize;
- int vertexbufferuploadcount;
- int vertexbufferuploadsize;
- int framedatacurrent;
- int framedatasize;
-}
-r_refdef_stats_t;
-
typedef enum r_viewport_type_e
{
R_VIEWPORTTYPE_ORTHO,
// rendering stats for r_speeds display
// (these are incremented in many places)
- r_refdef_stats_t stats;
+ int stats[r_stat_count];
}
r_refdef_t;
collision_cachedtrace_parameters_t params;
// all non-cached traces use the same index
if (!collision_cache.integer)
- r_refdef.stats.collisioncache_traced++;
+ r_refdef.stats[r_stat_photoncache_traced]++;
else
{
// cached trace lookup
)
continue;
// found a matching trace in the cache
- r_refdef.stats.collisioncache_cached++;
+ r_refdef.stats[r_stat_photoncache_cached]++;
cached->valid = true;
collision_cachedtrace_arrayused[index] = collision_cachedtrace_sequence;
return cached;
}
- r_refdef.stats.collisioncache_traced++;
+ r_refdef.stats[r_stat_photoncache_traced]++;
// find an unused cache entry
for (index = collision_cachedtrace_firstfree, range = collision_cachedtrace_max;index < range;index++)
if (collision_cachedtrace_arrayused[index] == 0)
void DrawQ_ResetClipArea(void);
// draw a line
void DrawQ_Line(float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags);
-// draw a lot of lines
-void DrawQ_Lines (float width, int numlines, const float *vertex3f, const float *color4f, int flags);
+// draw a lot of lines (call R_Mesh_PrepareVertices_Generic first)
+void DrawQ_Lines(float width, int numlines, int flags, qboolean hasalpha);
// draw a line loop
void DrawQ_LineLoop(drawqueuemesh_t *mesh, int flags);
// resets r_refdef.draw2dstage
bufferoffset3i = element3i_bufferoffset;
bufferobject3s = element3s_indexbuffer ? element3s_indexbuffer->bufferobject : 0;
bufferoffset3s = element3s_bufferoffset;
- r_refdef.stats.draws++;
- r_refdef.stats.draws_vertices += numvertices;
- r_refdef.stats.draws_elements += numelements;
+ r_refdef.stats[r_stat_draws]++;
+ r_refdef.stats[r_stat_draws_vertices] += numvertices;
+ r_refdef.stats[r_stat_draws_elements] += numelements;
if (gl_paranoid.integer)
{
unsigned int i;
return;
if (buffer->isindexbuffer)
{
- r_refdef.stats.indexbufferuploadcount++;
- r_refdef.stats.indexbufferuploadsize += size;
+ r_refdef.stats[r_stat_indexbufferuploadcount]++;
+ r_refdef.stats[r_stat_indexbufferuploadsize] += size;
}
else
{
- r_refdef.stats.vertexbufferuploadcount++;
- r_refdef.stats.vertexbufferuploadsize += size;
+ r_refdef.stats[r_stat_vertexbufferuploadcount]++;
+ r_refdef.stats[r_stat_vertexbufferuploadsize] += size;
}
switch(vid.renderpath)
{
}
}
-void DrawQ_Lines (float width, int numlines, const float *vertex3f, const float *color4f, int flags)
+void DrawQ_Lines (float width, int numlines, int flags, qboolean hasalpha)
{
- int i;
- qboolean hasalpha = false;
- for (i = 0;i < numlines*2;i++)
- if (color4f[i*4+3] < 1.0f)
- hasalpha = true;
-
_DrawQ_SetupAndProcessDrawFlag(flags, NULL, hasalpha ? 0.5f : 1.0f);
if(!r_draw2d.integer && !r_draw2d_force)
//qglLineWidth(width);CHECKGLERROR
CHECKGLERROR
- R_Mesh_PrepareVertices_Generic_Arrays(numlines*2, vertex3f, color4f, NULL);
qglDrawArrays(GL_LINES, 0, numlines*2);
CHECKGLERROR
break;
r_framedata_mem->current += size;
// count the usage for stats
- r_refdef.stats.framedatacurrent = max(r_refdef.stats.framedatacurrent, (int)r_framedata_mem->current);
- r_refdef.stats.framedatasize = max(r_refdef.stats.framedatasize, (int)r_framedata_mem->size);
+ r_refdef.stats[r_stat_framedatacurrent] = max(r_refdef.stats[r_stat_framedatacurrent], (int)r_framedata_mem->current);
+ r_refdef.stats[r_stat_framedatasize] = max(r_refdef.stats[r_stat_framedatasize], (int)r_framedata_mem->size);
return (void *)data;
}
// TODO: upload vertex3f buffer?
if (ent->animcache_vertexmesh)
{
+ r_refdef.stats[r_stat_animcache_vertexmesh_count] += 1;
+ r_refdef.stats[r_stat_animcache_vertexmesh_vertices] += numvertices;
+ r_refdef.stats[r_stat_animcache_vertexmesh_maxvertices] = max(r_refdef.stats[r_stat_animcache_vertexmesh_maxvertices], numvertices);
memcpy(ent->animcache_vertexmesh, ent->model->surfmesh.vertexmesh, sizeof(r_vertexmesh_t)*numvertices);
for (i = 0;i < numvertices;i++)
memcpy(ent->animcache_vertexmesh[i].vertex3f, ent->animcache_vertex3f + 3*i, sizeof(float[3]));
float *boneposerelative;
float m[12];
static float bonepose[256][12];
+ r_refdef.stats[r_stat_animcache_skeletal_count] += 1;
+ r_refdef.stats[r_stat_animcache_skeletal_bones] += model->num_bones;
+ r_refdef.stats[r_stat_animcache_skeletal_maxbones] = max(r_refdef.stats[r_stat_animcache_skeletal_maxbones], model->num_bones);
ent->animcache_skeletaltransform3x4 = (float *)R_FrameData_Alloc(sizeof(float[3][4]) * model->num_bones);
boneposerelative = ent->animcache_skeletaltransform3x4;
if (skeleton && !skeleton->relativetransforms)
}
model->AnimateVertices(model, ent->frameblend, ent->skeleton, NULL, wantnormals ? ent->animcache_normal3f : NULL, wanttangents ? ent->animcache_svector3f : NULL, wanttangents ? ent->animcache_tvector3f : NULL);
R_AnimCache_UpdateEntityMeshBuffers(ent, model->surfmesh.num_vertices);
+ r_refdef.stats[r_stat_animcache_shade_count] += 1;
+ r_refdef.stats[r_stat_animcache_shade_vertices] += numvertices;
+ r_refdef.stats[r_stat_animcache_shade_maxvertices] = max(r_refdef.stats[r_stat_animcache_shade_maxvertices], numvertices);
}
}
}
}
model->AnimateVertices(model, ent->frameblend, ent->skeleton, ent->animcache_vertex3f, ent->animcache_normal3f, ent->animcache_svector3f, ent->animcache_tvector3f);
R_AnimCache_UpdateEntityMeshBuffers(ent, model->surfmesh.num_vertices);
+ if (wantnormals || wanttangents)
+ {
+ r_refdef.stats[r_stat_animcache_shade_count] += 1;
+ r_refdef.stats[r_stat_animcache_shade_vertices] += numvertices;
+ r_refdef.stats[r_stat_animcache_shade_maxvertices] = max(r_refdef.stats[r_stat_animcache_shade_maxvertices], numvertices);
+ }
+ r_refdef.stats[r_stat_animcache_shape_count] += 1;
+ r_refdef.stats[r_stat_animcache_shape_vertices] += numvertices;
+ r_refdef.stats[r_stat_animcache_shape_maxvertices] = max(r_refdef.stats[r_stat_animcache_shape_maxvertices], numvertices);
}
return true;
}
if (!r_refdef.viewcache.entityvisible[i])
continue;
ent = r_refdef.scene.entities[i];
- r_refdef.stats.entities++;
+ r_refdef.stats[r_stat_entities]++;
/*
if (ent->model && !strncmp(ent->model->name, "models/proto_", 13))
{
rtexture_t *intex;
float colorscale = r_bloom_colorscale.value;
- r_refdef.stats.bloom++;
+ r_refdef.stats[r_stat_bloom]++;
#if 0
// this copy is unnecessary since it happens in R_BlendView already
if (!r_fb.fbo)
{
R_Mesh_CopyToTexture(r_fb.colortexture, 0, 0, r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
- r_refdef.stats.bloom_copypixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
#endif
// TODO: do boxfilter scale-down in shader?
R_SetupShader_Generic(r_fb.colortexture, NULL, GL_MODULATE, 1, false, true, true);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
- r_refdef.stats.bloom_drawpixels += r_fb.bloomwidth * r_fb.bloomheight;
+ r_refdef.stats[r_stat_bloom_drawpixels] += r_fb.bloomwidth * r_fb.bloomheight;
// we now have a properly scaled bloom image
if (!r_fb.bloomfbo[r_fb.bloomindex])
{
// copy it into the bloom texture
R_Mesh_CopyToTexture(r_fb.bloomtexture[r_fb.bloomindex], 0, 0, r_fb.bloomviewport.x, r_fb.bloomviewport.y, r_fb.bloomviewport.width, r_fb.bloomviewport.height);
- r_refdef.stats.bloom_copypixels += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
}
// multiply bloom image by itself as many times as desired
R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_fb.bloomtexcoord2f);
R_SetupShader_Generic(intex, NULL, GL_MODULATE, 1, false, true, false);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
- r_refdef.stats.bloom_drawpixels += r_fb.bloomwidth * r_fb.bloomheight;
+ r_refdef.stats[r_stat_bloom_drawpixels] += r_fb.bloomwidth * r_fb.bloomheight;
if (!r_fb.bloomfbo[r_fb.bloomindex])
{
// copy the darkened image to a texture
R_Mesh_CopyToTexture(r_fb.bloomtexture[r_fb.bloomindex], 0, 0, r_fb.bloomviewport.x, r_fb.bloomviewport.y, r_fb.bloomviewport.width, r_fb.bloomviewport.height);
- r_refdef.stats.bloom_copypixels += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
}
}
GL_Color(r, r, r, 1);
R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_fb.offsettexcoord2f);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
- r_refdef.stats.bloom_drawpixels += r_fb.bloomwidth * r_fb.bloomheight;
+ r_refdef.stats[r_stat_bloom_drawpixels] += r_fb.bloomwidth * r_fb.bloomheight;
GL_BlendFunc(GL_ONE, GL_ONE);
}
{
// copy the vertically or horizontally blurred bloom view to a texture
R_Mesh_CopyToTexture(r_fb.bloomtexture[r_fb.bloomindex], 0, 0, r_fb.bloomviewport.x, r_fb.bloomviewport.y, r_fb.bloomviewport.width, r_fb.bloomviewport.height);
- r_refdef.stats.bloom_copypixels += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_fb.bloomviewport.width * r_fb.bloomviewport.height;
}
}
}
if (!r_fb.fbo)
{
R_Mesh_CopyToTexture(r_fb.colortexture, 0, 0, r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
- r_refdef.stats.bloom_copypixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
if(!R_Stereo_Active() && (r_motionblur.value > 0 || r_damageblur.value > 0) && r_fb.ghosttexture)
}
R_SetupShader_Generic(r_fb.ghosttexture, NULL, GL_MODULATE, 1, false, true, true);
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
- r_refdef.stats.bloom_drawpixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
+ r_refdef.stats[r_stat_bloom_drawpixels] += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
}
// updates old view angles for next pass
// copy view into the ghost texture
R_Mesh_CopyToTexture(r_fb.ghosttexture, 0, 0, r_refdef.view.viewport.x, r_refdef.view.viewport.y, r_refdef.view.viewport.width, r_refdef.view.viewport.height);
- r_refdef.stats.bloom_copypixels += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
+ r_refdef.stats[r_stat_bloom_copypixels] += r_refdef.view.viewport.width * r_refdef.view.viewport.height;
r_fb.ghosttexture_valid = true;
}
}
break;
}
R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0);
- r_refdef.stats.bloom_drawpixels += r_refdef.view.width * r_refdef.view.height;
+ r_refdef.stats[r_stat_bloom_drawpixels] += r_refdef.view.width * r_refdef.view.height;
break;
case RENDERPATH_GL11:
case RENDERPATH_GL13:
if (r_timereport_active)
R_TimeReport("beginscene");
- r_refdef.stats.renders++;
+ r_refdef.stats[r_stat_renders]++;
R_UpdateFog();
int surfacefirstvertex;
int surfaceendvertex;
int surfacenumvertices;
+ int batchnumsurfaces = texturenumsurfaces;
int batchnumvertices;
int batchnumtriangles;
int needsupdate;
batchnumtriangles += surfacenumtriangles;
}
+ r_refdef.stats[r_stat_batch_batches]++;
+ if (gaps)
+ r_refdef.stats[r_stat_batch_withgaps]++;
+ r_refdef.stats[r_stat_batch_surfaces] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_vertices] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_triangles] += batchnumtriangles;
+
// we now know the vertex range used, and if there are any gaps in it
rsurface.batchfirstvertex = firstvertex;
rsurface.batchnumvertices = endvertex - firstvertex;
// a cvar to force the dynamic vertex path to be taken, for debugging
if (r_batch_debugdynamicvertexpath.integer)
+ {
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_cvar] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_cvar] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_cvar] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_cvar] += batchnumtriangles;
+ }
dynamicvertex = true;
+ }
// if there is a chance of animated vertex colors, it's a dynamic batch
if ((batchneed & (BATCHNEED_VERTEXMESH_VERTEXCOLOR | BATCHNEED_ARRAY_VERTEXCOLOR)) && texturesurfacelist[0]->lightmapinfo)
{
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_lightmapvertex] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_lightmapvertex] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_lightmapvertex] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_lightmapvertex] += batchnumtriangles;
+ }
dynamicvertex = true;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEXCOLOR;
}
case Q3DEFORM_NONE:
break;
case Q3DEFORM_AUTOSPRITE:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_autosprite] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_VECTOR | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR;
break;
case Q3DEFORM_AUTOSPRITE2:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_autosprite2] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_autosprite2] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_autosprite2] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_autosprite2] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR;
break;
case Q3DEFORM_NORMAL:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_normal] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_normal] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_normal] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_normal] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR;
case Q3DEFORM_WAVE:
if(!R_TestQ3WaveFunc(deform->wavefunc, deform->waveparms))
break; // if wavefunc is a nop, ignore this transform
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_wave] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_wave] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_wave] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_wave] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR;
break;
case Q3DEFORM_BULGE:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_bulge] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_bulge] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_bulge] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_bulge] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR;
case Q3DEFORM_MOVE:
if(!R_TestQ3WaveFunc(deform->wavefunc, deform->waveparms))
break; // if wavefunc is a nop, ignore this transform
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_deformvertexes_move] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_deformvertexes_move] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_deformvertexes_move] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_deformvertexes_move] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX;
needsupdate |= BATCHNEED_VERTEXMESH_VERTEX;
case Q3TCGEN_TEXTURE:
break;
case Q3TCGEN_LIGHTMAP:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_tcgen_lightmap] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_tcgen_lightmap] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_tcgen_lightmap] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_tcgen_lightmap] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_LIGHTMAP;
needsupdate |= BATCHNEED_VERTEXMESH_LIGHTMAP;
break;
case Q3TCGEN_VECTOR:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_tcgen_vector] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_tcgen_vector] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_tcgen_vector] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_tcgen_vector] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX;
needsupdate |= BATCHNEED_VERTEXMESH_TEXCOORD;
break;
case Q3TCGEN_ENVIRONMENT:
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_tcgen_environment] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_tcgen_environment] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_tcgen_environment] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_tcgen_environment] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL;
needsupdate |= BATCHNEED_VERTEXMESH_TEXCOORD;
}
if (rsurface.texture->tcmods[0].tcmod == Q3TCMOD_TURBULENT)
{
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_tcmod_turbulent] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_tcmod_turbulent] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_tcmod_turbulent] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_tcmod_turbulent] += batchnumtriangles;
+ }
dynamicvertex = true;
batchneed |= BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_TEXCOORD;
needsupdate |= BATCHNEED_VERTEXMESH_TEXCOORD;
if (!rsurface.modelvertexmesh && (batchneed & (BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | BATCHNEED_VERTEXMESH_VERTEXCOLOR | BATCHNEED_VERTEXMESH_TEXCOORD | BATCHNEED_VERTEXMESH_LIGHTMAP)))
{
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_interleavedarrays] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_interleavedarrays] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_interleavedarrays] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_interleavedarrays] += batchnumtriangles;
+ }
dynamicvertex = true;
needsupdate |= (batchneed & (BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | BATCHNEED_VERTEXMESH_VERTEXCOLOR | BATCHNEED_VERTEXMESH_TEXCOORD | BATCHNEED_VERTEXMESH_LIGHTMAP));
}
// firstvertex = 0 and endvertex = numvertices (no gaps, no firstvertex),
// we ensure this by treating the vertex batch as dynamic...
if ((batchneed & BATCHNEED_NOGAPS) && (gaps || firstvertex > 0))
+ {
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_nogaps] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_nogaps] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_nogaps] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_nogaps] += batchnumtriangles;
+ }
dynamicvertex = true;
+ }
if (dynamicvertex)
{
// if needsupdate, we have to do a dynamic vertex batch for sure
if (needsupdate & batchneed)
+ {
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_derived] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_derived] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_derived] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_derived] += batchnumtriangles;
+ }
dynamicvertex = true;
+ }
// see if we need to build vertexmesh from arrays
if (!rsurface.modelvertexmesh && (batchneed & (BATCHNEED_VERTEXMESH_VERTEX | BATCHNEED_VERTEXMESH_NORMAL | BATCHNEED_VERTEXMESH_VECTOR | BATCHNEED_VERTEXMESH_VERTEXCOLOR | BATCHNEED_VERTEXMESH_TEXCOORD | BATCHNEED_VERTEXMESH_LIGHTMAP)))
+ {
+ if (!dynamicvertex)
+ {
+ r_refdef.stats[r_stat_batch_dynamic_batches_because_interleavedarrays] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces_because_interleavedarrays] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices_because_interleavedarrays] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles_because_interleavedarrays] += batchnumtriangles;
+ }
dynamicvertex = true;
+ }
// if we're going to have to apply the skeletal transform manually, we need to batch the skeletal data
if (dynamicvertex && rsurface.entityskeletaltransform3x4)
// otherwise use the original static buffer with an appropriate offset
if (gaps)
{
+ r_refdef.stats[r_stat_batch_copytriangles_batches] += 1;
+ r_refdef.stats[r_stat_batch_copytriangles_surfaces] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_copytriangles_vertices] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_copytriangles_triangles] += batchnumtriangles;
if ((batchneed & BATCHNEED_ALLOWMULTIDRAW) && r_batch_multidraw.integer && batchnumtriangles >= r_batch_multidraw_mintriangles.integer)
{
rsurface.batchmultidraw = true;
rsurface.batchelement3s[i] = rsurface.batchelement3i[i];
}
}
+ else
+ {
+ r_refdef.stats[r_stat_batch_fast_batches] += 1;
+ r_refdef.stats[r_stat_batch_fast_surfaces] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_fast_vertices] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_fast_triangles] += batchnumtriangles;
+ }
return;
}
// we only directly handle separate array data in this case and then
// generate interleaved data if needed...
rsurface.batchgeneratedvertex = true;
+ r_refdef.stats[r_stat_batch_dynamic_batches] += 1;
+ r_refdef.stats[r_stat_batch_dynamic_surfaces] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamic_vertices] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamic_triangles] += batchnumtriangles;
// now copy the vertex data into a combined array and make an index array
// (this is what Quake3 does all the time)
float w[4];
float m[3][4], n[3][4];
float tp[3], ts[3], tt[3], tn[3];
+ r_refdef.stats[r_stat_batch_dynamicskeletal_batches] += 1;
+ r_refdef.stats[r_stat_batch_dynamicskeletal_surfaces] += batchnumsurfaces;
+ r_refdef.stats[r_stat_batch_dynamicskeletal_vertices] += batchnumvertices;
+ r_refdef.stats[r_stat_batch_dynamicskeletal_triangles] += batchnumtriangles;
si = rsurface.batchskeletalindex4ub;
sw = rsurface.batchskeletalweight4ub;
vp = rsurface.batchvertex3f;
if (numtris > 0)
{
- r_refdef.stats.drawndecals += numtris;
+ r_refdef.stats[r_stat_drawndecals] += numtris;
// now render the decals all at once
// (this assumes they all use one particle font texture!)
for (i = 0;i < r_refdef.scene.numentities;i++)
numdecals += r_refdef.scene.entities[i]->decalsystem.numdecals;
- r_refdef.stats.totaldecals += numdecals;
+ r_refdef.stats[r_stat_totaldecals] += numdecals;
if (r_showsurfaces.integer)
return;
// add to stats if desired
if (r_speeds.integer && !skysurfaces && !depthonly)
{
- r_refdef.stats.world_surfaces += numsurfacelist;
+ r_refdef.stats[r_stat_world_surfaces] += numsurfacelist;
for (j = 0;j < numsurfacelist;j++)
- r_refdef.stats.world_triangles += r_surfacelist[j]->num_triangles;
+ r_refdef.stats[r_stat_world_triangles] += r_surfacelist[j]->num_triangles;
}
rsurface.entity = NULL; // used only by R_GetCurrentTexture and RSurf_ActiveWorldEntity/RSurf_ActiveModelEntity
// add to stats if desired
if (r_speeds.integer && !skysurfaces && !depthonly)
{
- r_refdef.stats.entities_surfaces += numsurfacelist;
+ r_refdef.stats[r_stat_entities_surfaces] += numsurfacelist;
for (j = 0;j < numsurfacelist;j++)
- r_refdef.stats.entities_triangles += r_surfacelist[j]->num_triangles;
+ r_refdef.stats[r_stat_entities_triangles] += r_surfacelist[j]->num_triangles;
}
rsurface.entity = NULL; // used only by R_GetCurrentTexture and RSurf_ActiveWorldEntity/RSurf_ActiveModelEntity
size = smax*tmax;
size3 = size*3;
- r_refdef.stats.lightmapupdatepixels += size;
- r_refdef.stats.lightmapupdates++;
+ r_refdef.stats[r_stat_lightmapupdatepixels] += size;
+ r_refdef.stats[r_stat_lightmapupdates]++;
if (cl.buildlightmapmemorysize < size*sizeof(int[3]))
{
// if leaf is in current pvs and on the screen, mark its surfaces
if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
{
- r_refdef.stats.world_leafs++;
+ r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
if (leaf->numleafsurfaces)
for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++)
// if leaf is in current pvs and on the screen, mark its surfaces
if (!R_CullBox(leaf->mins, leaf->maxs))
{
- r_refdef.stats.world_leafs++;
+ r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
if (leaf->numleafsurfaces)
for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++)
// if leaf is in current pvs and on the screen, mark its surfaces
if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
{
- r_refdef.stats.world_leafs++;
+ r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
if (leaf->numleafsurfaces)
for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++)
continue;
if (leaf->clusterindex < 0)
continue;
- r_refdef.stats.world_leafs++;
+ r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[leaf - model->brush.data_leafs] = true;
// mark any surfaces bounding this leaf
if (leaf->numleafsurfaces)
// (the first two checks won't cause as many cache misses as the leaf checks)
for (p = leaf->portals;p;p = p->next)
{
- r_refdef.stats.world_portals++;
+ r_refdef.stats[r_stat_world_portals]++;
if (DotProduct(r_refdef.view.origin, p->plane.normal) < (p->plane.dist + 1)
&& !r_refdef.viewcache.world_leafvisible[p->past - model->brush.data_leafs]
&& CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, p->past->clusterindex)
continue;
if (!BoxesOverlap(lightmins, lightmaxs, surface->mins, surface->maxs))
continue;
- r_refdef.stats.lights_dynamicshadowtriangles += surface->num_triangles;
- r_refdef.stats.lights_shadowtriangles += surface->num_triangles;
+ r_refdef.stats[r_stat_lights_dynamicshadowtriangles] += surface->num_triangles;
+ r_refdef.stats[r_stat_lights_shadowtriangles] += surface->num_triangles;
batchsurfacelist[0] = surface;
batchnumsurfaces = 1;
while(++modelsurfacelistindex < modelnumsurfaces && batchnumsurfaces < RSURF_MAX_BATCHSURFACES)
break;
if (!BoxesOverlap(lightmins, lightmaxs, surface->mins, surface->maxs))
continue;
- r_refdef.stats.lights_dynamicshadowtriangles += surface->num_triangles;
- r_refdef.stats.lights_shadowtriangles += surface->num_triangles;
+ r_refdef.stats[r_stat_lights_dynamicshadowtriangles] += surface->num_triangles;
+ r_refdef.stats[r_stat_lights_shadowtriangles] += surface->num_triangles;
batchsurfacelist[batchnumsurfaces++] = surface;
}
--modelsurfacelistindex;
{
R_TimeReport("---");
Collision_Cache_NewFrame();
- R_TimeReport("collisioncache");
+ R_TimeReport("photoncache");
// decide the simulation time
if (cls.capturevideo.active)
{
tris = R_Shadow_ConstructShadowVolume_ZPass(numverts, numtris, elements, neighbors, invertex3f, &outverts, shadowelements, shadowvertex3f, projectorigin, projectdirection, projectdistance, nummarktris, marktris);
else
tris = R_Shadow_ConstructShadowVolume_ZFail(numverts, numtris, elements, neighbors, invertex3f, &outverts, shadowelements, shadowvertex3f, projectorigin, projectdirection, projectdistance, nummarktris, marktris);
- r_refdef.stats.lights_dynamicshadowtriangles += tris;
- r_refdef.stats.lights_shadowtriangles += tris;
+ r_refdef.stats[r_stat_lights_dynamicshadowtriangles] += tris;
+ r_refdef.stats[r_stat_lights_shadowtriangles] += tris;
if (r_shadow_rendermode == R_SHADOW_RENDERMODE_ZPASS_STENCIL)
{
// increment stencil if frontface is infront of depthbuffer
void R_Shadow_ClearStencil(void)
{
GL_Clear(GL_STENCIL_BUFFER_BIT, NULL, 1.0f, 128);
- r_refdef.stats.lights_clears++;
+ r_refdef.stats[r_stat_lights_clears]++;
}
void R_Shadow_RenderMode_StencilShadowVolumes(qboolean zpass)
radius = rtlight->radius * settings.lightradiusscale;
s = settings.particleintensity / shootparticles;
VectorScale(rtlight->photoncolor, s, baseshotcolor);
- r_refdef.stats.bouncegrid_lights++;
- r_refdef.stats.bouncegrid_particles += shootparticles;
+ r_refdef.stats[r_stat_bouncegrid_lights]++;
+ r_refdef.stats[r_stat_bouncegrid_particles] += shootparticles;
for (shotparticles = 0;shotparticles < shootparticles;shotparticles++)
{
if (settings.stablerandom > 0)
VectorMA(clipstart, radius, clipend, clipend);
for (bouncecount = 0;;bouncecount++)
{
- r_refdef.stats.bouncegrid_traces++;
+ r_refdef.stats[r_stat_bouncegrid_traces]++;
//r_refdef.scene.worldmodel->TraceLineAgainstSurfaces(r_refdef.scene.worldmodel, NULL, NULL, &cliptrace, clipstart, clipend, hitsupercontentsmask);
//r_refdef.scene.worldmodel->TraceLine(r_refdef.scene.worldmodel, NULL, NULL, &cliptrace2, clipstart, clipend, hitsupercontentsmask);
if (settings.staticmode)
VectorMA(clipstart, 0.5f, stepdelta, steppos);
for (step = 0;step < numsteps;step++)
{
- r_refdef.stats.bouncegrid_splats++;
+ r_refdef.stats[r_stat_bouncegrid_splats]++;
// figure out which texture pixel this is in
texlerp[1][0] = ((steppos[0] - mins[0]) * ispacing[0]) - 0.5f;
texlerp[1][1] = ((steppos[1] - mins[1]) * ispacing[1]) - 0.5f;
}
if (cliptrace.fraction >= 1.0f)
break;
- r_refdef.stats.bouncegrid_hits++;
+ r_refdef.stats[r_stat_bouncegrid_hits]++;
if (bouncecount >= maxbounce)
break;
// scale down shot color by bounce intensity and texture color (or 50% if no texture reported)
VectorMultiply(shotcolor, surfcolor, shotcolor);
if (VectorLength2(baseshotcolor) == 0.0f)
break;
- r_refdef.stats.bouncegrid_bounces++;
+ r_refdef.stats[r_stat_bouncegrid_bounces]++;
if (settings.bounceanglediffuse)
{
// random direction, primarily along plane normal
|| r_shadow_lightscissor[1] != r_refdef.view.viewport.y
|| r_shadow_lightscissor[2] != r_refdef.view.viewport.width
|| r_shadow_lightscissor[3] != r_refdef.view.viewport.height)
- r_refdef.stats.lights_scissored++;
+ r_refdef.stats[r_stat_lights_scissored]++;
return false;
}
{
if (!mesh->sidetotals[r_shadow_shadowmapside])
continue;
- r_refdef.stats.lights_shadowtriangles += mesh->sidetotals[r_shadow_shadowmapside];
+ r_refdef.stats[r_stat_lights_shadowtriangles] += mesh->sidetotals[r_shadow_shadowmapside];
if (mesh->vertex3fbuffer)
R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vertex3fbuffer);
else
mesh = zpass ? rsurface.rtlight->static_meshchain_shadow_zpass : rsurface.rtlight->static_meshchain_shadow_zfail;
for (;mesh;mesh = mesh->next)
{
- r_refdef.stats.lights_shadowtriangles += mesh->numtriangles;
+ r_refdef.stats[r_stat_lights_shadowtriangles] += mesh->numtriangles;
if (mesh->vertex3fbuffer)
R_Mesh_PrepareVertices_Vertex3f(mesh->numverts, mesh->vertex3f, mesh->vertex3fbuffer);
else
return;
// count this light in the r_speeds
- r_refdef.stats.lights++;
+ r_refdef.stats[r_stat_lights]++;
// flag it as worth drawing later
rtlight->draw = true;