Commit graph

14185 commits

Author SHA1 Message Date
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
0199c44374 [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-10-17 10:39:20 +09:00
Bill Currie
baa4099de6 [io_qfmap] File off a pile of bitrot
While much is broken, especially textures, e4m8.map successfully imports
into blender 4.2-ish, and even the entity relation lines seem to work
(which surprised me as those were the first sign of trouble).
2024-08-11 20:28:38 +09:00
Bill Currie
a037f9146a [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:32:23 +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
073c93eebf [qfcc] Don't split basic blocks on function calls
This allows the dags code to optimize the return values, and when I make
the node killing by function calls less aggressive, should make for many
more potential CSE optimizations.
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
03b2ee2a25 [qfcc] Delay creation of leaf nodes
Creating leaf nodes early gets in the way of supporting multi-call basic
blocks, and never really seemed right anyway.
2024-02-21 22:41:08 +09:00
Bill Currie
6d6a387a81 [qfcc] Treat move the same as assign in dags
This goes a long way towards allowing basic blocks to include multiple
function calls instead of always ending on a call.
2024-02-21 22:41:08 +09:00
Bill Currie
277feaeb03 [qfcc] Support multivector expression to/from functions
The multivector is first assigned to a temporary then passed or returned
as usual.
2024-02-21 22:41:08 +09:00
Bill Currie
389571cbbe [qfcc] Handle pointer dereferences in offset casts
Offset casts are used heavily in geometric algebra, but doing an offset
cast on a dereferenced pointer (array index) doesn't work well for
assignments. Fixes yet another bug in my test scene :)
2024-02-21 22:41:08 +09:00
Bill Currie
62221b2735 [qfcc] Set the source location for compound init elements
Finally, less bouncing to the compound initializer's closing brace line.
2024-02-21 22:41:08 +09:00
Bill Currie
2be9821a59 [qfcc] Use statement aux def if def not in operands
This takes care of ptrmove instructions, fixing the printf problem in
ptrstructinit. It might even make it possible to not break basic blocks
on function calls, which should make for some more optimization
opportunities, but that can come later.

For this to work properly, it was necessary to avoid converting alias
defs to st_alias nodes.

It also fixes ptrstructinit itself (at first, I hadn't noticed that the
test passed entirely).
2024-02-21 22:41:08 +09:00
Bill Currie
07ef862c52 [qfcc] Put problematic printf into ptrstructinit
It turns out the bug I was chasing in set_poses was not the data getting
lost or incorrect data being read, but the arguments to printf being set
from the parent pose `p` before `p` had actually been set.
2024-02-21 22:41:08 +09:00
Bill Currie
00781160e2 [qfcc] Remove the node from its own edges
This gets rid of the funny little self-loop edge in dags dot files that
has bothered me for a while. It was just because the node to which an
identifier was attached happened to be the parent of the identifier's
leaf node.
2024-02-21 22:41:08 +09:00
Bill Currie
b842913ca9 [qfcc] Remove special treatment for flow/func statements
The fix in bdafdad0d5 for
`while (count--)` never did appeal to me. I think I understood the core
problem at the time, but I hadn't figured out how to use a var's
use/define sets to detect the write-before-read. Using them allows the
special handling for flow control to be removed, making things more
robust. The function call handling has been superfluous since the
Ruamoko instruction set required the auxiliary operands on the call
statements.
2024-02-21 22:41:08 +09:00
Bill Currie
1fb4a556d7 [qfcc] Remove old ptrmove code from dag creation
It doesn't seem to help any, and removing it doesn't break anything
(that is tested), and I'm working on better handling of ptrmove support.
2024-02-21 22:41:08 +09:00
Bill Currie
9a38cdfd78 [qfcc] Clean up dag item counting and init
Not by much really, but using one "aux" count instead of different
types, and using functions to iterate through the statement's aux
operands makes the code easier to read.
2024-02-21 22:41:08 +09:00
Bill Currie
768113d37b [qfcc] Replace expr_file_line with a scoped version
Two birds with one stone: eliminates most of the problems with going
const-correct with expr_t, and it make dealing with internally generated
expressions at random locations much easier as the set source location
affects all new expressions created within that scope, to any depth.
Debug output is much easier to read now.
2024-02-21 22:41:08 +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
6e8c98433a [qfcc] Fix a missed const type_t 2024-02-21 22:41:08 +09:00
Bill Currie
b9aad99381 [qfcc] Clean up warning and notice return types
They never needed to return expr.
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
131ad9013c [qfcc] Tidy up expr_assign_copy a little
It proved that expr_assign_copy wasn't the cause of any problems, but I
cleaned up some of its types a little.
2024-02-21 22:41:08 +09:00
Bill Currie
35e2044bfa [qfcc] Fix nested compound initializers
Add static array indexing. This gets the compoundinit test working.
2024-02-21 22:41:08 +09:00
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