Commit graph

11604 commits

Author SHA1 Message Date
Bill Currie
9e2c474d38 [model] Ensure the pvs is not inverted
Mod_DecompressVis_set (via Mod_LeafPVS_set) can be used to recycle pvs
sets, but the set may have been set to everything at some stage, which
is implemented by inverting the set (making the set infinite) and having
1-bits remove elements from the set. This is most definitely not wanted
for pvs :)

Currently undecided what to do about Mod_DecompressVis_mix, thus the
fixme.

Fixes the flickering lights in any map where the camera is out of the
map for a single frame (eg, start.bsp, The Catacombs (hipnotic, hip2m3)).
2021-07-27 17:54:50 +09:00
Bill Currie
1f57f81a20 [qw] Use set_count to count the pvs/phs leafs 2021-07-27 14:01:08 +09:00
Bill Currie
163d147044 [util] Give set_count a >8x speed boost
I knew counting bits individually was slow, but it never really mattered
until now. However, I didn't expect such a dramatic boost just by going
to mapping bytes to bit counts. 16-bit words would be faster still, but
the 64kB lookup table would probably start hurting cache performance,
and 32-bit words (4GB table) definitely would ruin the cache. The
universe isn't big enough for 64-bits :)
2021-07-27 13:54:22 +09:00
Bill Currie
50740c1014 [model] Remove the confusion about numleafs
The fact that numleafs did not include leaf 0 actually caused in many
places due to never being sure whether to add 1. Hopefully this fixes
some of the confusion. (and that comment in sv_init didn't last long :P)
2021-07-27 12:38:08 +09:00
Bill Currie
49c3dacbbc [util] Rename set_size to set_count
After seeing set_size and thinking it redundant (thought it returned the
capacity of the set until I checked), I realized set_count would be a
much better name (set_count (node->successors) in qfcc does make much
more sense).
2021-07-27 11:52:21 +09:00
Bill Currie
05fa0538ab [qw] Count leafs correctly for PHS
This fixes some out-by-one bugs caused by there being an obo bug in the
original SV_CalcPHS: space was being allocated for numleafs leafs, but
numleafs does not count the world-surrounding solid leaf 0, but
SV_CalcPHS generates pvs and phs data (just the "everything" set) for
leaf 0, which is later used for broadcasts and the like.
2021-07-27 11:34:17 +09:00
Bill Currie
946867c82e [qfvis] Start work on an off-line fat pvs compiler
Extremely large maps take a very long time to process their PVS sets for
PHS or shadows, so having an off-line compiler seems like a good idea.
The data isn't written out yet, and the fat pvs code may not be optimal
for cache access, but it gets through ad_tears in about 500s (12
threads, compared to 2100s single-threaded in the qw server).
2021-07-26 22:42:03 +09:00
Bill Currie
bd2ceca13a [qw] Move the pvs and phs sets into single hunks
Hunk_Alloc has a rather large per-block overhead. Also, small pvs sets
(64 leafs) will fit into just the basic set structure so no need to
allocate data for the maps.
2021-07-26 22:36:07 +09:00
Bill Currie
cf96f340df [util] Use same distance calc in simd CC test
The test started failing when optimizing (not sure why). Using the same
code to calculate the squared distance "fixes" the test.
2021-07-26 15:46:12 +09:00
Bill Currie
c02fcee58a [util] Make zone functions 64-bit clean
This allows nq and qw clients/servers to use over 2GB of memory if
necessary.
2021-07-26 15:43:57 +09:00
Bill Currie
5fc1a36d92 [gamecode] Be more forgiving of unresolved builtins
If the progs code never calls the functions, then there is no problem.
Thus unresolved builtin references get pointed to the bad function
builtin.
2021-07-26 13:35:35 +09:00
Bill Currie
60d23bdc8f [qfbsp] Remove all arbitrary bsp limits
Planes, verts, etc can now all get crazy big.
2021-07-26 13:10:06 +09:00
Bill Currie
2e33503c4c [vulkan] Fix a missed array index edit
Caused by the view model implementation, and missed because gcc needs
optimization to cache such errors (and my own error, of course).
2021-07-26 11:43:31 +09:00
Bill Currie
f47e03e606 [model] Remove 64k limit on visible leafs
Modern maps can have many more leafs (eg, ad_tears has 98983 leafs).
Using set_t makes dynamic leaf counts easy to support and the code much
easier to read (though set_is_member and the iterators are a little
slower). The main thing to watch out for is the novis set and the set
returned by Mod_LeafPVS never shrink, and may have excess elements (ie,
indicate that nonexistent leafs are visible).
2021-07-26 11:32:05 +09:00
Bill Currie
03921c03c5 [util] Expose set_expand and fix an out-by-one bug
Having set_expand exposed is useful for loading data into a set.

However, it turns out there was a bug in its size calculation in that
when the requested set size was a multiple of SET_BITS (and greater than
the current set size), the new set size one be SET_BITS larger than
requested. There's now some tests for this :)
2021-07-26 09:54:03 +09:00
Bill Currie
7995f59a90 [vulkan] Set the 2d near distance to 0
-999999 seems to be a hold-over from the software renderer passed
through both gl renderers. I guess it didn't matter in the gl renderers
due to various draw hacks, but it made quite a difference in vulkan.
Fixes the view model covering the hud.
2021-07-25 14:21:37 +09:00
Bill Currie
56c2fa380b [vulkan] Implement view model rendering
Quake just looked wrong without the view model. I can't say I like the
way the depth range is hacked, but it was necessary because the view
model needs to be processed along with the rest of the alias models
(didn't feel like adding more command buffers, which I imagine would be
expensive with the pipeline switching).
2021-07-25 14:03:25 +09:00
Bill Currie
13e1682f5e [qfbsp] Add an option to dump info about a bsp file
Just the header plus some basics of model info.
2021-07-25 12:14:04 +09:00
Bill Currie
81f73e4524 [gamecode] Support printing a single edict field 2021-07-25 09:54:08 +09:00
Bill Currie
342ba65f57 [qfcc] Handle aliased field types
Fixes use of structs as entity fields. The test is currently
compile-only.
2021-07-24 18:09:54 +09:00
Bill Currie
86cf7fbecd [gamecode] Check for null edict before printing number
Avoids segfault during double-verbose disassembly of progs code that
uses entities.
2021-07-24 18:04:57 +09:00
Bill Currie
7868936b96 [vulkan] Correct the skysheet scaling
Dunno where that 8 came from, but it's quite a bit different from 189/64
(2.953125). Fixes the excessively high skies in vulkan.
2021-07-24 14:23:06 +09:00
Bill Currie
1300cfb14e [console] Clean up key_menu input handling
Missed this little change in the menu/console untangling.
2021-07-24 14:21:54 +09:00
Bill Currie
40a26e4bc8 [scene] Rename libQFentity to libQFscene
And start working on scene management.
2021-07-24 14:20:59 +09:00
Bill Currie
076f424d39 [qw] Actually fix the idle scale
Oops. I really need to get cl_view merged.
2021-07-24 11:38:28 +09:00
Bill Currie
d3b7f7fbc8 [nq,qw] Fix broken intermission view
The idle scale was 114.591559 time too big (forgot both half angle for the
quaternion and converting from degrees to radians for the idle rotations).

Also, take the intermission view position and rotation direct from the
player entity, not viewstate, as while viewstate.origin is the same,
viewstate.rotation is the player's input, not the rotation set by the
server. Fixes the unlocked view angle.
2021-07-24 11:33:53 +09:00
Bill Currie
435009e2cd [entity] Update local rotation and scale caches
When setting local rotation/scale/transform, need to cache the rotation and
scale, otherwise they can't be fetched easily later on (position is easy as
it's just the fourth column of the matrix).
2021-07-24 11:31:00 +09:00
Bill Currie
c715fb384f Update .gitignore yet again 2021-07-24 10:12:24 +09:00
Bill Currie
632d2cb79c [console] Plug another escape handler leak 2021-07-24 00:28:49 +09:00
Bill Currie
fbbf83e696 [console] Pop menu escape in forced close menu
Fixes loss of access to the menu after selecting a new game via the menu.
2021-07-23 21:15:01 +09:00
Bill Currie
c134e9d348 [renderer] Remove R_EnqueueEntity from the plugin funcs
Forgot about this when fixing the ctf flags.
2021-07-23 12:46:53 +09:00
Bill Currie
3b586fc0a6 [console] Untangle console and menu toggling
The recent changes to key handling broke using escape to get out of the
console (escape would toggle between console and menu). Thus take care
of the menu (escape) part of the coupling FIXME by implementing a
callback for the escape key (and removing key_togglemenu) and sorting
out the escape key handling in console. Seems to work nicely
2021-07-23 02:28:37 +09:00
Bill Currie
30dc82f290 [qw] Use efrags for carried flags
This sorts out the unwanted use of R_EnqueueEntity, which will help with
removing another global (r_ent_queue), which is necessary for threaded
multi-pass rendering (ie, shadows).
2021-07-22 19:35:12 +09:00
Bill Currie
e799a7ae45 [qwaq] Readd libQFruamoko_client to qwaq-x11
Turned out it was needed after all (bad build test)
2021-07-22 18:08:13 +09:00
Bill Currie
b3e7b52696 [qw] Check for null file before checking size
Fixes a segfault when downloading a file that doesn't exist.
2021-07-22 18:02:36 +09:00
Bill Currie
e089234f38 [console] Link against libQFruamoko_console
Fixes shared plugin not loading due to missing symbol.
2021-07-22 18:01:18 +09:00
Bill Currie
49afdde77f [vulkan] Add some comments and clean some code
Figuring out bsp rendering for shadows is a fair bit harder than
expected :P
2021-07-22 16:15:14 +09:00
Bill Currie
f1ac8f2460 [renderer] Remove currententity from non-sw renderers
Really needed only for vulkan, but removing currententity from gl and
glsl made testing easier.
2021-07-22 16:15:14 +09:00
Bill Currie
41de8c9187 [util] Cast swapped signed shorts in bspfile
This fixes a bug when loading bsp29 files that resulted in leaf nodes
having bogus bounding boxes if any coordinates were negative (and thus
dynamic lights, and probably all sorts of other things) being broken.
And it took me only 9 years to notice :P
2021-07-22 14:25:51 +09:00
Bill Currie
8369a2206a [glstub] Add functions needed to get glsl working
Pity vulkan won't be so easy.
2021-07-22 10:12:41 +09:00
Bill Currie
3351b62318 [renderer] Move driver specific texture chain defs
The GL/GLSL/Vulklan texture chaining defs never should have been in
r_internal.h in the first place. They still need a better name, though.
2021-07-21 16:36:51 +09:00
Bill Currie
0f259c647b [vulkan] Clean out some dead code
While I might want to support lightmaps in the future (eg, for ambient
occlusion), the commented out code is confusing.
2021-07-21 14:54:07 +09:00
Bill Currie
5864406f4d [vulkan] Enable all lights when camera out of map
Without shadows, this is quite the cheat, but noclip is a cheat anyway,
so probably not that big a deal. It does, however, make noclip usable
for debugging.
2021-07-21 14:15:56 +09:00
Bill Currie
6962c5948a [vulkan] Clean up some more unused bsp data
Since vulkan supports 32-bit indexes, there's no need for the
shenanigans the EGL-based glsl renderer had to go through to render bsp
models (maps often had quite a bit more than 65536 vertices), though the
reduced GPU memory requirements of 16-bit indices does have its
advantages.
2021-07-19 23:38:09 +09:00
Bill Currie
924c970868 [vulkan] Pre-compute the sun's PVS
Any sun (a directional light) is in the outside node, which due to not
having its own PVS data is visible to all nodes, but that's a tad
excessive. However, any leaf node with sky surfaces will potentially see
any suns, and leaf nodes with no sky surfaces will see the sun only if
they can see a leaf that does have sky surfaces. This can be quite
expensive to calculate (already known to be moderately expensive for
just the camera leaf node (singular!) when checking for in-map lights)
2021-07-19 22:36:51 +09:00
Bill Currie
3ef89583af [gamecode] Correct pop implementations
Had src and dst swapped (yay for not testing :P (boo for not having an
easy way to test (yay for working on it))).
2021-07-19 22:31:22 +09:00
Bill Currie
87dc35e2fd [renderer] Be more consistent with msurface_t names
Use "surf" everywhere in gl, glsl and vulkan. Not worried about sw/sw32
at this stage (I don't poke around in there anywhere near as much).
2021-07-19 06:55:36 +09:00
Bill Currie
3c93d555e3 [gl] Correct calculation of screen aspect
vrect_t's fields are ints, and it was vid.aspect that prevented the
quotient being truncated. Fixes the rather squashed looking world.
2021-07-19 06:55:36 +09:00
Bill Currie
6b38a17cf1 [gamecode] Clean up state imlementations
This makes the code easier to read. Also, yay for automated tests:
caught a mistyped time :)
2021-07-15 16:55:02 +09:00
Bill Currie
f7efcde7ab [vulkan] Clean up and document some of the bsp code
Getting close to understanding (again) how it all works. I only just
barely understood when I got vulkan's renderer running, but I really
need to understand for when I modify things for shadows. The main thing
hurdle was tinst, but that was dealt with in the previous commit, and
now it's just sorting out the mess of elechains and elementss.
2021-07-13 22:59:51 +09:00