Commit Graph

13637 Commits

Author SHA1 Message Date
Bill Currie e83854a760 [vulkan] Make z_up and box_rotations public
They're now qfv_* and shared within the vulkan renderer. qfv_z_up cannot
be shared across renderers as they have their own ideas for the world
frame. qfv_box_rotations currently can't be shared across renderers
because if the Y-axis flip and the way it's handled, but sharing should
be achievable by modifying the other renderers to handle the sides
correctly (glsl and gl need to do lookups for the side enums, sw just
needs to be shown which way is up).
2023-07-30 11:13:48 +09:00
Bill Currie 931175b21d [vulkan] Run the shadow render passes
The shadow maps are rendered incorrectly because the matrices aren't set
correctly yet, but the dual-pass bsp rendering is working.
2023-07-29 01:17:53 +09:00
Bill Currie 3d4cca4393 [vulkan] Allow render passes to be run by processes
This lets the shadow step run its passes as needed.
2023-07-29 01:10:26 +09:00
Bill Currie ad1b2d00d4 [nq,qw] Add a debug_debug cvar
Setting the cvar to > 0 causes demo playback to stop (via demo_speed 0)
when the read packet count reaches the specified value. Very useful for
debugging rendering glitches that are easily reproduced in a demo.
2023-07-28 19:19:13 +09:00
Bill Currie fc946a604d [vulkan] Set default frames in flight to 2
Having 3 frames doesn't gain much of anything and costs 50% extra memory
as well as another frame of latency.
2023-07-27 16:16:33 +09:00
Bill Currie 3b0dcd2cdc [vulkan] Connect the shadow pass to the renderers
It's only partially complete, but R_VisitWorldNodes is now run for both
the main pass and the shadow auxiliary pass.
2023-07-27 16:09:33 +09:00
Bill Currie 123bf14784 [scene] Add a leaf component to lights
Regular leaf number for positional lights, 0 for directional, and ~0 for
ambient.
2023-07-27 15:50:53 +09:00
Bill Currie 2790972cb0 [renderer] Separate core of R_MarkLeaves
I needed to mark leaves based on an arbitrary PVS (for lighting) that is
independent of the camera position. Also cleaned up some const
correctness.
2023-07-27 15:43:47 +09:00
Bill Currie f7fce957e8 [renderer] Boost R_MarkLeaves very slightly
Using set iterators can be quite a lot faster for sparse sets due to the
function call overhead in testing each element. Times for ad_tears
dropped from about 1200us to about 670us (hard to say due to there being
only 3 data points and a lot of noise in the time).
2023-07-25 15:22:45 +09:00
Bill Currie 1f99f89a4a Fix some printf portability issues 2023-07-25 15:07:17 +09:00
Bill Currie 6c631693bd [vulkan] Clean out old command buffers from bsp
Missed from the render job cleanup.
2023-07-24 19:13:43 +09:00
Bill Currie f4d6a41901 [vulkan] Hook up a shadow render job step
It doesn't do much yet, but did help in getting light ids working.
2023-07-24 19:13:43 +09:00
Bill Currie 05f0fe9204 [scene] Add a render-internal lightid component
The vulkan shadow code needs to associate extra information with the
lights, but I don't want such renderer-specific data in the scene.
2023-07-24 19:11:18 +09:00
Bill Currie faa2245220 [vulkan] Correct dummy field name for labeledsingle
I didn't realize why labeledsingle had problems because most of the uses
where where the names were the same.
2023-07-24 19:11:18 +09:00
Bill Currie 2fa44c03a6 [vulkan] Allow process steps to have render or compute
If a step has process tasks, any render or compute
pipelines/renderpasses are **not** run automatically: the idea is the
process tasks need to run the relevant pipelines in a custom manner but
needs the objects to be created.
2023-07-24 19:11:18 +09:00
Bill Currie 31cf3ed248 [vulkan] Register external attachments
This is along the lines of what I originally intended, but now I need
more than just the swapchain (which is now registered by vulkan_output).
2023-07-24 19:11:18 +09:00
Bill Currie 35540dfc79 [vulkan] Correct bsp stage/pass parameters
While it doesn't affect the operation, it does affect the readability of
the code because pass is meant for mainpass vs the multiple shadow
passes.
2023-07-24 19:11:18 +09:00
Bill Currie 07d9749b53 [renderer] Don't clear efrags in SCR_NewScene
The recent light changes highlighted that the renderer does not own the
efrags (segfault in qwaq when shutting down my test scene). After
digging through the history of efrag clearing, it turns out that the
renderer never owned them, I just didn't understand the concept of
scenes at the time that I moved efrags into the renderer.
2023-07-23 00:55:31 +09:00
Bill Currie 9e1810a2a9 [vulkan] Get shadow map image creation working again
The switch to using the ECS for lights temporarily broke the generation
of the images, but getting things going again was fairly easy.
2023-07-22 22:41:05 +09:00
Bill Currie 7280e1d042 [scene] Limit light efrags to leafs within range
This makes a pretty significant difference: 8-25% for demo1, demo2,
demo3 and bigass1. Many thanks to Nick Alger
(https://stackoverflow.com/questions/5122228/box-to-sphere-collision).
It took me a moment to recognize that it's the Minkowski difference (and
maybe GJK?). Of course, I adapted it for simd.
2023-07-22 20:08:15 +09:00
Bill Currie 72f6048a20 [scene] Put lights into the bsp tree via efrags
This eliminates the O(N^2) (N = map leaf count) operation of finding
visible lights and will later allow for finer culling of the lights as
they can be tested against the leaf volume (which they currently are
not as this was just getting things going). However, this has severely
hurt ad_tears' performance (I suspect due to the extreme number of
leafs), but the speed seems to be very steady. Hopefully, reconstructing
the vis clusters will help (I imagine it will help in many places, not
just lights).
2023-07-22 17:53:07 +09:00
Bill Currie c0f8d102ad [scene] Implement Scene_FreeAllEntities (and use it)
I guess I wasn't sure how to find all the allocated entities from within
the registry, but it turned out to be trivial. This takes care of leaked
static entities (and, in a later commit, leaked light entities, which is
how I found the problem).
2023-07-22 16:50:18 +09:00
Bill Currie befb3ca31b [vulkan] Clamp composed values to >= 0
This takes care of the nans that got into the output buffer resulting is
weird holes in any overlays.
2023-07-22 00:43:05 +09:00
Bill Currie 99c6c58e25 [vulkan] Expose pipeline disable controls
Finally, runtime control of the debug pipelines (and all the rest, but
that might come in handy at some stage).
2023-07-21 19:45:54 +09:00
Bill Currie 4b86a0376d [console] Reset minimum time too
Not sure what happened to it, I thought I'd done that before.
2023-07-21 19:31:20 +09:00
Bill Currie ef322b968a [ui] Skip checkbox label if zero length
I seem to remember doing this for radio buttons, I guess I forgot about
checkboxes (really need to unify the code, though).
2023-07-21 19:28:30 +09:00
Bill Currie 8ae150cb9e [vulkan] Use correct name for pipelines
Using the subpass name instead of the pipeline name makes for a
confusing mess of duplicated names when subpasses have multiple
pipelines.
2023-07-21 12:37:04 +09:00
Bill Currie a9fb1e5720 [ui] Remove IMUI_FlexibleSpace prototype
The function doesn't exist and likely never will.
2023-07-21 12:35:56 +09:00
Bill Currie fde1ef0159 [vulkan] Add infinite plane rendering
The grid calculations are modified from those of Inigo Quilez
(https://iquilezles.org/articles/filterableprocedurals/), but give very
nice results: when thin enough, the lines fade out nicely instead of
producing crazy moire patterns. Though currently disabled, the default
planes are the xy, yz and zx planes with colored axes.
2023-07-21 11:59:25 +09:00
Bill Currie 72f7fcea47 [vulkan] Switch to reversed depth, infinite far plane
Based on the article
(https://developer.nvidia.com/content/depth-precision-visualized), this
should give nice precision behavior, and removes the need to worry about
large maps getting clipped. If I'm doing my math correctly, despite
being reversed, near precision is still crazy high. And (thanks to the
reversed depth) about a quarter of a unit (for near clip of 4) out at 1M
unit distance.
2023-07-21 11:36:10 +09:00
Bill Currie 9f8a6f5d62 [qfvis] Initialize set pool arrays
The relatively recent changes to ALLOC missed the set pools used in fat
pvs calculations.
2023-07-18 11:27:06 +09:00
Bill Currie f2cb62f2c8 [qwaq] Use VID_SendSize
Takes care of a FIXME I'd forgotten about, but was rather relevant to
this morning's changes.
2023-07-14 15:38:55 +09:00
Bill Currie 6e9f50ffe4 [vid] Ensure window size gets sent after init
This fixes a pile of window size related issues I've seen for a while,
but most importantly, some nastiness with division by 0 and segfaults.
2023-07-14 11:57:36 +09:00
Bill Currie 8e0bfb1a7b [console] Implement mouse trackball camera control
I've always wanted this in QF :)
2023-07-14 11:28:04 +09:00
Bill Currie bf3d57cdbf [ui] Return whether events to imui were consumed
Needed for non-ui handling of events (eg, mouse interaction with the
main screen).
2023-07-14 11:25:50 +09:00
Bill Currie 8068233fb2 [x11] Don't force grab or mouse warp in fullscreen
This seems to be more for legacy X11 (ie, without fixes etc), but
fullscreen really shouldn't affect grabbing directly (rather, it should
be up to the client whether grabbing (and thus warping) is enabled at
all.
2023-07-14 07:11:53 +09:00
Bill Currie fa1d8ff552 [client] Use correct width for input lines
con_linewidt starts out as 0, which leads to bad results for the initial
widths of input lines and later calculations. However, really, they
probably shouldn't be using size_t for the width, but this is a nice
quick fix.
2023-07-14 07:04:57 +09:00
Bill Currie cc57d2bc5b [vulkan] Remove double-draw of skies
Due to doing most of my testing using the demos, I hadn't noticed the
double-draw until flying around with the debug camera (and it showed as
a weird shimmer behind the sky layers).
2023-07-14 00:44:09 +09:00
Bill Currie 12b4cd8aba [console] Clean up the debug camera window
Now that I have menus, I can close the window.
2023-07-13 23:36:12 +09:00
Bill Currie 21a9cbc61b [ui] Implement a basic menu system
Menus within menu contexts automatically create menu items for the
sub-menu, and menus collapse when leaf menus are select.
2023-07-13 23:16:26 +09:00
Bill Currie a6fa10b24d [vulkan] Show timings for the job and steps
No real surprises anywhere other than how long things can take at random
times.
2023-07-13 18:33:31 +09:00
Bill Currie 9289e26211 [vulkan] Add a very simple job window
It shows the list of steps in the render job, but acts as something for
testing.
2023-07-13 15:41:49 +09:00
Bill Currie 3944cab95f [console] Start work on a main menu
It's rather clunky at the moment, especially with menus still in
development, but it gets the basics going for testing.
2023-07-13 14:25:08 +09:00
Bill Currie 1490379c04 [renderer] Add a debug_ui render function
The idea is the UI system can call into the renderer without knowing
anything about the renderer, and the renderer can do what it pleases to
create UI elements in the correct context (passes as a parameter).
2023-07-13 14:22:31 +09:00
Bill Currie 6d7e1064ec [ui] Support anchoring and extending panels
Panels can be anchored to a widget in another hierarchy, allowing for
things like cascading menus. They can also be extended via referencing
them by name, allowing for subsystems to add items to an already panel
(eg, extending a menu).
2023-07-13 14:22:31 +09:00
Bill Currie f5fd649dde [ui] Mark the text view as free-floating
This prevent the layout system from repositioning the text view and thus
breaking text-shaping. Now Tengwar Telcontar looks much more balanced in
the widgets.
2023-07-13 14:22:31 +09:00
Bill Currie de21b273f2 [nq] Set the locale
This is done only in nq because I am not sure of the consequences to the
rest of quake and I do most of my testing in nq when not using qwaq.
Needed for thousands separators in formatted printing.
2023-07-13 14:22:31 +09:00
Bill Currie 7642ef5758 [vulkan] Add debug displays for lights and bsp
The lights debug is from the light splat experiment (this is why I kept
the code), and the bsp debug is based on that. Both currently disabled
for now until I get UI controls in.
2023-07-13 14:22:31 +09:00
Bill Currie 0a260129a8 [console] Add a screenshot button to the debug ui
Saves me having to bind a key.
2023-07-12 23:23:57 +09:00
Bill Currie 1404b85846 [ui] Give panels/windows a group offset
This allows for finer control of render order and thus layering (will be
important for menus).
2023-07-12 10:17:43 +09:00