Commit graph

2368 commits

Author SHA1 Message Date
Bill Currie
2768606f1d [set] Allow a set pool to be cleaned up
In the end, I couldn't use it (due to needing to hold onto the sets),
but it balances the init.
2024-09-19 12:22:46 +09:00
Bill Currie
7b9dc3c878 [plist] Add support for parsing and writing JSON
It seemed like a good idea since vulkan and gltf resources use JSON.
However, plist and json parsing and writing are separate: there's no
auto-detection for parsing, and the appropriate function must be used
for writing (though reading one then writing the other will work, but
may result in some information loss, or even invalid json (binary)).

Escape characters aren't handled quite to spec yet (eg, no \uxxxx).

The tests are pretty lame, but they're taken from rfc7159 and round-trip
correctly (which is a surprise for the fp numbers).
2024-09-14 18:59:48 +09:00
Bill Currie
edc03c22f9 [dstring] Ignore embedded nulls for appendstr
I don't remember why I thought it was a good idea to respect embedded
nul characters, but doing so makes appendstr O(N) instead of O(1) (or
O(N^2) instead of O(N) for multiple appends of n chars (N = sum(n)).
Also, this makes appendstr consistent with dasprintf.
2024-09-14 17:12:01 +09:00
Bill Currie
4329537b1b [dstring] Implement reserve
In the end, I'm not sure when I'll use it, but at least the expected
semantics are there.
2024-09-14 16:20:14 +09:00
Bill Currie
ebaa557d2a [dstring] Rename reserve to open
I've decided that I want reserve to mean only allocate backing memory,
not modify the size of the string, but I didn't want to rework much code
in the process. I might eventually get right of the open functions, but
I wouldn't be surprised if that's another decade or two in the future.
2024-09-14 15:51:41 +09:00
Bill Currie
698d27c996 [gamecode] Save all param pointers with PR_SaveParams
Builtins calling other functions that call back into progs can get their
parameter pointers messed up resulting in all sorts of errors. Thus wrap
all callbacks to progs in PR_SaveParams/PR_RestoreParams.

Also, ditch PR_RESET_PARAMS in favor of using PR_SetupParams and move
setting pr_argc into PR_SetupParams.
2024-09-05 00:00:44 +09:00
Bill Currie
e35bff066f [vulkan] Fix more sync issues
Thanks to validation layers showing command buffer debug regions, it was
pretty easy to find the offending buffers. Did need to modify
QFV_PacketCopyBuffer to take a source barrier as well as the destination
barrier, but this is probably for the best.
2024-09-04 17:47:04 +09:00
Bill Currie
bc22cd3255 [vulkan] Mark more command buffer regions
Now all pipelines and any tasks that have a command buffer attached get
a region using their names (tasks use the function name). I don't know
when it happened, or if I failed to notice last time, but (sync)
validation layers now include the debug region for command buffers: very
nice.
2024-09-04 17:34:01 +09:00
Bill Currie
0424e9b798 [gamecode] Fix a silly typo in a macro
It doesn't really affect anything since it's just the parameter name in
an empty function-type macro, but "event" instead of "type" isn't
particularly conducive to self-documenting code.
2024-08-17 15:22:09 +09:00
Bill Currie
c70da4fc76 [qfcc] Chain matrix and bool types
Ruamoko doesn't really use either yet, but GLSL needs them and this
ironed out a lot of the issues related to adding the types.
2024-04-25 11:22:35 +09:00
Bill Currie
2471147488 [gamecode] Save return pointer when saving params
And point the return pointer at the return buffer. And, of course,
restore it. This fixes a really subtle (ie, difficult to find) bug
caused by the recent optimization improvements in qfcc: the optimizer
had decided to set the return value of a message call to the parameter
for the next call, but because the message was to the receiver class for
the first time, the class's +initialize was called. The +initialize
method returned self, which of course when into the parameter for the
*next* call, but the first call hadn't been made, so its parameter got
corrupted.
2024-04-18 22:46:13 +09:00
Bill Currie
4e2d713400 [vulkan] Optionally include vertex shader in tex update
The particle renderer uses the palette texture in the vertex shader, so
updating the palette needs the vertex shader stage included in the
barrier, but I imagine not all texture updates will need it, so add a
parameter to Vulkan_UpdateTex to select inclusion.
2024-04-18 10:16:44 +09:00
Bill Currie
2f8ffc4862 Merge branch 'master' into wip-ruaspirv 2024-04-18 09:46:10 +09:00
Bill Currie
44bb24bbaf [glsl] Add support for debug callback
It's disabled at compile time for now, but everything needed is there.
2024-02-25 11:12:10 +09:00
Bill Currie
e89afafc8f [util] Use uint16_t for crc16 2024-02-25 11:06:39 +09:00
Bill Currie
a6b59d4a42 [util] Make FREE a little more macro-correct
That is, use ()s around uses of p
2024-02-21 22:41:08 +09:00
Bill Currie
1df7674c65 [gamecode] Add a handle view
Handle type encodings aren't actually compatible with basic type
encodings as their width is always one and thus the tag field collides
with the basic type encoding's width field.
2024-02-21 22:41:08 +09:00
Bill Currie
6f04c555a4 [ruamoko] Add support for cbuf handling
I'm not sure how this will turn out, but the idea is ruamoko code will
be able to create its own scripting "language".
2024-02-01 18:58:41 +09:00
Bill Currie
e619b4524e [scene] Add support for a scene camera
Used only by qwaq, but I can fly around my little test scene now :)
2024-02-01 11:20:36 +09:00
Bill Currie
d409e595a8 [qwaq] Save and restore params around event handler
It turns out the parameter pointer save/restore I had done for detoured
functions is required for all nested calls. However, I had actually
completely forgotten about it. I updated the docs for that section.
2024-02-01 11:09:22 +09:00
Bill Currie
2e19e2d913 [ruamoko] Add wrapper for IN_SendConnectedDevices
And wrap input/event.h

