Commit graph

14082 commits

Author SHA1 Message Date
Bill Currie
ee986e3b2a [ruamoko] Use cvar toggle function
This fixes menu toggle items not working (eg fullscreen).
2023-12-21 10:24:21 +09:00
Bill Currie
ba0cf5fa9b [cvar] Add toggle and reset functions
The toggle function is needed for handling listeners, and reset was done
as part of the API cleanup.

Also clean up some of the names and API.
2023-12-21 10:22:21 +09:00
Bill Currie
92f68844f5 [ruamoko] Remove keys.h and keys.r
The functions haven't existed for two years now. And in the interest of
"throw one away", the controls_o.r has been gutted.
2023-12-21 08:40:09 +09:00
Bill Currie
5d4ce73ff4 [zone] Fix sentinel spelling in unit test 2023-12-21 02:30:39 +09:00
Bill Currie
049566062d [zone] Correct the spelling of sentinel 2023-12-21 02:18:56 +09:00
Bill Currie
82428ffb9d [zone] Fix z_split_block and Z_Realloc
z_split_block missed updating the back pointer in the block after the
split block, and Z_Realloc missed setting the sentinel.
2023-12-21 02:13:40 +09:00
Bill Currie
18c0ea3657 [qfcc] Ensure one is the correct type for incop expressions
This makes for nicer generated code when the incop (especially post) is
used in a condition.
2023-12-20 23:10:17 +09:00
Bill Currie
dd183d3ba6 [qfcc] Handle signed-unsigned int comparison better
This fixes the upostop-- test by auto-casting implicit constants to
unsigned (and it gives a warning for signed-unsigned comparisons
otherwise). The generated code isn't quite the best, but the fix for
that is next.

