Commit graph

2864 commits

Author SHA1 Message Date
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
2b70eaa85e [build] Fix some config errors found by gcc 14
Or more realistically, attempting to use gcc 14 (it ICEs, so can't be
used yet).
2024-05-26 15:06:03 +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
0a9cc91503 [renderer] Use 16 bits for d_lightstylevalue
Even the comment says it's 8.8, so no need for 32 bits for each value.
It seems to have made a very small improvement to my glsl stub test, but
it's probably just noise (< 0.5%). However, having it "officially" 16
bits means that cached values can be 16 bits thus reducing struct sizes
when I rework lightmap surface data (taking the cache from 16 to 8
bytes).
2024-01-28 09:00:01 +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
b22f104163 [renderer] Merge light setup code from glsl and sw
I'll look into gl later, but this means I don't need yet another copy
for vulkan's forward renderer.
2024-01-20 14:35:02 +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
346ed29f49 [skin] Implement top/bottom colors for gl
They don't work yet if the entity does not have an external skin.
2024-01-15 14:59:06 +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
Bill Currie
2e00fd1165 [ui] Pass a data pointer to update functions 2024-01-07 11:58:01 +09:00
Bill Currie
aa5dc657fd [ui] Add some basic math ops for view_pos_t
Just add and subtract, but I got tired of having to write two lines of
code for such.
2024-01-06 19:38:20 +09:00
Bill Currie
082d00b6c3 [ui] Use the shaped text cache for passage text
This makes a pretty significant difference (~520us down to 80us) for
simple text passage, and even the first time is fast due to word
repetition.
2024-01-06 02:59:31 +09:00
Bill Currie
c2316a4173 [ui] Add support for passage views to imui
It was a right cow to get working at all due to the tangled mess of
dependencies between different hierarchies (switching to hierarchies as
components helpt), but other that some vertical positioning (paragraphs
and descenders), it's working fairly well now (and fairly quick other
than I think I need to ensure the shaping cache is used).
2024-01-05 16:34:18 +09:00