Commit Graph

84 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 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 37fc62ca0e vis: remove dead code from header 2023-11-11 12:29:30 -07:00
Eric Wasylishen f1bf0f546d add missing #pragma once's 2023-11-08 21:30:44 -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 e069d7b9b8 style: update settings api to follow current coding style 2023-04-16 11:55:38 -06:00
Eric Wasylishen b17633f746 cleanup: set PackConstructorInitializers: Never 2023-02-20 10:23:59 -07: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 35ffc00462 all: add LIGHT_/QBSP_/VIS_ prefixes to epsilons where necessary 2022-10-30 15:08:10 -06:00
Eric Wasylishen 636b376577 squash brushbsp-compilation-speedup branch
move function implementations out of headers
2022-10-21 18:00:58 -06:00
Eric Wasylishen 06a116670b winding_t: make non-copyable 2022-08-12 02:06:23 -06:00
Jonathan 53adb9fed5 split winding_base_t into two types, so that we can switch out the backing storage
default winding_t for the main polylib to use heap-based, exact-memory-usage-only, winding
2022-08-02 06:09:20 -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 ee596f3ff1 use vector for vis state
set autoclean default to true, make it invertable
2022-06-23 16:18:52 -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 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 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
Eric Wasylishen f6309a91cb vis: move .prt reader to common 2022-06-16 21:55:03 -06: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 8fe5d9d694 common: adjust formatting of usage line
-remove version hash as it's printed above
-rename `usage` variable to `programDescription`
2022-05-15 17:44:17 -06:00
Eric Wasylishen 49c78292dd testvis: stub setup 2022-05-15 15:52:54 -06:00
Eric Wasylishen 0c27c92e41 vis: fix 32-bit shift warning
"result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)"
2022-05-12 00:37:22 -06:00
Eric Wasylishen abc799554d build: fix all clang-cl warnings 2022-05-10 21:57:17 -06:00
Eric Wasylishen d763b2e336 build: support clang-cl 2022-05-10 21:39:58 -06:00
Jonathan c81e9ace28 remove old threading code entirely
add new parallel logging stuff in common/parallel which wraps parallel_for(_each) and provides automatic percentage indicator
fix issue with light not pulling in settings
move logging stuff into its own namespace and simplify
2022-03-01 10:28:59 -05:00
Jonathan df92d9ce12
Command line args systems (#2)
* cmd

* cmake change for tbb DLLs
add in test for double-hyphens

* cmd

* game version

* settings!

* bsp texture usage
decompile fix for q1bsp

* finish up the options for qbsp

* light finished?

* finish up the few missing bits

* move scalar/int32 up

* Run clang-format pass

* natvis for our mathlib
use slightly faster storage for winding
fix light tests

* allow dictionary to be a base type

* re-run style

* Remove cfg_static
Fix options summary

* natvis for lockable_value<T>

* last-ish pass?

* format

* forgot last few lockables
2022-02-27 00:01:57 -05:00
Jonathan 74253fd189 Fixed Unix/Clang compilation
Adjusted makefile to work with both clang and msvc on win32
Removed "WIN32", use the standard _WIN32 instead
Fixed bad VectorCopy's
Use qvec4b instead of special color_rgba type
qvec now follows built-in type procedures for handling operators; this means that (qvec3i + qvec3f) will now properly produce a float, as one would expect, instead of adding the float to the integers without casting to the common type.
2021-10-23 07:35:41 -04:00
Jonathan a21be0362c replace VectorCompare, CrossProduct, DotProduct
qv::dot handles inputs a bit more gracefully now
plane::distance_to for distance checks, and dplane has the fast version
2021-10-21 23:25:19 -04:00
Jonathan a7de4bdae2 Remove unused thingies
Use qplane3 where we can
2021-10-17 06:24:02 -04:00
Jonathan fd18fc154c Fix various warnings by testing a clang-cl compile 2021-10-12 14:39:15 -04:00
Jonathan a2edc09018 Resolve GCC wanting `template` before emplacements 2021-10-05 22:54:25 -04:00
Jonathan 52839d4e7f Run clang-format pass 2021-10-05 15:54:06 -04:00
Jonathan 9d828d2085 Structured texture data!
Move vis decompress/compress back to vis since phs is handled there now too
Fix missing textures in Q1BSP
Comment areaportaling for now
2021-09-30 11:33:04 -04:00
Jonathan a6f6cc2d15 qvec now has an empty default initializer, for speed purposes; fixed up places that relied on this behavior
simplified constructor for qvec(T...) that uses fold expressions
simplified rgba_miptex_t
fixed a lot of broken winding_base_t behavior
merged all winding types into winding_base_t
removed now-empty files
2021-09-27 20:44:15 -04:00
Jonathan 87d31e6d4f A lot of type-y stuff here:
- bsp store vectors now
- vis stored in a way that is compatible with both Q2 and Q1
- binary reading of stuff, so swapping is done at load time now
- vis cleanup, although there's still a lot of raw long modification that should get simplified later
2021-09-25 23:58:02 -04:00