Commit graph

6416 commits

Author SHA1 Message Date
Bill Currie
e7401c5ff4 [vulkan] Regenerate mips for transparent textures
BSP textures have pre-generated mips, including the transparent
textures, but mips don't play nicely with the transparency color (255):
it gets blended to other colors (at least in ad tears). Regenerating the
mips from the rgba texture (using transparent black) produces nice
results.

Also, needed to discard on 0 alpha to avoid weird interactions with fog
(I didn't know ad tears had fog: I guess I had last loaded it before
implementing fog).
2024-10-04 22:10:08 +09:00
Bill Currie
91febd50c6 [win] Fix some bitrot for building
Needed an option to disable LTO, and a couple of errors that crept in
with preprocessor and vulkan improvements.
2024-09-24 19:49:41 +09:00
Bill Currie
83c65e6abd [vulkan] Deal with some ubsan complaints
One is potentially legit (depends on what really happens when allocating
0-length arrays on the stack), but the offset null pointer ones are
dubious as `a` should never be null when `size` is non-zero, and when
`size` is zero, everything gets corrected.
2024-09-24 11:31:36 +09:00
Bill Currie
9713e7764c [input] Plug some potential UB
More "null pointer but zero size", but with library code, who knows?
2024-09-24 11:28:59 +09:00
Bill Currie
5a928581ab [vkgen] Fix parsing of actual bool types
Switching to native ruamoko bool for vkgen resulted in bool getting
incorrectly parsed as a string (which mean getting the string's address
written to the value). Fixes the randomly enabled debug pipelines (and
probably a few randomly disabled normal pipelines, though less likely as
they're usually implicitly initialized). The one bit of actual legit UB
(ie, that which wasn't immediately mitigated one way or another) found
by ubsan, and it was a data error.
2024-09-24 11:09:10 +09:00
Bill Currie
23e2fff44a [cexpr] Correct bool's backing value type
Using int instead of bool probably won't work well if QF ever finds
itself on a big-endian system again.
2024-09-24 11:07:32 +09:00
Bill Currie
c0f4a2143f [net] Always allocate memory for ifaces
Pointing ifaces at myAddr doesn't end well when nq exits (free doesn't
like it).
2024-09-24 11:04:27 +09:00
Bill Currie
6f03b4a65f [console] Use aligned malloc for menu progs
Fixes ubsan's (random!) complaints about memblock not being aligned. I
should probably look into making the progs loader code ensure the memory
is aligned itself.
2024-09-24 10:58:47 +09:00
Bill Currie
399c0ec17f [zone] Use a static_assert for retain's offset
I'd written the old version long before static_assert was available in
C.
2024-09-24 10:57:01 +09:00
Bill Currie
867e49980f Fix some dodgy shifts
While I guess ubsan is right that shifting a 1 bit into the sign of an
int can cause problems, but that's assuming the int is numeric. And it
doesn't help that unsigned char promotes to int instead of unsigned int.
2024-09-24 10:54:17 +09:00
Bill Currie
e3d403cada [vulkan] Mark read-only buffers as such
Recent vulkan validation layers started complaining about vertex
processing stages having read-write buffers without atomics enabled
(fair enough), but I decided to get all the buffers that don't need to
be written.
2024-09-24 10:44:59 +09:00
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
3f66dc1164 [gamecode] Use only scalar types for basic encodings
I'm surprised other types weren't affected, but vec4's ecoding was being
picked up for float. Thankfully, all that was needed was checking width
and columns.
2024-09-13 21:25:57 +09:00
Bill Currie
e9d5bac369 [gamecode] Support debug print of matrices 2024-09-05 13:16:22 +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
fe16fed01a [vulkan] Update vkgen for the newly added bool type
I had forgotten about this, and ironically it's just one field in all of
vkparse, but adding support for bool to vkgen was easier than expected.
2024-09-04 10:33:10 +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
bdac574e69 [console] Avoid reliance on signedness of char
It turns out char defaults to unsigned on arm (using gcc, at least).
Avoid the issue completely by checking the bit rather than the sign.
2024-04-24 08:30:37 +09:00
Bill Currie
75e293789a [vulkan] Fix yet another sync validation error
*sigh*
2024-04-18 23:22:26 +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
b632d1dc52 [vulkan] Fix some more sync validation errors
These were a little harder to find, especially the lighting ones.
2024-04-18 10:03:26 +09:00
Bill Currie
61e6332473 [vulkan] Fix a pile of synchronization issues
Recent changes to the validation layers got more aggressive in their
checks and found a bunch of incorrect barriers (and some missing ones).
2024-04-18 10:03:26 +09:00
Bill Currie
e0d9410469 [vulkan] Add support for external subpasses
However, they're really for specifying external destination subpass
dependencies in order to ensure subpass transitions happen at the right
time.
2024-04-18 10:03:26 +09:00
Bill Currie
ceece02aa4 [vulkan] Reduce max shadow views to 17
Recent nvidia drivers now crash with more than 17 views when building
pipelines. Still no idea if it's me or the drivers. However, I really
need to come up with a way to use the render graph render passes as a
template so things aren't so hard-coded.
2024-04-18 10:03:26 +09:00
Bill Currie
2f8ffc4862 Merge branch 'master' into wip-ruaspirv 2024-04-18 09:46:10 +09:00
Bill Currie
ea77bed623 [skin] Fix weird fullbrights on gl models
All due to uninitialized data.
2024-02-25 14:45:46 +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
925dba732c [build] Add an option to enable ubsan
It's disabled by default because it's a runtime thing and I'm not sure I
want to keep it enabled, but it did find some issues (which I've cleaned
up), although it didn't find the problem I was looking for :P
2024-02-21 22:41:08 +09:00
Bill Currie
e298771d50 [ruamoko] Set the va_list parameter for error:
I'm not sure this is quite right, but at least now I get the right
runtime error (doesn't recognize instead of argc/format mismatch).
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
d7a1bb5a01 [gamecode] Use designated initializer syntax for structs
Mostly for consistency with arrays, but also it may be useful for
cutting and pasting data.
2024-02-21 22:41:08 +09:00
Bill Currie
4576de816d [gamecode] Print array contents in pr_debug_array_view
This makes it much easier to check data in progs files.
2024-02-21 22:41:08 +09:00
Bill Currie
32a8287fc1 [ruamoko] Add some functions to get joints
Still not very useful, but the internal format for iqm is proving to be
rather limiting.
2024-02-20 16:46:02 +09:00
Bill Currie
cf814cd9d1 [input] Fully initialize the focus event 2024-02-20 16:46:02 +09:00
Bill Currie
09d0e6b27c [render] Add tracy zones to render progs 2024-02-08 13:56:59 +09:00
Bill Currie
9247834a2f [vulkan] Remove a duplicate tracy zone
Fixes a compile failure when profiling.
2024-02-08 13:56:59 +09:00
Bill Currie
12ecc81470 [input] Use non-blocking IO for reading events
evdev can send multiple event packets for a single "event", but QF was
reading them one per frame, thus the feeling of buffered input at lower
frame rates (because they were buffered in the kernel). This also takes
care of most of the jerky motion with my 3d mouse, though there is still
a weird snap every second or so when rotating and translating at the
same time.
2024-02-02 08:41:26 +09:00
Bill Currie
9998a9b2c4 [vulkan] Clean up a couple of issues
found via using a new render setup. Just a stray commented bit of code
and lights affecting qskin alpha.
2024-02-02 07:31:52 +09:00
Bill Currie
06d9b1a056 [vulkan] Use provided config property list
There's still a lot of work needed to separate out quake from
quakeforge, but this lets my test scene get a rather mangled scene
rendering (weird translucency: not sure what I've done wrong: probably
bad clear).
2024-02-01 22:07:40 +09:00
Bill Currie
11d970c7c9 [vulkan] Avoid segaults when reporting errors
Never fun.
2024-02-01 22:04:06 +09:00
Bill Currie
e96050daa5 [vulkan] Allow deletion of some null resources
I very much doubt it's all of them but it was enough to let QF shutdown
cleanly mid-initialization.
2024-02-01 22:03:28 +09:00
Bill Currie
a50eaab1e6 [cmem] Allow delete_memsuper on null memsuper
While not done for freeing cmem blocks, it helps clean up shutdown code
when the memsuper may not have been created.
2024-02-01 22:00:26 +09:00