Commit graph

14155 commits

Author SHA1 Message Date
Bill Currie
19965e7cbd [qfcc] Add a failing test case for compound initializers
It turns out that compound intializers break on when the nesting level
increases (eg, initializing vectors in structs in arrays).
2024-02-21 22:41:08 +09:00
Bill Currie
1b4db639af [qfcc] Handle quaternion (in)equality tests
I'm surprised this didn't come up earlier.
2024-02-21 22:41:08 +09:00
Bill Currie
0e7c80e9fe [qfcc] Use ud-chains for ptrmove pointer analysis
ptrmove was not treating its indirect source operand as used because the
pointer wasn't checked for its source.

This fixes part of ptrstructinit, but there's a lot more breakage in
that test: it looks like all sorts of fun with arrays.
2024-02-21 22:41:08 +09:00
Bill Currie
ab69e65e02 [qfcc] Add failing test case for pointer struct initialization 2024-02-21 22:41:08 +09:00
Bill Currie
3a22091455 [qfcc] add pointer validity check function to test-harness 2024-02-21 22:41:08 +09:00
Bill Currie
192eb11235 [qfcc] Dereference most array types properly
This should prevent some fun bugs in the future (it's what necessitated
the const-correct patch).
2024-02-20 16:47:06 +09:00
Bill Currie
f0dfe47a32 [qfcc] Make type_t mostly const-correct
There were a few places where some const-casts were needed, but they're
localized to code that's supposed to manipulate types (but I do want to
come up with something to clean that up).
2024-02-20 16:47:04 +09:00
Bill Currie
6e71aadfa4 [qfcc] Use dereference_type for initialized arrays
In particular, when the size is inferred from the compound initializer.
Fixes a fun "incomplete type" error.
2024-02-20 16:46:02 +09:00
Bill Currie
fa5c3ab12e [qfcc] Support arrays in dereference_type
This is needed to get the correct type from arrays of typedefed
elements.
2024-02-20 16:46:02 +09:00
Bill Currie
827ca3cf27 [qfcc] Make array_type const-correct
As such... need to cast away the const when calling append_type (which
should probably become internal).
2024-02-20 16:46:02 +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
3d26aafbea [qfcc] Unalias def ops too
When I implemented the st_alias handing (d8a78fc849) I was
unsure if I needed to unalias aliased defs too, but it turns out to have
been necessary: this is what caused my 2d PGA dynamics test to blow up
strangely due to the GA vector loaded from an array into a local
variable getting the local var replaced by a temp but the var itself
being read later in the code (uninitialized variable due to incorrect
optimization... oops).
2024-02-20 16:46:02 +09:00
Bill Currie
37fe0bc4ed [qfcc] Fix some 2d PGA bugs
When sum_expr gets a null expression as one of its args, it simply
returns the other arg, but that arg needs to have the correct type
applied.

Handle zero (null result) cross product in bivector geometric product.

