From: havoc Date: Sun, 23 Oct 2005 06:36:05 +0000 (+0000) Subject: rewrote r_speeds stats code, now uses renderstats global structure rather than indivi... X-Git-Tag: xonotic-v0.1.0preview~4528 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ba778de98fff820dc678eaf1aeb64616feebf725;p=xonotic%2Fdarkplaces.git rewrote r_speeds stats code, now uses renderstats global structure rather than individual c_ global variables, this makes maintenance a lot easier, additionally changed all the stats to be more representitive of how the engine actually works (counting entities instead of models/bmodels/sprites separately, among other changes), condensed r_speeds stats display to fewer lines git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5756 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_particles.c b/cl_particles.c index f4c0f752..b9d3efc9 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -2086,7 +2086,7 @@ void R_DrawParticles (void) { if (p->type) { - c_particles++; + renderstats.particles++; if (DotProduct(p->org, r_viewforward) >= minparticledist || p->type->orientation == PARTICLE_BEAM) { if (p->type == particletype + pt_decal) diff --git a/cl_screen.c b/cl_screen.c index 19a03bcc..1d5b410f 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -519,43 +519,17 @@ void R_TimeReport_Start(void) { speedstringcount = 0; sprintf(r_speeds_string + strlen(r_speeds_string), "org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n", r_vieworigin[0], r_vieworigin[1], r_vieworigin[2], r_viewforward[0], r_viewforward[1], r_viewforward[2]); - sprintf(r_speeds_string + strlen(r_speeds_string), "world:%6i faces%6i nodes%6i leafs%6i dlitwalls\n", c_faces, c_nodes, c_leafs, c_light_polys); - sprintf(r_speeds_string + strlen(r_speeds_string), "%5i models%5i bmodels%5i sprites%6i particles%4i dlights\n", c_models, c_bmodels, c_sprites, c_particles, c_dlights); - sprintf(r_speeds_string + strlen(r_speeds_string), "%6i modeltris%6i meshs%6i meshtris\n", c_alias_polys, c_meshs, c_meshelements / 3); - sprintf(r_speeds_string + strlen(r_speeds_string), "bloom %s: %i copies (%i pixels) %i draws (%i pixels)\n", c_bloom ? "active" : "inactive", c_bloomcopies, c_bloomcopypixels, c_bloomdraws, c_bloomdrawpixels); - sprintf(r_speeds_string + strlen(r_speeds_string), "realtime lighting:%4i lights%4i clears%4i scissored\n", c_rt_lights, c_rt_clears, c_rt_scissored); - sprintf(r_speeds_string + strlen(r_speeds_string), "dynamic: %6i shadowmeshes%6i shadowtris%6i lightmeshes%6i lighttris\n", c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris); - sprintf(r_speeds_string + strlen(r_speeds_string), "precomputed: %6i shadowmeshes%6i shadowtris\n", c_rtcached_shadowmeshes, c_rtcached_shadowtris); - - c_alias_polys = 0; - c_light_polys = 0; - c_faces = 0; - c_nodes = 0; - c_leafs = 0; - c_models = 0; - c_bmodels = 0; - c_sprites = 0; - c_particles = 0; - c_dlights = 0; - c_meshs = 0; - c_meshelements = 0; - c_rt_lights = 0; - c_rt_clears = 0; - c_rt_scissored = 0; - c_rt_shadowmeshes = 0; - c_rt_shadowtris = 0; - c_rt_lightmeshes = 0; - c_rt_lighttris = 0; - c_rtcached_shadowmeshes = 0; - c_rtcached_shadowtris = 0; - c_bloom = 0; - c_bloomcopies = 0; - c_bloomcopypixels = 0; - c_bloomdraws = 0; - c_bloomdrawpixels = 0; + sprintf(r_speeds_string + strlen(r_speeds_string), "%5i entities%6i surfaces%6i triangles%5i leafs%5i portals%6i particles\n", renderstats.entities, renderstats.entities_surfaces, renderstats.entities_triangles, renderstats.world_leafs, renderstats.world_portals, renderstats.particles); + sprintf(r_speeds_string + strlen(r_speeds_string), "%4i lights%4i clears%4i scissored%7i light%7i shadow%i7 dynamic\n", renderstats.lights, renderstats.lights_clears, renderstats.lights_scissored, renderstats.lights_lighttriangles, renderstats.lights_shadowtriangles, renderstats.lights_dynamicshadowtriangles); + if (renderstats.bloom) + sprintf(r_speeds_string + strlen(r_speeds_string), "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n", renderstats.meshes, renderstats.meshes_elements / 3, renderstats.bloom_copypixels, renderstats.bloom_drawpixels); + else + sprintf(r_speeds_string + strlen(r_speeds_string), "rendered%6i meshes%8i triangles\n", renderstats.meshes, renderstats.meshes_elements / 3); r_timereport_start = Sys_DoubleTime(); } + + memset(&renderstats, 0, sizeof(renderstats)); } void R_TimeReport_End(void) diff --git a/gl_backend.c b/gl_backend.c index 57372862..ee4c944e 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -886,8 +886,8 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int * R_Mesh_Draw_ShowTris(firstvertex, numvertices, numtriangles, elements); return; } - c_meshs++; - c_meshelements += numelements; + renderstats.meshes++; + renderstats.meshes_elements += numelements; if (gl_paranoid.integer) { unsigned int i, j, size; diff --git a/gl_rmain.c b/gl_rmain.c index 8525e1d2..fc65bbc3 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -30,7 +30,7 @@ mplane_t frustum[5]; matrix4x4_t r_identitymatrix; -int c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights, c_meshs, c_meshelements, c_rt_lights, c_rt_clears, c_rt_scissored, c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris, c_rtcached_shadowmeshes, c_rtcached_shadowtris, c_bloom, c_bloomcopies, c_bloomcopypixels, c_bloomdraws, c_bloomdrawpixels; +renderstats_t renderstats; // true during envmap command capture qboolean envmap; @@ -650,6 +650,7 @@ void R_DrawModels(void) ent = r_refdef.entities[i]; if (ent->visframe == r_framecount) { + renderstats.entities++; if (ent->model && ent->model->Draw != NULL) ent->model->Draw(ent); else @@ -714,7 +715,7 @@ static void R_BlendView(void) { int screenwidth, screenheight, bloomwidth, bloomheight, x, dobloomblend, range; float xoffset, yoffset, r; - c_bloom++; + renderstats.bloom++; // set the (poorly named) screenwidth and screenheight variables to // a power of 2 at least as large as the screen, these will define the // size of the texture to allocate @@ -757,8 +758,7 @@ static void R_BlendView(void) // copy view into the full resolution screen image texture GL_ActiveTexture(0); qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height); - c_bloomcopies++; - c_bloomcopypixels += r_view_width * r_view_height; + renderstats.bloom_copypixels += r_view_width * r_view_height; // now scale it down to the bloom size and raise to a power of itself // to darken it (this leaves the really bright stuff bright, and // everything else becomes very dark) @@ -767,15 +767,13 @@ static void R_BlendView(void) GL_BlendFunc(GL_ONE, GL_ZERO); GL_Color(1, 1, 1, 1); R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += bloomwidth * bloomheight; + renderstats.bloom_drawpixels += bloomwidth * bloomheight; // render multiple times with a multiply blendfunc to raise to a power GL_BlendFunc(GL_DST_COLOR, GL_ZERO); for (x = 1;x < r_bloom_power.integer;x++) { R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += bloomwidth * bloomheight; + renderstats.bloom_drawpixels += bloomwidth * bloomheight; } // we now have a darkened bloom image in the framebuffer, copy it into // the bloom image texture for more processing @@ -786,8 +784,7 @@ static void R_BlendView(void) R_Mesh_State(&m); GL_ActiveTexture(0); qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight); - c_bloomcopies++; - c_bloomcopypixels += bloomwidth * bloomheight; + renderstats.bloom_copypixels += bloomwidth * bloomheight; // blend on at multiple vertical offsets to achieve a vertical blur // TODO: do offset blends using GLSL range = r_bloom_blur.integer * bloomwidth / 320; @@ -813,15 +810,13 @@ static void R_BlendView(void) continue; GL_Color(r, r, r, 1); R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += bloomwidth * bloomheight; + renderstats.bloom_drawpixels += bloomwidth * bloomheight; GL_BlendFunc(GL_ONE, GL_ONE); } // copy the vertically blurred bloom view to a texture GL_ActiveTexture(0); qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight); - c_bloomcopies++; - c_bloomcopypixels += bloomwidth * bloomheight; + renderstats.bloom_copypixels += bloomwidth * bloomheight; // blend the vertically blurred image at multiple offsets horizontally // to finish the blur effect // TODO: do offset blends using GLSL @@ -848,15 +843,13 @@ static void R_BlendView(void) continue; GL_Color(r, r, r, 1); R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += bloomwidth * bloomheight; + renderstats.bloom_drawpixels += bloomwidth * bloomheight; GL_BlendFunc(GL_ONE, GL_ONE); } // copy the blurred bloom view to a texture GL_ActiveTexture(0); qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight); - c_bloomcopies++; - c_bloomcopypixels += bloomwidth * bloomheight; + renderstats.bloom_copypixels += bloomwidth * bloomheight; // go back to full view area qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height); // put the original screen image back in place and blend the bloom @@ -883,8 +876,7 @@ static void R_BlendView(void) GL_BlendFunc(GL_ONE, GL_ZERO); GL_Color(1,1,1,1); R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += r_view_width * r_view_height; + renderstats.bloom_drawpixels += r_view_width * r_view_height; // now blend on the bloom texture if multipass if (dobloomblend) { @@ -896,8 +888,7 @@ static void R_BlendView(void) GL_BlendFunc(GL_ONE, GL_ONE); GL_Color(1,1,1,1); R_Mesh_Draw(0, 4, 2, polygonelements); - c_bloomdraws++; - c_bloomdrawpixels += r_view_width * r_view_height; + renderstats.bloom_drawpixels += r_view_width * r_view_height; } } if (r_refdef.viewblend[3] >= 0.01f) @@ -1383,8 +1374,6 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t) int s = ent->skinnum; if ((unsigned int)s >= (unsigned int)model->numskins) s = 0; - if (s >= 1) - c_models++; if (model->skinscenes) { if (model->skinscenes[s].framecount > 1) @@ -1753,7 +1742,7 @@ static void R_DrawTextureSurfaceList(const entity_render_t *ent, texture_t *text rmeshstate_t m; if (texture->currentmaterialflags & MATERIALFLAG_NODRAW) return; - c_faces += texturenumsurfaces; + renderstats.entities_surfaces += texturenumsurfaces; // FIXME: identify models using a better check than ent->model->brush.shadowmesh lightmode = ((ent->effects & EF_FULLBRIGHT) || ent->model->brush.shadowmesh) ? 0 : 2; GL_DepthTest(!(texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST)); @@ -2055,6 +2044,7 @@ extern void R_BuildLightMap(const entity_render_t *ent, msurface_t *surface); void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces) { int i, j, f, flagsmask; + int counttriangles = 0; msurface_t *surface, **surfacechain; texture_t *t, *texture; model_t *model = ent->model; @@ -2112,6 +2102,7 @@ void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces) R_BuildLightMap(ent, surface); // add face to draw list surfacelist[numsurfacelist++] = surface; + counttriangles += surface->num_triangles; if (numsurfacelist >= maxsurfacelist) { R_QueueTextureSurfaceList(ent, texture, numsurfacelist, surfacelist, modelorg); @@ -2142,6 +2133,7 @@ void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces) R_BuildLightMap(ent, surface); // add face to draw list surfacelist[numsurfacelist++] = surface; + counttriangles += surface->num_triangles; if (numsurfacelist >= maxsurfacelist) { R_QueueTextureSurfaceList(ent, texture, numsurfacelist, surfacelist, modelorg); @@ -2152,5 +2144,7 @@ void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces) } if (numsurfacelist) R_QueueTextureSurfaceList(ent, texture, numsurfacelist, surfacelist, modelorg); + if (!r_showtrispass) + renderstats.entities_triangles += counttriangles; } diff --git a/gl_rsurf.c b/gl_rsurf.c index bec9823d..f6573fb8 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -421,7 +421,7 @@ void R_WorldVisibility(void) // if leaf is in current pvs and on the screen, mark its surfaces if (CHECKPVSBIT(r_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs)) { - c_leafs++; + renderstats.world_leafs++; r_worldleafvisible[j] = true; if (leaf->numleafsurfaces) for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++) @@ -443,7 +443,7 @@ void R_WorldVisibility(void) leafstackpos = 1; while (leafstackpos) { - c_leafs++; + renderstats.world_leafs++; leaf = leafstack[--leafstackpos]; r_worldleafvisible[leaf - model->brush.data_leafs] = true; // mark any surfaces bounding this leaf @@ -458,8 +458,11 @@ void R_WorldVisibility(void) // and the leaf is visible in the pvs // (the first two checks won't cause as many cache misses as the leaf checks) for (p = leaf->portals;p;p = p->next) + { + renderstats.world_portals++; if (DotProduct(r_vieworigin, p->plane.normal) < (p->plane.dist + 1) && !R_CullBox(p->mins, p->maxs) && !r_worldleafvisible[p->past - model->brush.data_leafs] && CHECKPVSBIT(r_pvsbits, p->past->clusterindex)) leafstack[leafstackpos++] = p->past; + } } } @@ -477,15 +480,14 @@ void R_Q1BSP_DrawSky(entity_render_t *ent) void R_Q1BSP_Draw(entity_render_t *ent) { - if (ent->model == NULL) + model_t *model = ent->model; + if (model == NULL) return; - c_bmodels++; if (r_drawcollisionbrushes.integer < 2) R_DrawSurfaces(ent, false); - if (r_drawcollisionbrushes.integer >= 1 && ent->model->brush.num_brushes) + if (r_drawcollisionbrushes.integer >= 1 && model->brush.num_brushes) { int i; - model_t *model = ent->model; msurface_t *surface; q3mbrush_t *brush; R_Mesh_Matrix(&ent->matrix); @@ -764,6 +766,7 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, float *lightcolorbase, float *light if ((ent == r_refdef.worldentity && !r_worldsurfacevisible[surfacelist[surfacelistindex]])) continue; surface = model->data_surfaces + surfacelist[surfacelistindex]; + renderstats.lights_lighttriangles += surface->num_triangles; if (tex != surface->texture) { if (batchnumsurfaces > 0) diff --git a/r_light.c b/r_light.c index 66f98b47..13858976 100644 --- a/r_light.c +++ b/r_light.c @@ -108,7 +108,6 @@ void R_UpdateLights(void) } r_numdlights = 0; - c_dlights = 0; if (!r_dynamic.integer || !cl_dlights) return; @@ -121,7 +120,6 @@ void R_UpdateLights(void) R_RTLight_UpdateFromDLight(&cl_dlights[i].rtlight, &cl_dlights[i], false); // FIXME: use pointer instead of copy r_dlight[r_numdlights++] = cl_dlights[i]; - c_dlights++; // count every dlight in use } } } diff --git a/r_shadow.c b/r_shadow.c index 79725fde..24a56aa9 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -923,6 +923,7 @@ void R_Shadow_VolumeFromList(int numverts, int numtris, const float *invertex3f, if (maxshadowelements < nummarktris * 24) R_Shadow_ResizeShadowElements((nummarktris + 256) * 24); tris = R_Shadow_ConstructShadowVolume(numverts, numtris, elements, neighbors, invertex3f, &outverts, shadowelements, varray_vertex3f2, projectorigin, projectdistance, nummarktris, marktris); + renderstats.lights_dynamicshadowtriangles += tris; R_Shadow_RenderVolume(outverts, tris, varray_vertex3f2, shadowelements); } @@ -972,6 +973,7 @@ void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *verte Mod_ShadowMesh_AddMesh(r_shadow_mempool, r_shadow_compilingrtlight->static_meshchain_shadow, NULL, NULL, NULL, vertex3f, NULL, NULL, NULL, NULL, numtriangles, element3i); return; } + renderstats.lights_shadowtriangles += numtriangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = vertex3f; R_Mesh_State(&m); @@ -982,15 +984,11 @@ void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *verte qglCullFace(GL_BACK); // quake is backwards, this culls front faces qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP); R_Mesh_Draw(0, numvertices, numtriangles, element3i); - c_rt_shadowmeshes++; - c_rt_shadowtris += numtriangles; // increment stencil if frontface is behind depthbuffer qglCullFace(GL_FRONT); // quake is backwards, this culls back faces qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP); } R_Mesh_Draw(0, numvertices, numtriangles, element3i); - c_rt_shadowmeshes++; - c_rt_shadowtris += numtriangles; GL_LockArrays(0, 0); } @@ -1173,7 +1171,7 @@ void R_Shadow_Stage_StencilShadowVolumes(void) qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); } GL_Clear(GL_STENCIL_BUFFER_BIT); - c_rt_clears++; + renderstats.lights_clears++; } void R_Shadow_Stage_Lighting(int stenciltest) @@ -1411,7 +1409,7 @@ qboolean R_Shadow_ScissorForBBox(const float *mins, const float *maxs) GL_Scissor(ix1, vid.height - iy2, ix2 - ix1, iy2 - iy1); //qglScissor(ix1, iy1, ix2 - ix1, iy2 - iy1); //qglEnable(GL_SCISSOR_TEST); - c_rt_scissored++; + renderstats.lights_scissored++; return false; } @@ -1659,8 +1657,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_GLSL(const entity_render_t *en R_Mesh_TexCoordPointer(3, 3, rsurface_normal3f); GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; GL_LockArrays(0, 0); } } @@ -1843,8 +1839,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -1873,8 +1867,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en { GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; } GL_LockArrays(0, 0); } @@ -1916,8 +1908,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -1956,8 +1946,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -1974,8 +1962,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2014,8 +2000,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2067,8 +2051,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2115,8 +2097,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2133,8 +2113,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2163,8 +2141,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en { GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; } GL_LockArrays(0, 0); } @@ -2194,8 +2170,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2208,11 +2182,7 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en // 0.25 * 0.25 = 0.0625 (this is another pass) // 0.0625 * 0.0625 = 0.00390625 (this is another pass) R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; GL_LockArrays(0, 0); memset(&m, 0, sizeof(m)); @@ -2230,8 +2200,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2270,8 +2238,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2284,11 +2250,7 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en // 0.25 * 0.25 = 0.0625 (this is another pass) // 0.0625 * 0.0625 = 0.00390625 (this is another pass) R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; GL_LockArrays(0, 0); memset(&m, 0, sizeof(m)); @@ -2325,8 +2287,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2339,11 +2299,7 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en // 0.25 * 0.25 = 0.0625 (this is another pass) // 0.0625 * 0.0625 = 0.00390625 (this is another pass) R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; GL_LockArrays(0, 0); memset(&m, 0, sizeof(m)); @@ -2369,8 +2325,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; memset(&m, 0, sizeof(m)); m.pointer_vertex = rsurface_vertex3f; @@ -2398,8 +2352,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Dot3(const entity_render_t *en { GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; } GL_LockArrays(0, 0); } @@ -2500,8 +2452,6 @@ static void R_Shadow_RenderSurfacesLighting_Light_Vertex(const entity_render_t * GL_LockArrays(surface->num_firstvertex, surface->num_vertices); R_Mesh_Draw(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, elements); GL_LockArrays(0, 0); - c_rt_lightmeshes++; - c_rt_lighttris += surface->num_triangles; } } } @@ -2684,6 +2634,7 @@ void R_Shadow_DrawEntityShadow(entity_render_t *ent, rtlight_t *rtlight, int num R_Mesh_Matrix(&ent->matrix); for (mesh = rtlight->static_meshchain_shadow;mesh;mesh = mesh->next) { + renderstats.lights_shadowtriangles += mesh->numtriangles; R_Mesh_VertexPointer(mesh->vertex3f); GL_LockArrays(0, mesh->numverts); if (r_shadowstage == R_SHADOWSTAGE_STENCIL) @@ -2692,15 +2643,11 @@ void R_Shadow_DrawEntityShadow(entity_render_t *ent, rtlight_t *rtlight, int num qglCullFace(GL_BACK); // quake is backwards, this culls front faces qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP); R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i); - c_rtcached_shadowmeshes++; - c_rtcached_shadowtris += mesh->numtriangles; // increment stencil if frontface is behind depthbuffer qglCullFace(GL_FRONT); // quake is backwards, this culls back faces qglStencilOp(GL_KEEP, GL_INCR, GL_KEEP); } R_Mesh_Draw(0, mesh->numverts, mesh->numtriangles, mesh->element3i); - c_rtcached_shadowmeshes++; - c_rtcached_shadowtris += mesh->numtriangles; GL_LockArrays(0, 0); } } @@ -2876,7 +2823,7 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible) return; R_Shadow_Stage_ActiveLight(rtlight); - c_rt_lights++; + renderstats.lights++; usestencil = false; if (numshadowentities && (!visible || r_shadow_visiblelighting.integer == 1) && gl_stencil && rtlight->shadow && (rtlight->isstatic ? r_rtworldshadows : r_rtdlightshadows)) diff --git a/r_sprites.c b/r_sprites.c index ccc9bb0d..1a19d36c 100644 --- a/r_sprites.c +++ b/r_sprites.c @@ -148,8 +148,6 @@ void R_Model_Sprite_Draw(entity_render_t *ent) if (ent->frameblend[0].frame < 0) return; - c_sprites++; - R_MeshQueue_AddTransparent(ent->effects & EF_NODEPTHTEST ? r_vieworigin : ent->origin, R_DrawSpriteModelCallback, ent, 0); } diff --git a/render.h b/render.h index ed658f85..eb8795cf 100644 --- a/render.h +++ b/render.h @@ -111,7 +111,29 @@ void R_Mesh_AddBrushMeshFromPlanes(rmesh_t *mesh, int numplanes, mplane_t *plane extern int r_framecount; extern mplane_t frustum[5]; -extern int c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights, c_meshs, c_meshelements, c_rt_lights, c_rt_clears, c_rt_scissored, c_rt_shadowmeshes, c_rt_shadowtris, c_rt_lightmeshes, c_rt_lighttris, c_rtcached_shadowmeshes, c_rtcached_shadowtris, c_bloom, c_bloomcopies, c_bloomcopypixels, c_bloomdraws, c_bloomdrawpixels; +typedef struct renderstats_s +{ + int entities; + int entities_surfaces; + int entities_triangles; + int world_leafs; + int world_portals; + int particles; + int meshes; + int meshes_elements; + int lights; + int lights_clears; + int lights_scissored; + int lights_lighttriangles; + int lights_shadowtriangles; + int lights_dynamicshadowtriangles; + int bloom; + int bloom_copypixels; + int bloom_drawpixels; +} +renderstats_t; + +extern renderstats_t renderstats; // brightness of world lightmaps and related lighting // (often reduced when world rtlights are enabled)