event.h is a bit messy because of the data pointer in events, but it
works for now.
2024-02-01 01:40:46 +09:00
Bill Currie
6151bab0d1 [quakefs] Support loading dirconf directly
With this, it is a little easier to make qwaq independent of quake. The
default dirconf is still meant for quake, and fs_dirconf can still be
used to override the configuration.
2024-01-31 00:18:05 +09:00
Bill Currie
743b06d5c1 [vulkan] Script render graph initialization sequence
While every possible subsystem needs an initialization call, all that
does is add the actual initialization task to the render graph system.
This allows the render graph to be fully configurable, initializing only
those subsystems that the graph needs.

Scripted initialization is still separated from startup as render graph
creation needs various resources (eg, attachments) defined before
creating render and compute passes, but all those need to be created
before the subsystems can actually start up.
2024-01-30 23:13:16 +09:00
Bill Currie
8e3532d543 [vulkan] Add a cvar to select between deferred and forward
Finally. However, it has effect only when no render config is provided.

When a config is provided, things will break currently as nothing is
done yet, but getting a config in will take some work in qwaq and also
the render graph system as I want to make the startup functions
configurable.
2024-01-30 23:13:16 +09:00
Bill Currie
f5e39ba263 [renderer] Allow render config to be specified
The config is a pre-parsed property list. Currently unsupported by
anything but Vulkan (but only a warning is given, not a hard error at
this stage), and Vulkan doesn't use it yet.
2024-01-30 23:13:16 +09:00
Bill Currie
db46dc8a55 [sys] Move terminal color escapes to sys.h
This puts them all in the one place, thus easier to use (and the reason
for the console charset change).
2024-01-30 23:13:16 +09:00
Bill Currie
17b00a3d05 [vulkan] Enable synchronization validation
And clean up the resulting errors. While some were tricky, there weren't
all that many: just some attachment issues and the multi-stage image
copy for scraps.

Fixing scraps required a barrier between copies. It might be overkill,
but a transfer_dst to transfer_dst image barrier worked.

Fixing attachments was a bit trickier:
 - depth needed early and late fragment tests to be treated as one stage
 - all attachments that were read later needed storeOp = none (using the
   extension)
 - and then finalLayout needed to be correct to avoid ghost transitions
 - as well, for some reason the deffered gbuffer subpass needed a depth
   dependency on the translucent pass even though neither one writes to
   the depth attachment (possibly a validation bug, needs more
   investigation).
2024-01-28 09:00:01 +09:00
Bill Currie
2203e2b4fd [gl] Use a struct for glpoly_t's vertices
I always hated the float array for the different attributes.
2024-01-28 09:00:01 +09:00
Bill Currie
8f20638cd9 [vulkan] Implement deferred fog
It's not perfect (double fog on translucent surfaces, the
scatter/absorption isn't right, and no local lighting on the fog
itself), but it at least seems to look ok.
2024-01-23 14:32:30 +09:00
Bill Currie
60cb5a922a [vulkan] Add job tasks to be run on new scene
I think has been one of the biggest roadblocks to breaking free of
quake, so having dual render paths and thus the different new scene load
sequence has proven to be unexpected helpful. There's a lot more to be
done to make the render graph actually usable by anyone but me, but just
making scene load configurable frees up a lot. I think there needs to be
renderer startup/shutdown configuration too, but this seems to be enough
for now.
2024-01-21 13:36:17 +09:00
Bill Currie
8138b69186 [vulkan] Parameterize a few more forward vs deferred
Just scene and config load to go.
2024-01-20 23:36:12 +09:00
Bill Currie
f7948701a2 [renderer] Clean up the fog code
I didn't feel like messing with all the renderers, so the old API is
still there, but the internals are much simpler thanks to vec4f_t.
2024-01-20 19:39:35 +09:00
Bill Currie
3551b542c3 [bspfile] Correct some typos in the documentation
Wonder if there are any more hiding in there
2024-01-20 12:52:39 +09:00
Bill Currie
1e7cb8ee17 [vulkan] Implement lightmap updates for dlights
GL-Quake all over again, but the world is so much more alive with moving
lights, even if... rather stylized.