Clean up types in bivector * vector geometric product.
2024-02-20 16:46:02 +09:00
Bill Currie
946211bca2 [qfcc] Use a better name for a var
Looking at the code afterwards, I realized flips would be a far better
name than mask. Not sure what I was thinking when I wrote the code.
2024-02-20 16:46:02 +09:00
Bill Currie
e9cea29cae [gatest] Implement undual and antiwedge 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
7509916d71 [qwaq] Clean up some debug output
Some leftover prints from getting geometric algebra support working in
qdb.
2024-02-20 16:46:02 +09:00
Bill Currie
40f04ff33e [qfcc] Implement undual and use for regressive product
I'm not sure the regressive product is right (overall sign), but that's
actually partly a problem in the math itself (duals and the regressive
product still get poked at, so it may be just a matter of
interpretation).
2024-02-20 16:46:02 +09:00
Bill Currie
10861986fb [qfcc] Add tests for the hodge dual 2024-02-20 16:46:02 +09:00
Bill Currie
d319ce6106 [qfcc] Support multi-vector comparison
I'm not sure anything other than == or != has much meaning on anything
but scalars and pseudo scalars, but all comparisons are supported as a
simple boolean test. Any missing components are assumed to be 0. If
nothing else, it makes unit tests easier to write.
2024-02-20 16:46:02 +09:00
Bill Currie
11b247918e [qfcc] Find current algebra context for duals
Now finding the dual of a scalar works, too (need a context as otherwise
the pseudo-scalar is unknown).
2024-02-20 16:45:55 +09:00
Bill Currie
e56b4a3a6d [qfcc] Strip off algebra types internally
It turns out the algebra types make expression dag creation much more
difficult resulting in missed optimizations (eg, recognizing `a × a`).
This fixes the dead cross products in `⋆(s.B × ⋆s.B)`
2024-02-08 13:56:59 +09:00
Bill Currie
cf756eb1a0 [qfcc] Emit statements for expressions only once
The switch to using expression dags instead of trees meant that the
statement generator could traverse sub-expressions multiple times. This
is inefficient but usually ok if there are no side effects. However,
side effects and branches (usually from ?:, due to labels) break: side
effects happen more than once, and labels get emitted multiple times
resulting in orphaned statement blocks (and, in the end, uninitialized
temporaries).
2024-02-08 13:56:59 +09:00
Bill Currie
701b0f3992 [qfcc] Print block label expressions first
Just running through the list of expressions in a block expression
results in label expressions within the block getting printed by
expressions that reference them and thus don't receive the correct next
pointer and wind up pointing to themselves. Printing the labels first
ensures they have the correct next pointer. However, I suspect there are
other ways things will get tangled.
2024-02-08 13:56:59 +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
3affd3582b [qwaq] Add an init_graphics function
This allows qwaq programs to provide a renderer configuration property
list.
2024-02-01 22:07:48 +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
Bill Currie
999f878b76 [vulkan] Rename alias_sampler to qskin_sampler
It's shared by both alias and iqm models.
2024-02-01 21:58:12 +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
140fe93a9c [vulkan] Add some debug to the cascade shadows
It turns out what I thought was a cascade selection bug was just very
bad choice of cascade steps: factors of 8 just don't work nicely. I'm
not sure that simple factors work all that well, either. I need to make
the cascade system configurable and probably support more cascades.
2024-02-01 18:57:25 +09:00
Bill Currie
2996690bd1 [qwaq] Add a function to set imt context cbuf
Hopefully only temporary until I get ruamoko cbuf support done.
2024-02-01 15:28:43 +09:00
Bill Currie
926dd308c6 [renderer] Set default fog density to 0 2024-02-01 11:31:28 +09:00
Bill Currie
085f56367d [vulkan] Clear position.w to zero
This puts pixels that have not been rendered at infinity. I was rather
surprised to see fog in my test scene, but it depended on my position
relative to the origin, so something was definitely off (the pixels were
at the origin).
2024-02-01 11:27:08 +09:00
Bill Currie
c1b38196d1 [vulkan] Make CSM ranges consistent
I'm not sure why the final range was only a factor of 4 instead of 8.
There are still issues with range selection, but I'll look into them in
a bit (flying around my little test scene really shows the problems).
2024-02-01 11:24:16 +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
1bcc4dddb6 [ruamoko] Wrap some more input functions
IN_UpdateAxis (for nice handling of axis updates, especially relative
motion for mice) and IN_Binding_HandleEvent because registering an event
handler blocks qwaq's internall call to IN_Binding_HandleEvent.
2024-02-01 11:16: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
5fef8e6edb [qfcc] Implement quaternion multiplication
I'm surprised it took almost two years to discover that I had no
quaternion multiplications in any test code, but getting an ICE for a
quaternion-vector product, and the Hadamard product for
quaternion-quaternion was a bit of a nasty surprise.
2024-02-01 11:00:27 +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
0af727341f [qwaq] Use a qwaq-specific dirconf
While it breaks my little toy game I've been working on (long overdue,
really) and my test scene, at least now qwaq is a little more
independent of quake.
2024-01-31 00:19:20 +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
1d0b0f85af [vulkan] Return nullptr for missing cachepics
Better than storing such in the hash table only to get a segfault on
shutdown.
2024-01-31 00:14:16 +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