[qfvis] Collect base vis culling stats

Specifically, just how many are culled by sphere and winding tests.
This commit is contained in:
Bill Currie 2021-03-28 11:59:58 +09:00
parent 29e029c792
commit eb325376b1
3 changed files with 18 additions and 3 deletions

View file

@ -177,6 +177,8 @@ typedef struct threaddata_s {
typedef struct { typedef struct {
set_t *portalsee; set_t *portalsee;
unsigned spherecull; ///< number of portals culled by sphere tests
unsigned windingcull; ///< number of portals culled by winding tests
int clustersee; int clustersee;
int id; int id;
} basethread_t; } basethread_t;

View file

@ -122,12 +122,14 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (tp_side < 0) { if (tp_side < 0) {
// The test portal definitely is entirely behind the portal's // The test portal definitely is entirely behind the portal's
// plane. // plane.
thread->spherecull++;
continue; // entirely behind continue; // entirely behind
} }
portal_side = test_sphere (&portal->sphere, &tp->plane); portal_side = test_sphere (&portal->sphere, &tp->plane);
if (portal_side > 0) { if (portal_side > 0) {
// The portal definitely is entirely in front of the test // The portal definitely is entirely in front of the test
// portal's plane. // portal's plane.
thread->spherecull++;
continue; // entirely in front continue; // entirely in front
} }
@ -141,8 +143,10 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (d > ON_EPSILON) if (d > ON_EPSILON)
break; break;
} }
if (k == winding->numpoints) if (k == winding->numpoints) {
thread->windingcull++;
continue; // no points on front continue; // no points on front
}
} }
if (portal_side == 0) { if (portal_side == 0) {
@ -155,8 +159,10 @@ PortalBase (basethread_t *thread, portal_t *portal)
if (d < -ON_EPSILON) if (d < -ON_EPSILON)
break; break;
} }
if (k == winding->numpoints) if (k == winding->numpoints) {
thread->windingcull++;
continue; // no points on front continue; // no points on front
}
} }
set_add (thread->portalsee, j); set_add (thread->portalsee, j);

View file

@ -75,6 +75,8 @@ options_t options;
static threaddata_t main_thread; static threaddata_t main_thread;
static visstat_t stats; static visstat_t stats;
int base_mightsee; int base_mightsee;
unsigned base_spherecull;
unsigned base_windingcull;
static unsigned portal_count; static unsigned portal_count;
unsigned numportals; unsigned numportals;
@ -530,6 +532,8 @@ BaseVisThread (void *_thread)
} while (1); } while (1);
WRLOCK (stats_lock); WRLOCK (stats_lock);
base_spherecull += data.spherecull;
base_windingcull += data.windingcull;
base_mightsee += num_mightsee; base_mightsee += num_mightsee;
UNLOCK (stats_lock); UNLOCK (stats_lock);
@ -767,8 +771,11 @@ BasePortalVis (void)
RunThreads (BaseVisThread); RunThreads (BaseVisThread);
end = Sys_DoubleTime (); end = Sys_DoubleTime ();
if (options.verbosity >= 1) if (options.verbosity >= 1) {
printf ("base_mightsee: %d %gs\n", base_mightsee, end - start); printf ("base_mightsee: %d %gs\n", base_mightsee, end - start);
printf ("sphere cull: %u winding cull %u\n",
base_spherecull, base_windingcull);
}
} }
static void static void