Commit graph

6437 commits

Author SHA1 Message Date
Bill Currie
974306fa12 [gamesource] Correct columns for bitops
bitnot doesn't use operand b so its columns needs to be 0, not 1.
2025-01-18 20:36:23 +09:00
Bill Currie
ccd42c5c21 [x11] Support the XScreenSaver extension
And use it in preference to the crusty old XSetScreenSaver API. This
should work on modern systems (though might need to support the dbus
method too, but that can wait).
2025-01-12 23:29:57 +09:00
Bill Currie
4db018ee47 [gamecode] Set basic type columns for debug
Unfortunately, printing 0 columns means printing nothing.
2025-01-10 00:50:40 +09:00
Bill Currie
c0004ed7d5 [plist] Always calc string length
Making the string length calc based on !json was a mistake that resulted
in running off the end of the dstring.
2025-01-04 23:21:04 +09:00
Bill Currie
6f39722a05 [console] Update input line builtin for function ptr changes 2025-01-04 00:00:37 +09:00
Bill Currie
4800fef4fd [qfcc] Give short and ushort width of 1
I'm not sure why I thought a width of 0 was a good idea, but it proved
to be problematic when implementing matrices.
2024-12-04 23:47:58 +09:00
Bill Currie
5c822f6579 [gamecode] Tidy up shiftops a little
The various indices were a little inconsistent making modifications
tricky. I discovered that signed left-shifts are considered UB if the
value overflows the non-sign bits (but unsigned left shifts are fine),
and signed right shifts are implementation dependent. Whee. However,
it's likely that signed right shifts can be relied upon, at least well
enough for unit tests. I imagine signed left, too, but I plan on
converting them to unsigned. Also, negative shift values are UB, but
that's less of a worry, but also needs "fixing" (ie, make unsigned).
However, later.
2024-11-28 23:41:07 +09:00
Bill Currie
d418c4b8c4 [gamecode] Tweak matrix product instruction names
The name for VMMUL was outright wrong (outer), but both MVMUL and VMMUL
can be mul because of the type and width/columns specifiers. I think
OUTER can too, but I'll leave that for now.
2024-11-28 21:07:30 +09:00
Bill Currie
b2a1a3c791 [vulkan] Add source barrier to packet scatter and image copy
I got a sync validation error on a scatter command (I think) thus the
setting was probably wrong. Most of the parameters are still what they
were, but I'll be able to tweak the barriers as necessary.
Unfortunately, it didn't help with the hang on fetching the light cull
query data when starting in fisheye mode (no hang when enabling fisheye
after startup). I'm not sure what's going on there other than the
queries aren't getting updated: the counts seem to be fine so maybe the
commands aren't running. I've probably got a tangled mess of
pseudo-parallel command buffers: I need to go through my system and
clean everything up.
2024-11-27 20:15:51 +09:00
Bill Currie
2c313a87c6 [gamecode] Fix some tangled rows and columns
I'd suspected I had some mistakes in there, but I didn't expect gcc to
find them for me.
2024-11-26 16:28:15 +09:00
Bill Currie
9c394c02f8 [gamecode] Correct some instruction column specs
Getting qfcc to use columns when selecting instructions proved to be not
too difficult. I think I'm more surprised at how few errors there were.
2024-11-26 10:40:10 +09:00
Bill Currie
efc1fdbd29 [gamecode] Add matrix instructions
Only matrix-vector, vector-matrix and vector-vector outer products (no
more room), but that's enough to get decent performance out of
matrix-matrix and matrix-scalar (both of which can be done as a set of
matrix-vector or vertex-scalar products).

Progs version bumped because I found that I'd put the swizzle and 2d
wedge ops in the wrong spot (compared to both intention and docs) and
rather than adjust the docs, I took advantage of the opportunity to get
a nicer layout for the wedge products (nestled into the spare slots left
by the 2x2 matrix ops, which seems fitting as the 2d wedge is the
determinant of a 2x2 matrix).
2024-11-26 00:22:56 +09:00
Bill Currie
d082d39e17 [qfcc] Use count for number of array elements
I got tired of seeing size when count is the real intent (mistake copied
from C++).
2024-11-17 15:27:10 +09:00
Bill Currie
ebb3ec592a [qfcc] Implement bool and lbool types
Since spir-v needs actual bools for its conditional instructions, the
time to do bool properly finally came. As expected, the changes caused
quite a mess, but Ruamoko now does bool/true/false.
2024-11-15 12:36:08 +09:00
Bill Currie
addf877416 [vulkan] Correct a sign error in QFV_PerspectiveTanFar
Unfortunately, the function isn't used yet, so it's easy to miss. I just
happened to notice things didn't look right when looking at my
projection matrices.
2024-11-03 16:58:10 +09:00
Bill Currie
bff709e71d [plist] Fix a purity issue in the json test
I guess I forgot to do a `make check` with optimized builds.
2024-10-26 23:34:55 +09:00
Bill Currie
164c949796 [plist] Add a test mode to get parse timings
It turns out parsing runs at about 40-55MB/s, but that may be down to
allocations.
2024-10-19 02:19:01 +09:00
Bill Currie
d780146be3 [plist] Fix json parsing and test
It turns out my test was backwards: it fed the json text into a string
object then pulled it out, which of course round-tripped correctly. Now
things do round-trip correctly, but I had to ignore white-space
differences and edit the numbers as text->double->text doesn't
necessarily round-trip well (though double->text->double does with 17
digits).
2024-10-19 02:15:27 +09:00
Bill Currie
cb0eeb9366 [vulkan] Remove duplicate descriptor set layout
Don't need two identical descriptor set layouts for particles.
2024-10-19 00:28:27 +09:00
Bill Currie
427d239008 [simd] Fix uninitialized warning hidden by lto
It turns out lto was hiding an uninitialized warning that showed up with
gcc-14.
2024-10-17 11:03:03 +09:00
Bill Currie
a0e4aa487f [ui] Pass text verticality and font to configure_textview
They're not actually used yet because all the calculations are giving me
a headache, but the improved handling of text direction in
Text_PassageView, along with passing the information, is important
enough, I think.
2024-10-10 14:09:24 +09:00
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