Also clean up the resulting mess, though not properly. There are a few
bogus warnings, and the legit ones could do with a review.
2023-12-20 23:09:06 +09:00
Bill Currie
54839db826 [qfcc] Add some tests for postop--
Interestingly, intval-- works properly, but unsignedval-- does not (test
case fails). This is why menus blow up when opening the load/save
sub-menu.
2023-12-20 21:50:51 +09:00
Bill Currie
aed637e4de [zone] Reimplement Z_Realloc
It now checks the next block to see if it is free with enough space and
carves off a chunk if so, or chops off the end of the current block if
smaller, otherwise it allocates *before* freeing.
2023-12-20 21:16:16 +09:00
Bill Currie
de7293c16a [zone] Be more consistent with pointer to block conversion
Most importantly, the error checking is consistent.
2023-12-20 18:37:47 +09:00
Bill Currie
1266ede2b1 [zone] Make zone_error be like printf
It's so much nicer being able to just print normally.
2023-12-20 18:32:53 +09:00
Bill Currie
10451fac0d [nq] Don't delete player entity if no model set
The model gets unset during intermission and deleting the entity breaks
the intermission camera. This doesn't really feel right, but it does fix
the intermission camera. Really, the whole entity linking thing and
camera control needs a cleanup (and merging between nq and qw).
2023-12-19 21:33:19 +09:00
Bill Currie
45a11bcc68 [math] Add a vector format macro
vec3_t is still a thing so printing it should be easy.
2023-12-19 20:08:39 +09:00
Bill Currie
0f24f10bb9 [vulkan] Handle spotlights pointing -X
The problem didn't show up until the switch to float depth buffers
(because they can store the resulting nan).
2023-12-19 17:56:13 +09:00
Bill Currie
2e9e247ca4 [vulkan] Use resource for allocating alias models
So far only the mesh data, so it doesn't make any difference to
allocations, but it's the first step to reducing memory object
allocation.
2023-12-19 03:28:29 +09:00
Bill Currie
4ed1ef3353 [vulkan] Switch to float depth buffers
This takes full advantage of the reversed (infinite far plane) depth
buffers, and seems to have no performance cost.
2023-12-18 23:15:21 +09:00
Bill Currie
bf4eedc1c6 [vulkan] Apply light cull info to light pvs
This makes a possible improvement to e1m3, only barely affects ad_tears,
but makes about 30% difference to gmsp3v2 (21fps to 27, and from 3300
leafs to 2700).
2023-12-18 21:07:57 +09:00
Bill Currie
75f00a2888 [nq] Add some zones for client and server
Just more profiling info.
2023-12-18 13:19:08 +09:00
Bill Currie
443f825d19 [vulkan] Support fisheye for light culling
Nicely, the people who created multiview thought of queries and how they
need to interact.
2023-12-18 03:07:29 +09:00
Bill Currie
d6e6d5b28b [vulkan] Clean up shadow map render passes a little
The cascade_shadow and cube_shadow names are no longer relevant thanks
to the staging images, and the output field for render passes is
optional in general and irrelevant for shadow maps.
2023-12-18 03:05:10 +09:00
Bill Currie
394eae2284 [vulkan] Fix missing debug utils for 64-bit windows
My wordsize check was probably for 686 builds.
2023-12-17 22:41:18 +09:00
Bill Currie
69af6a6234 [vulkan] Bail if all lights have been culled
When all lights have been culled, the updates wind up being 0 bytes and
vulkan validation doesn't particularly like that.
2023-12-17 20:05:17 +09:00
Bill Currie
dd4f51049d [build] Fix up unwanted dependency on tracy source
The tracy source files should not be required for make dist to work, so
this works around it by using a little indirection.
2023-12-17 19:18:58 +09:00
Bill Currie
2dd8eea0d9 [vulkan] Let's do the distcheck again 2023-12-17 18:45:02 +09:00
Bill Currie
b02da2c0a6 [vulkan] Implement shadow map culling
The rendering of the shadow maps now takes the culling information into
account resulting in a drastic reduction of work. There's still more
work to be done, but demo1 peaks at over 1000fps at 640x480, gmsp3v2 now
gets 14fps (1920x1080) near the front gate (used to be 3, then 6),
ad_tears is up to 3fps, but marcher is still unhappy, but it has
infinite radius lights, so needs more culling work (clipped light
volumes will help, I think). Also, culling lights for which nothing has
moved within their volumes will help somewhat (though not as much for
most id maps, I suspect).
2023-12-17 18:45:02 +09:00
Bill Currie
245d4a8d9a [vulkan] Clean up make_id()
Passing the control struct and a flag for style/nostyle makes the calls
much easier to read.
2023-12-17 18:45:02 +09:00
Bill Currie
1511aa7120 [vulkan] Show light style and id in the debug UI
Style includes the resulting scalar for the light value.
2023-12-17 18:45:02 +09:00
Bill Currie
8890e14208 [vulkan] Use OIT to visualize the light hulls
Using the translucency pass made it easy to have depth-tested
translucent "solid" light volumes instead of always visible lines (which
are still an option as that's useful too). Most importantly, being able
to see the surfaces helped no end in figuring out that my hulls were
created with counter-clockwise windings instead of quake's usual
clockwise windings and thus my hulls were being rendered inside-out in
the occlusion pass.
2023-12-17 18:45:02 +09:00
Bill Currie
187c48bde3 [vulkan] Apply the light culling information
The results of the occlusion queries give the lights that don't have a
visible hull, but unfortunately that includes any lights which the
camera is inside, but simple distance checks sort that out (with a
fudge-factor for the icosahedron vertices (1.583 (3(2+p)/(2+3p), p is
golden ratio)).
2023-12-17 18:45:02 +09:00
Bill Currie
f08b8dc3c7 [vulkan] Move light radius calcs to the CPU
No point in calculating them for every vertex, especially when I forgot
to update the calculations for the entid vertex shader.
2023-12-17 18:45:02 +09:00
Bill Currie
00ecb7d71a [vulkan] Use separate tracy GPU context for light culling
My efforts (especially the collect zone (what was I thinking)) got
tracy's knickers in a twist resulting in vanishing zones in the server.
It looks like there are some synchronisation issues between cpu and gpu,
but I'm not *too* worried about it at this stage.
2023-12-17 18:45:02 +09:00
Bill Currie
f282bfc045 [vulkan] Use occlusion queries for culling lights
The info isn't used yet, but this shows that vulkan's occlusion queries
are at least somewhat useful. However, the technique isn't perfect:
infinite radius lights (1/r and 1/r^2) are difficult to cull, and all
lights can poke through thin enough walls, and then lights containing
the camera get culled incorrectly (will need a separate test). Still, it
looks like it will help once everything is tied together.
2023-12-17 18:45:02 +09:00
Bill Currie
1c13879fb9 [vulkan] Split out the render pass core
And make it callable directly (needed to be able to submit the command
buffer separately from the main commands (though this does mess with
tracy a little).
2023-12-17 18:45:02 +09:00
Bill Currie
24aa81e085 [vulkan] Fix some out-by-one errors
I don't know why I thought <= was useful in those loops. Fixes some
segfaults for incorrect references.
2023-12-17 18:45:02 +09:00
Bill Currie
fa6598c389 [vulkan] Fix broken dynamic light shadows
They weren't rendering properly at all due to the matrix updates getting
overwritten by the light data (I'd forgotten to advance the packet data
pointer).
2023-12-17 18:45:02 +09:00
Bill Currie
8e7c21e36a [vulkan] Implement staged shadow maps
This doesn't make much of a difference on the GPU, but it drastically
cuts down CPU usage, especially for ad_tears: shadow map drawing is down
from 16.3ms to 3.7ms thanks to no having to run the alias model queues
as often.
2023-12-17 18:45:02 +09:00
Bill Currie
5637bae20c [vulkan] Move on to vulkan api 1.3
I decided there's little point in hanging onto old API versions when the
newer ones have some nice things like vkCmdCopyImage2.
2023-12-17 18:45:02 +09:00
Bill Currie
c36c2dc8b2 [vulkan] Apply normal light rules to dynamic lights
ie, enforce shadow quanta and max light size.
2023-12-17 18:45:02 +09:00
Bill Currie
72ef0662f5 [vulkan] Add a level of indirection to shadow matrices
Batching shadow map rendering needs be able to reference matrices for
multiple lights in a single batch, but the only input is the view index,
so use that to look up the matrix index rather than using it to index
the matrices directly (modulo the base index that's still there).
2023-12-17 18:45:02 +09:00
Bill Currie
3a31fa111d [vulkan] Create render passes for up to 32 views
Actually, only 29 are used because nvidia's drivers segfault when there
are more than 29 views (regardless of the exact bit pattern in the view
mask). This will allow rendering shadow maps in large batches, which
should make for better GPU utilization.
2023-12-17 18:45:02 +09:00
Bill Currie
a9ff79a76a [vulkan] Set shadow map size limit to 1024
Even that's getting pretty big, but with the quanta at 128, that's a
maximum of 8 different image sizes (which is nice for my planned
"staging image" idea).
2023-12-17 18:45:02 +09:00
Bill Currie
9ba7207e20 [vulkan] Change shadow quanta to 128 pixels
Interestingly, this caused a reduction in memory use for some maps (but
did increase marcher's again, but not as much as the bogus rounding
did). The idea was to use sparse bindings to remap shadow map layers,
but it turns out sparse bindings are insanely slow (beyond unusable).
However, the reduction in the number of shadow map images seems to be
worth it.
2023-12-17 18:45:02 +09:00
Bill Currie
75ce49b1f0 [vulkan] Switch to vulkan 1.1/1.2 prop/feat structs
Since switching to the 1.2 api as a requirement, might as well use the
relevant structs instead of extension struct (for multiview). Came up
when double-checking the max views property due to running into what
appears to be an nvidia bug where > 29 views (any bit pattern) cause a
segfault when creating the pipeline.
2023-12-17 18:45:02 +09:00
Bill Currie
7506117e43 [vulkan] Increase matrix id bits
I had missed that upping max lights to 2048 meant that up to 12288
matrices are needed for all the possible lights. This made it so the
light type could not be encoded in id_data, but the shaders never used
it anyway. This leaves one bit free.
2023-12-17 18:45:02 +09:00
Bill Currie
39616bc84d [vulkan] Remove old descriptor and pipeline code
Pipeline cache handling is still there for now, but the rest hasn't been
used since the render graph rewrite, if not before (and good riddance).
2023-12-17 18:45:02 +09:00
Bill Currie
694d969c83 [vulkan] Round shadow map sizes correctly
I'd added some developer output to see how the layers were distributed
between images and found the image widths to be... odd. It turns out I
was double-adding the shadow_quanta. Oops. Results in ~164MB less memory
used by marcher (for 32 pixel quanta).
2023-12-13 00:06:33 +09:00
Bill Currie
175e9fd7c9 [vulkan] Add some comments to lighting code 2023-12-12 21:13:14 +09:00
Bill Currie
b86f49fe7c [vulkan] Queue quad and slice vertices for transfer
This allows "large" updates to be done in a single staging buffer packet
instead of one packet per quad (or slice). Currently, they're batched
into groups of 64 (not really enough for conchars, but that's only at
init-time, so not all that bad). Nicely, this seems to simplify the
staging code.

Fixes #65.
2023-12-07 14:59:21 +09:00
Bill Currie
03af3c5cc9 [vulkan] Make the tracy macros more robust
Now some of the hacks needed for GPU zones work without tracy being
enabled (ie, no compiler warnings about unused variables).
2023-12-07 14:51:58 +09:00