Commit graph

6455 commits

Author SHA1 Message Date
Bill Currie
67003c146a [vulkan] Use qfcc for compute shaders
While there's still a duplicate type bug causing validation failure for
partupdate.comp, everything builds.

Also clean up a few build issues surrounding shaders.
2025-02-16 19:03:11 +09:00
Bill Currie
ed84bbb532 [vulkan] Correct the type for MaxParticles
uint is used for other things, so this is more correct (and stops qfcc
from complaining (legitimately)).
2025-02-16 18:55:58 +09:00
Bill Currie
b67eb518e5 [vulkan] Comment out some unreachable code
When targeting spir-v, qfcc does do dead code removal yet, so the return
followed the previous return (with no intervening label) so caused the
shader to not pass validation.

Now the fragment shaders work (mostly: there's a problem with discard in
the sprite shader).
2025-02-16 11:25:44 +09:00
Bill Currie
81349ced5d [vulkan] Correct another sign error in QFV_PerspectiveTanFar
It turns out it was completely tangled up when I first wrote it. The
previous correction got things mostly right, but the overall sign was
wrong (ie, it gave -1..0 instead of 1..0)
2025-02-08 11:09:58 +09:00
Bill Currie
6bf5c047c1 [vulkan] Use qfcc for fragment shaders
Nothing works yet, though.
2025-02-05 10:51:53 +09:00
Bill Currie
34d5f724d0 [vulkan] Use qfcc for geometry shaders
Unsurprisingly, they have issues, but one step at a time :)
2025-02-05 10:21:45 +09:00
Bill Currie
2c7a6c8a87 [vulkan] Switch to qfcc for the vertex shaders
Things aren't quite working yet (currently due to buffer blocks not
getting marked NonWritable (or maybe they should be BufferBlock)), but
this gets shader compilation via qfcc working at all, including
automatic dependencies.
2025-02-03 20:47:10 +09:00
Bill Currie
96375e870a [ruamoko] Update function names for IMP button/axis listeners
The function pointer changes made it necessary.
2025-01-25 18:44:56 +09:00
Bill Currie
21cf636875 [qtypes] Remove field_offset macro
And use offsetof instead: it has been standard (enough) in C for a
while.
2025-01-20 20:57:54 +09:00
Bill Currie
0ecd8f06bd [cexpr] Add support for long and ulong types
As int64_t and uint64_t. This gets everything building again.
2025-01-20 14:22:44 +09:00
Bill Currie
ea1c0a012b [cexpr] Correct size_t op types
I probably missed changing those unsigned types to size_t. Yay
case&paste programming :P
2025-01-20 14:18:31 +09:00
Bill Currie
1e052ad0dc [vkgen] Use correct types for 64-bit types
When I wrote vkgen's stdint.h, qfcc didn't support long or ulong, and
with the common init check, it now matters that the correct types are
used. It turns out some of my structs may not have been initialized
correctly, but with the next commits (long and ulong for cexpr), they
should be but do seem to be working at least.
2025-01-20 14:18:15 +09:00
Bill Currie
498288b630 [build] Fix some distcheck issues
Let's do the distcheck again...
2025-01-20 08:33:57 +09:00
Bill Currie
96a6c91747 Merge branch 'wip-ruaspirv'
This is more a check-point merge to get the more general qfcc
improvements onto master, as well as several vulkan fixes.
2025-01-20 01:41:33 +09:00
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
7314ebde0c [script] Add Script_GetLine and handle BOM
Both came about while working on KSP modding and eventually found there
way into script.py in qfmap. This gets the changes into the C
implementation.
2024-10-20 12:22:54 +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
79bebde069 [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:04:09 +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
3f61d22e6a Adjust lex files to work with updated git flex
While my modified version is needed to actually avoid warnings (vs
upstream git flex), the files still work with debian's flex (with no
warnings). I needed to update (and fix) flex so the lexer line numbers
would be correct.
2024-10-17 11:02:19 +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