Commit Graph

98 Commits

Author SHA1 Message Date
Eric Wasylishen 8ab9960ca0 lightpreview: don't crash when vis is run more than once 2023-12-24 17:22:01 -07:00
Eric Wasylishen 6351cc50e6 rename: vec_t -> double 2023-12-23 21:09:16 -07:00
Erika b45871efdb
vis algorithm improvement (2h42 -> 57m on ad_dm5) (#361)
* vis algorithm improvement, new commandline option -targetchecks

* vis: only calculate num_expected_targetchecks if needed

Fixes a bit of performance regression when -targetchecks was added, when running
with -targetchecks 0, apparently due to the cost of all the std::popcount's.

gmsp3v2.bsp, 32 threads:
18s (brushbsp branch 9388d43b1c)
21.1s (vis algorithm improvement)
18.2s (this commit)

* vis: default targetchecks to 0.5

gmsp3v2.bsp vis, 32 threads: 18.2s -> 10.6s

---------

Co-authored-by: Eric Wasylishen <ewasylishen@gmail.com>
2023-12-02 13:41:56 -07:00
Eric Wasylishen 64daf7ef75 vis: code style updates 2023-11-11 15:03:00 -07:00
Eric Wasylishen 189cc0586c vis:: restore warnings disabled in 74e1a0f6f0 2023-11-11 14:56:15 -07:00
Eric Wasylishen 5bcb2d4657 vis: remove MAX_PORTALS_ON_LEAF
reduces memory use a bit

gmsp3v2.bsp - 51.96s elapsed
2023-11-11 13:10:01 -07:00
Eric Wasylishen e3c6ace7ad vis: code style updates 2023-11-11 12:59:45 -07:00
Eric Wasylishen 57d5b22a95 vis: use size_t when accessing vis winding points
no perf change observed
2023-11-08 22:41:38 -07:00
Eric Wasylishen 54e7aadda7 vis: revert alloca() back to stack storage in ClipStackWinding
- the MAX_WINDING limit was already enforced
- on Windows, alloca() generates __chkstk calls which adds a bit of overhead

gmsp3v2 benchmark (32 threads, 2 runs per config):

before (with alloca): 58.8s, 59.1s
this commit (no alloca): 56.2s, 56.4s
2023-11-08 22:31:52 -07:00
Eric Wasylishen c9edf4ddaa vis: huge speedup from fixing false sharing with stat counters
gmsp3v2.bsp, 32 threads 3950x, 157s -> 61s
2023-11-08 00:05:08 -07:00
Eric Wasylishen e9532346c7 vis: partly fix perf regression of Oct 2021
- drops usage of winding_storage_hybrid
- makes pstack_t trivially default initializable again (like the C
  original)
- we weren't making use of the unlimited size of winding_storage_hybrid;
  the original vis already has an allowance for if a winding exceeds
  the fixed stack allocation size (24) and we were still applying that
  limit

before:

cmake-build-release\tests\tests.exe -r=xml -sf=*benchmark.cc
Testing started at 1:53 PM ...

|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|               45.15 |       22,149,002.06 |    0.1% |      0.01 | `create pstack_t`
|               47.04 |       21,256,429.80 |    0.1% |      0.01 | `create pstack_t + 1x AllocStackWinding`
|               48.28 |       20,710,594.32 |    0.2% |      0.01 | `create pstack_t + 2x AllocStackWinding`
|              128.52 |        7,780,603.30 |    0.3% |      0.01 | `setup + ClipStackWinding`

Benchmark from: https://www.quaddicted.com/tools/vis_benchmark

cmake-build-release\vis\vis.exe -nostate -nopercent gmsp3v2.bsp

153.31s elapsed

after:

cmake-build-release\tests\tests.exe -r=xml -sf=*benchmark.cc
Testing started at 1:46 PM ...

|               ns/op |                op/s |    err% |     total | benchmark
|--------------------:|--------------------:|--------:|----------:|:----------
|                1.64 |      610,528,630.06 |    0.3% |      0.01 | `create pstack_t`
|                3.29 |      303,895,535.45 |    0.6% |      0.01 | `create pstack_t + 1x AllocStackWinding`
|                5.20 |      192,172,148.84 |    0.2% |      0.01 | `create pstack_t + 2x AllocStackWinding`
|               66.84 |       14,960,818.66 |    1.0% |      0.01 | `setup + ClipStackWinding`

Benchmark from: https://www.quaddicted.com/tools/vis_benchmark

cmake-build-release\vis\vis.exe -nostate -nopercent gmsp3v2.bsp

141.42s elapsed
2023-11-05 13:58:36 -07:00
Eric Wasylishen 7608a78b44 style: use std::min/std::max/std::clamp and remove using 2023-08-07 15:42:29 -06:00
Eric Wasylishen f28522a077 vis: replace ffsl with std::countr_zero 2023-07-08 20:04:05 -06:00
Eric Wasylishen ed756bd602 common: add support for writing .rst documentation from settings 2023-04-16 14:55:43 -06:00
Eric Wasylishen e069d7b9b8 style: update settings api to follow current coding style 2023-04-16 11:55:38 -06:00
Eric Wasylishen eda6155844 cleanup: run ./clang-format-all.sh
clang-format version 15.0.7
2023-02-18 22:59:43 -07:00
Eric Wasylishen 8f79f6a972 vis: rename portal_t -> visportal_t
fixes symbol collision causing crashes on macOS
2022-12-21 01:03:03 -07:00
Eric Wasylishen 331dbfc20d vis: refactor output_group and advanced_group to avoid name clash with light 2022-12-08 21:32:39 -07:00
Eric Wasylishen 2ff9eda020 vis: refactor winding_t -> viswinding_t 2022-12-08 21:29:22 -07:00
Eric Wasylishen 642c4b589c tests: add vis_main() taking std::vector 2022-12-08 21:27:37 -07:00
Eric Wasylishen 2bd2515792 all: cleanup unused includes (Clion - detect not directly used) 2022-10-31 21:37:34 -06:00
Eric Wasylishen 35ffc00462 all: add LIGHT_/QBSP_/VIS_ prefixes to epsilons where necessary 2022-10-30 15:08:10 -06:00
Jonathan dcef4c6f9c allow vis to use .bsp instead of .map if passed .map at cmd line 2022-10-26 10:59:07 -04:00
Jonathan 075481a36f add -nocolor for TB, etc
fix crashes on vis and light for invalid options
fix TB and others not receiving output
2022-08-31 12:58:04 -04:00
Jonathan 335db1c0e4 move map_source_location to parser as parser_source_location since the locations actually come from there rather than from the map; now the parser keeps track of the location, so it's a bit easier to follow 2022-08-05 23:17:15 -04:00
Jonathan 26a18d5cc3 add logging::header/funcheader to easily and consistently print function or "active routine" headers
add OOP percent_clock wrapper to make printing percents easier, not used yet
2022-08-01 09:35:21 -04:00
Jonathan 1d8a0c1df3 clang-format pass 2022-07-28 06:14:54 -04:00
Eric Wasylishen b7969eee49 vis: rename options -> vis_options 2022-07-10 17:26:55 -06:00
Jonathan 1718512b09 remove unnecessary "uncompressed_q2" - can just be a single buffer now
another ptr->vector
2022-06-23 17:08:50 -04:00
Jonathan 3ac1d02624 fix missing noexcept
explicit initialization in some cases for vis winding_t's parameters
more vector
2022-06-23 17:02:18 -04:00
Jonathan 6f6185e1a3 use unique_ptr for leafbits allocations 2022-06-22 16:04:55 -04:00
Jonathan 3fbdfa2a36 allow removing the vis file if completed 2022-06-21 20:46:46 -04:00
Jonathan e366898796 re-introduce vis culling, mainly for Q2/surface lit maps
-novisapprox gone; replaced with -visapprox auto|none|vis|rays
2022-06-18 23:56:45 -04:00
Jonathan b54e72a184 re-implement the vis changes 2022-06-18 18:42:00 -04:00
Jonathan b21920841d revert some of the vis stuff, but re-implement it in a more working state 2022-06-18 18:36:09 -04:00
Jonathan dfa1282d40 simplify/c++-ize CompressRow code and related areas (less allocations overall) 2022-06-18 18:25:23 -04:00
Jonathan ac05a7ecf6 Revert "simplify/c++-ize CompressRow code and related areas (less allocations overall)"
This reverts commit 46aaa81ffd.
2022-06-18 17:29:07 -04:00
Jonathan 95cd13373a slight speed improvement 2022-06-17 15:10:20 -04:00
Jonathan b0dad9d01d save a few more cycles by just using raw pointers. it's a bit uglier, but this is hard to represent with shared_ptr and I think it was the wrong choice anyways since the ownership chain is difficult to represent in a shared_ptr here. 2022-06-17 14:56:17 -04:00
Jonathan c3bb07acaa ~33% speed improvement on vis by using already-allocated memory for the vis stack 2022-06-17 13:53:35 -04:00
Jonathan 46aaa81ffd simplify/c++-ize CompressRow code and related areas (less allocations overall) 2022-06-17 12:06:37 -04:00
Eric Wasylishen f6309a91cb vis: move .prt reader to common 2022-06-16 21:55:03 -06:00
Eric Wasylishen b173e18e51 vis: refactor LoadPortals 2022-06-16 21:39:22 -06:00
Jonathan e57633bbca the old Safe read/writes are gonedy now 2022-06-16 20:22:03 -04:00
Jonathan 812797f7ed enable lighting for warp/sky in Q2
simplify bitflag definitions
change nudging light warning to make more sense
another #define -> constexpr pass
2022-06-10 06:29:14 -04:00
Eric Wasylishen 0f2ea5333d move CompressRow/DecompressRow from vis to common 2022-05-24 21:01:41 -06:00
Jonathan f6ba5d77f9 allow recompilation of PHS from PVS data via -phsonly 2022-05-21 02:45:30 -04:00
Eric Wasylishen 49c78292dd testvis: stub setup 2022-05-15 15:52:54 -06:00
Eric Wasylishen 9c806d2d15 settings: don't call exit(0) in printHelp() as it's problematic for tests 2022-05-14 18:11:14 -06:00
Eric Wasylishen d763b2e336 build: support clang-cl 2022-05-10 21:39:58 -06:00