From eb325376b17d41c3b7a774c3059e40355cb7a878 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 28 Mar 2021 11:59:58 +0900 Subject: [PATCH] [qfvis] Collect base vis culling stats Specifically, just how many are culled by sphere and winding tests. --- tools/qfvis/include/vis.h | 2 ++ tools/qfvis/source/base-vis.c | 10 ++++++++-- tools/qfvis/source/qfvis.c | 9 ++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/qfvis/include/vis.h b/tools/qfvis/include/vis.h index ba4537b3d..2e32d0d1e 100644 --- a/tools/qfvis/include/vis.h +++ b/tools/qfvis/include/vis.h @@ -177,6 +177,8 @@ typedef struct threaddata_s { typedef struct { set_t *portalsee; + unsigned spherecull; ///< number of portals culled by sphere tests + unsigned windingcull; ///< number of portals culled by winding tests int clustersee; int id; } basethread_t; diff --git a/tools/qfvis/source/base-vis.c b/tools/qfvis/source/base-vis.c index 77f2b266b..55928af52 100644 --- a/tools/qfvis/source/base-vis.c +++ b/tools/qfvis/source/base-vis.c @@ -122,12 +122,14 @@ PortalBase (basethread_t *thread, portal_t *portal) if (tp_side < 0) { // The test portal definitely is entirely behind the portal's // plane. + thread->spherecull++; continue; // entirely behind } portal_side = test_sphere (&portal->sphere, &tp->plane); if (portal_side > 0) { // The portal definitely is entirely in front of the test // portal's plane. + thread->spherecull++; continue; // entirely in front } @@ -141,8 +143,10 @@ PortalBase (basethread_t *thread, portal_t *portal) if (d > ON_EPSILON) break; } - if (k == winding->numpoints) + if (k == winding->numpoints) { + thread->windingcull++; continue; // no points on front + } } if (portal_side == 0) { @@ -155,8 +159,10 @@ PortalBase (basethread_t *thread, portal_t *portal) if (d < -ON_EPSILON) break; } - if (k == winding->numpoints) + if (k == winding->numpoints) { + thread->windingcull++; continue; // no points on front + } } set_add (thread->portalsee, j); diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index b534e6252..8a4ea3c3f 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -75,6 +75,8 @@ options_t options; static threaddata_t main_thread; static visstat_t stats; int base_mightsee; +unsigned base_spherecull; +unsigned base_windingcull; static unsigned portal_count; unsigned numportals; @@ -530,6 +532,8 @@ BaseVisThread (void *_thread) } while (1); WRLOCK (stats_lock); + base_spherecull += data.spherecull; + base_windingcull += data.windingcull; base_mightsee += num_mightsee; UNLOCK (stats_lock); @@ -767,8 +771,11 @@ BasePortalVis (void) RunThreads (BaseVisThread); end = Sys_DoubleTime (); - if (options.verbosity >= 1) + if (options.verbosity >= 1) { printf ("base_mightsee: %d %gs\n", base_mightsee, end - start); + printf ("sphere cull: %u winding cull %u\n", + base_spherecull, base_windingcull); + } } static void