mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
Add a bunch more statistics.
Now I know why sphere culling was a loss: 78% of all tested target portals were trimmed by ClipToSeparators (50% eventually clipped away entirely).
This commit is contained in:
parent
97da7fe31d
commit
77c858060d
3 changed files with 36 additions and 1 deletions
|
@ -110,6 +110,12 @@ typedef struct {
|
|||
int portaltest; ///< number of portals tested via separators
|
||||
int portalpass; ///< number of portals through which vis passes
|
||||
int portalcheck; ///< number of portal checks
|
||||
int targettested; ///< number of times target portal tested
|
||||
int targettrimmed; ///< number of times target portal trimmed
|
||||
int targetclipped; ///< number of times target portal clipped away
|
||||
int sourcetested; ///< number of times source portal tested
|
||||
int sourcetrimmed; ///< number of times source portal trimmed
|
||||
int sourceclipped; ///< number of times source portal clipped away
|
||||
int chains; ///< number of visits to clusters
|
||||
int mighttest; ///< amount mightsee is used for masked tests
|
||||
int vistest; ///< amount visbits is used for masked tests
|
||||
|
|
|
@ -355,17 +355,22 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
|||
}
|
||||
|
||||
thread->stats.portaltest++;
|
||||
thread->stats.targettested++;
|
||||
|
||||
if (options.level > 0) {
|
||||
// clip target to the image that would be formed by a laser
|
||||
// pointing from the edges of source passing though the corners of
|
||||
// pass
|
||||
winding_t *old = target;
|
||||
target = ClipToSeparators (thread, &stack, source, prevstack->pass,
|
||||
target, 0);
|
||||
if (!target) {
|
||||
thread->stats.targetclipped++;
|
||||
FreeWinding (source);
|
||||
continue;
|
||||
}
|
||||
if (target != old)
|
||||
thread->stats.targettrimmed++;
|
||||
}
|
||||
|
||||
if (options.level > 1) {
|
||||
|
@ -375,32 +380,45 @@ RecursiveClusterFlow (int clusternum, threaddata_t *thread, pstack_t *prevstack)
|
|||
// source shining past pass. eg, if source and pass are equilateral
|
||||
// triangles rotated 60 (or 180) degrees relative to each other,
|
||||
// parallel and in line, target will wind up being a hexagon.
|
||||
winding_t *old = target;
|
||||
target = ClipToSeparators (thread, &stack, prevstack->pass, source,
|
||||
target, 1);
|
||||
if (!target) {
|
||||
thread->stats.targetclipped++;
|
||||
FreeWinding (source);
|
||||
continue;
|
||||
}
|
||||
if (target != old)
|
||||
thread->stats.targettrimmed++;
|
||||
}
|
||||
|
||||
thread->stats.sourcetested++;
|
||||
// now do the same as for levels 1 and 2, but trimming source using
|
||||
// the trimmed target
|
||||
if (options.level > 2) {
|
||||
winding_t *old = source;
|
||||
source = ClipToSeparators (thread, &stack, target, prevstack->pass,
|
||||
source, 2);
|
||||
if (!source) {
|
||||
thread->stats.sourceclipped++;
|
||||
FreeWinding (target);
|
||||
continue;
|
||||
}
|
||||
if (source != old)
|
||||
thread->stats.sourcetrimmed++;
|
||||
}
|
||||
|
||||
if (options.level > 3) {
|
||||
winding_t *old = source;
|
||||
source = ClipToSeparators (thread, &stack, prevstack->pass, target,
|
||||
source, 3);
|
||||
if (!source) {
|
||||
thread->stats.sourceclipped++;
|
||||
FreeWinding (target);
|
||||
continue;
|
||||
}
|
||||
if (source != old)
|
||||
thread->stats.sourcetrimmed++;
|
||||
}
|
||||
|
||||
stack.source = source;
|
||||
|
|
|
@ -306,6 +306,12 @@ PortalCompleted (threaddata_t *thread, portal_t *completed)
|
|||
stats.portaltest += thread->stats.portaltest;
|
||||
stats.portalpass += thread->stats.portalpass;
|
||||
stats.portalcheck += thread->stats.portalcheck;
|
||||
stats.targettested += thread->stats.targettested;
|
||||
stats.targettrimmed += thread->stats.targettrimmed;
|
||||
stats.targetclipped += thread->stats.targetclipped;
|
||||
stats.sourcetested += thread->stats.sourcetested;
|
||||
stats.sourcetrimmed += thread->stats.sourcetrimmed;
|
||||
stats.sourceclipped += thread->stats.sourceclipped;
|
||||
stats.chains += thread->stats.chains;
|
||||
stats.mighttest += thread->stats.mighttest;
|
||||
stats.vistest += thread->stats.vistest;
|
||||
|
@ -562,7 +568,12 @@ CalcPortalVis (void)
|
|||
if (options.verbosity > 0) {
|
||||
printf ("portalcheck: %i portaltest: %i portalpass: %i\n",
|
||||
stats.portalcheck, stats.portaltest, stats.portalpass);
|
||||
printf ("vistest: %i mighttest: %i mightseeupdate: %i\n", stats.vistest, stats.mighttest, stats.mightseeupdate);
|
||||
printf ("target trimmed: %d clipped: %d tested: %d\n",
|
||||
stats.targettrimmed, stats.targetclipped, stats.targettested);
|
||||
printf ("source trimmed: %d clipped: %d tested: %d\n",
|
||||
stats.sourcetrimmed, stats.sourceclipped, stats.sourcetested);
|
||||
printf ("vistest: %i mighttest: %i mightseeupdate: %i\n",
|
||||
stats.vistest, stats.mighttest, stats.mightseeupdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue