Commit graph

2791 commits

Author SHA1 Message Date
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
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
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
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
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
2dd8eea0d9 [vulkan] Let's do the distcheck again 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
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
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
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
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
Bill Currie
7ff0e95c52 [vulkan] Merge lighting updates into one packet
While QFV_PacketScatterBuffer works on only one destination buffer, it
turns out it's still useful for scattering to multiple buffers, just
with multiple calls. This makes it pretty easy to combine multiple
buffer updates into a single staging buffer packet, resulting in
reducing lighting's packet use from up to 7 to just one, drastically
reducing the pressure on the stating buffer packet pool, and thus
reducing the chances of QFV_PacketAcquire stalling.
2023-12-06 00:15:42 +09:00
Bill Currie
fccd06c5bf [vulkan] Add gpu profiling zones
This relies on my fork of tracy: https://github.com/taniwha/tracy
on the wip-c-vulkan branch. Everything is still rather flaky though.

This necessitated the jump to vulkan 1.2 as a requirement.
2023-12-05 22:55:57 +09:00
Bill Currie
d908016606 [sys] Use a jump buffer to exit to main
This allows tracy to clean up properly. However, Sys_Quit will use the
jump buffer (sys_exit_jmpbuf) only if it has been set, so the use of
Sys_setjmp is optional.
2023-12-05 19:02:51 +09:00
Bill Currie
63e66e81c5 [vulkan] Increase ring buffer size to 32 packets
I'm still not happy with it being a compile time constant, but this
takes care of the interlock between frames in flight... for now: it's
fragile and really needs the excessive small-packet use in draw and
lighting to be cleaned up.

After discussion with Darian, I've decided to go with one big staging
buffer (with lots of packets) shared between FiF as the large size will,
in the end, be more flexible.
2023-12-05 16:43:05 +09:00
Bill Currie
e65e80f573 [vulkan] Report long packet acquisition times
Here long is considered to be 500μs. This shows the problem mentioned in
test scene, in lighting updates.
2023-12-04 23:41:46 +09:00
Bill Currie
d48f76eb57 [gamecode] Fix a typo in a comment 2023-12-04 23:23:58 +09:00
Bill Currie
e30f2cbacc [util] Add a wrapper for libgcc's backtrace functions
Right now, just backtrace_pcinfo is supported, but it's enough for
testing.
2023-12-04 17:53:12 +09:00
Bill Currie
1a83fe21c1 [util] Add Sys_setjmp and Sys_longjmp
Host_Error and Host_EndGame use setjmp/longjmp to implement an exception
of sorts, but this messes with tracy's state even with cleanup
attributes. However, it turns out that those cleanup attributes are
exactly how gcc implements C++ destructors, and so the standard Unwind
api (part of libgcc) respects them (so long as -fexceptions is enabled
for C). Thus... replace longjmp with an implementation that uses Unwind
to unwind the stack and call the cleanup functions as needed. This is
actually important for more than just tracy as the cleanup attributed
vars can be thread locks.
2023-12-01 12:13:26 +09:00
Bill Currie
52210b8c55 [util] Add leb123 signed and unsigned message readers
Needed for parsing dwarf eh_frame data, but I'm sure it will come in
handy for other things.
2023-12-01 02:55:08 +09:00
Bill Currie
da9e5d9ff3 [build] Make scoped zones a little easier to use
And report checking for tracy.
2023-11-30 21:08:34 +09:00
Bill Currie
010c658653 [build] Add support for building with Tracy
Tracy is a frame profiler: https://github.com/wolfpld/tracy

This uses Tracy's C API to instrument the code (already added in several
places). It turns out there is something very weird with the fence
behavior between the staging buffers and render commands as the
inter-frame delay occurs in a very strangle place (in the draw code's
packet acquisition rather than the fence waiter that's there for that
purpose). I suspect some tangled dependencies.
2023-11-28 15:54:55 +09:00
Bill Currie
9e43675c8f [vulkan] Add length and int color to graph labels
Tracy wants string lengths and uint32_t colors, so set them up
automatically from provided info.
2023-11-28 14:15:43 +09:00
Bill Currie
8e4f0f3837 [win] Implement borderless fullscreen mode
And rip out all the crufty DIB mode junk.
Fixes #60
2023-11-26 14:18:54 +09:00
Bill Currie
4eef0889ee [win] Communicate application focus to the client
This fixes the weird slug when running nq on windows. It turns out it
was the "friendly neighbor" sleep code activating due to bitrot. In
addition, there are cvars for enabling unfocused sleep (defaults off)
and disabling minimized sleep (defaults on).
2023-11-26 13:40:00 +09:00
Bill Currie
7024e4efb1 [win] Hide the mouse in a system-friendly way
ShowCursor is system-wide and thus not suitable for general use. It
turns out hiding the cursor in windows is the same as x11: use a null
cursor.
2023-11-25 22:03:27 +09:00
Bill Currie
30489e1812 [win] Set window style correctly
This fixes the incorrectly sized window (I think).
2023-11-25 21:03:51 +09:00
Bill Currie
250cac6079 [vid] Remove direct draw interface
It has been dead for a long time.
2023-11-24 12:28:55 +09:00
Bill Currie
f721021fec [win] Clean up event handling and a pile of dead code
The event handling changes take care of VagueLobster's segfaults on
startup for all renderers (vulkan will still be iffy depending on his
hardware: it dies on my GTX 965 M, probably due to memory and QF's
shadows). One nice side effect is it takes care of the broken CD audio
event handling (does anyone even care, though?).
2023-11-24 12:28:06 +09:00
Bill Currie
97a9620cb9 Do the distcheck dance 2023-11-23 17:55:33 +09:00
Bill Currie
7a2a61d365 Merge branch 'wip-trails' 2023-11-23 14:00:11 +09:00
Bill Currie
34daf9032d [renderer] Get trails rendering again
They're not quite working (trail path offset is incorrect) but their
pixels are getting to the screen. Also, lifetimes are off for rocket
trails in that as soon as the entity dies, so does the trail.
2023-11-23 13:58:44 +09:00
Bill Currie
70d07d8026 [quakefs] Document that QFS_LoadFile closes the file
In the end, I decided that the behavior isn't so bad, but it does need to
be documented.

Closes #34
2023-11-19 16:40:24 +09:00
Bill Currie
c322fb68d3 [cexpr] Remove unnecessary config.h include 2023-11-17 20:51:12 +09:00
Bill Currie
c467d2f9b8 [vulkan] "Use" most params for QFV_duSetObjectName
When disabled, its params go unused and thus results in gcc unused
locals warnings.
2023-10-15 18:20:55 +09:00
Bill Currie
1c6986f0ab Merge branch 'master' into wip-trails 2023-10-03 14:11:22 +09:00
Bill Currie
c5731374cd [glsl] Separate out the trails implementation
This gets things *compiling* again, though it's still non-functional and
definitely wrong (don't want trail in renderer_t), but I need to think
about the design for getting trails as components. Also need to think
about integrating trails into the client effects system so trails can be
shared between renderers.
2023-10-03 13:49:25 +09:00
Bill Currie
ba35ce71b3 [qfcc] Support 32-bit and 64-bit handle types
32-bit is nice because it's small, but 64-bit is handy for special
handle encodings.
2023-10-02 23:33:37 +09:00
Bill Currie
bde35749f5 [util] Define ALLOC_FREE_BLOCKS for DEBUG_QF_MEMORY
More bitrot.
2023-10-02 20:40:21 +09:00
Bill Currie
6423c13108 Merge branch 'master' into wip-trails 2023-10-02 00:48:14 +09:00
Bill Currie
2e90022d5c [util] Define ALLOC_STATE for DEBUG_QF_MEMORY
I haven't used DEBUG_QF_MEMORY for a while, so it suffered a bit of
bitrot.
2023-09-22 20:22:24 +09:00
Bill Currie
5c72ce10d2 [input] Delay event system init
I think I had though it using a constructor init was ok, but it turns
out that was problematic. That, or I missed it in my recent audit. Fixes
a sys syserror during shutdown.
2023-09-21 02:02:12 +09:00
Bill Currie
9a081b6809 [input] Fix input shutdown order
This fixes another segfault on shutdown (not sure just which recent
change caused it, but the listener pointer needed clearing) but while
fixing the listener issue, I noticed that binding and imt shutdown were
in the wrong order with respect to buttons and axes.
2023-09-21 01:36:43 +09:00