Closes #73.
2024-01-20 09:44:29 +09:00
Bill Currie
8c6bfe0984 [vulkan] Partially support dynamic lighting
Dynamic lighting via light styles now works, just actual dlights to go.
2024-01-19 15:45:04 +09:00
Bill Currie
63bec6d67f [scene] Add more entity component helper functions
Cleans up the code and removes more opportunities for UB.
2024-01-19 15:45:04 +09:00
Bill Currie
52f012cc11 [console] Flush any pending draw data
This takes care of a 5s hang when the engine aborts before the first
frame is rendered (for vulkan).
2024-01-19 15:45:04 +09:00
Bill Currie
4a99ef5723 [vulkan] Add a function to explicitly wait on a packet
It's not currently used, but it was very handy for finding where the
cause of the 5s hang was ***not***.
2024-01-19 15:45:04 +09:00
Bill Currie
3168550935 [vulkan] Upload lightmap data to the gpu and use it
The lightmaps aren't updated at all yet, so everything is static.
Figuring out how lightmap data gets to the gpu was a chore thanks to the
spaghetti in the bsp data, and then I'd forgotten that I was
pre-expanding the light data to rgb so wound up with weird lightmaps,
but without water or particles, demo1 is getting 5000fps at 800x450, and
it seems to be CPU limited.
2024-01-19 15:45:04 +09:00
Bill Currie
ec9e2c12b8 [vulkan] Implement skin support
Finally, quakeworld gets its *ahem* fancy skins. I'm not happy with how
skin loading is handled, but the whole model and skin support needs a
redesign.

Closes #74.
2024-01-15 19:07:33 +09:00
Bill Currie
fcd094ef04 [skin] Fix up dynamic library issues
And further clean up skin api.

It turns out that skin functions must all be in the render libs, and
this results in Skin_Set (was Skin_SetSkin) needs to be accessed via a
function pointer rather than directly :(
2024-01-15 15:26:09 +09:00
Bill Currie
d39630580e [skin] Get team colors working for model skins
This should actually get team colors working for all models, not just
player.mdl.
2024-01-15 14:59:11 +09:00
Bill Currie
0539f07c1a [skin] Use an ECS registry to manage skins
This takes care of the double free and also cleans up a lot of the skin
api. However, the gl renderer lost top/bottom colors (for now). Vulkan
skins still don't work yet.
2024-01-15 14:56:37 +09:00
Bill Currie
739adad3d5 [skin] Clean up the API a little
Only the renderer-specific functions are in the plugin functions struct,
and only the client functions are global.
2024-01-13 13:42:03 +09:00
Bill Currie
6c03d72c26 [qw] Clean up player info processing
It should be much harder for a malicious server to crash the client
(there were a few holes in there still).

Also, set the fallback (server didn't specify) top/bottom colors to be
such that the default colors from the skin are used instead of white.
2024-01-13 13:22:52 +09:00
Bill Currie
119e9766b9 [iqm] Use 32-bit indices for large models
That is, those with more than 65520 vertices. Not properly supported for
sw or gl, and glsl isn't rendering properly for some reason (renderdoc
does see the meshes, though, so maybe depth or winding issues).
2024-01-09 13:36:46 +09:00
Bill Currie
3cd0703249 [ui] Implement scroll bars
There's a bit of nasty hard-coding around passages at the moment, but
the basics are working in a fairly generic way.
2024-01-09 09:12:29 +09:00
Bill Currie
c460d03371 [ui] Propagate passage view size to its container
This gets the container view sized properly such that the scroll box has
something to work with for determining how much the view can slide.
2024-01-08 11:18:21 +09:00
Bill Currie
97a83bf1ed [ui] Move passage paragraph placement into text handling
This allows the passage view to be sized properly during imui's layout
phase.
2024-01-08 10:27:17 +09:00
Bill Currie
585c47bc2d [ui] Use actual fractions for fractional values
Integral percentage is not always enough.
2024-01-07 12:03:22 +09:00