Commit Graph

5085 Commits

Author SHA1 Message Date
Bill Currie 42db8514ae [gamecode] Use version instead of locals count
It turned out I need locals count and params_start for debugging, so use
the progs version instead to bail early from PR_EnterFunction and
PR_LeaveFunction (which I had forgotten anyway, oops).
2022-01-27 11:24:00 +09:00
Bill Currie a0d9cf8d8e [gamecode] Improve verbose statement prints for Ruamoko
They now include base register index and effective address of the
operands (though it may be wrong for instructions that don't use a base
register for that operand).
2022-01-27 10:57:31 +09:00
Bill Currie 59ee723201 [gamecode] Rename parm to param
That misspelling bothered me from the very beginning, I'd always have
trouble getting the name right when trying to access one of those fields.
2022-01-27 10:55:06 +09:00
Bill Currie e9dff4ff9c [gamecode] Correct types and widths for bitnot
bitnot is the only unary operator in the bitops group and thus needs
special handling.
2022-01-27 10:21:48 +09:00
Bill Currie faa98d8198 [gamecode] Use a struct for offset/count pairs
This cleans up dprograms_t, making it easier to read and see what chunks
are in it (I was surprised to see only 6, the explicit pairs made it
seem to have more).
2022-01-26 19:30:25 +09:00
Bill Currie a2f4522e76 [gamecode] Align Ruamoko progs to 32 bytes.
Intel hardware requires 32-byte alignment for lvec4 and dvec4.
Unfortunately, it turns out that my attempts to align progs data in qfcc
went awry do to the order block sizes are calculated when writing the
progs.
2022-01-26 16:55:14 +09:00
Bill Currie ee4eecc741 [gamecode] Correct types and opname for memset and move 2022-01-26 12:26:12 +09:00
Bill Currie 6bc6db471d [gamecode] Make return use same addressing as other ops
This makes return consistent with load, store, etc, though its
addressing mode is encoded in bits 5 and 6 of c rather than the opcode.
It turns out I had no tests for any of return's addressing modes other
than basic def references, so no tests needed changing.
2022-01-26 09:51:11 +09:00
Bill Currie 37f08f9d4f [qfcc] Build the Ruamoko function parameters
The parameter defs are allocated from the parameter space using a
minimum alignment of 4, and varargs functions get a va_list struct in
place of the ...

An "args" expression is unconditionally injected into the call arguments
list at the place where ... is in the list, with arguments passed
through ... coming after the ...

Arguments get through to functions now, but there's problems with taking
the address of local variables: currently done using constant pointer
defs, which can't work for the base register addressing used in Ruamoko
progs.

With the update to test-bi's printf (and a hack to qfcc for lea),
triangle.r actually works, printing the expected results (but -1 instead
of 1 for equality, though that too is actually expected). qfcc will take
a bit longer because it seems there are some design issues in address
expressions (ambiguity, and a few other things) that have pretty much
always been there.
2022-01-24 23:44:48 +09:00
Bill Currie b663fecd4e [gamecode] Use PR_SetupParameters for rua called builtins
It's a bit heavy-handed as it sets all the param pointers, but simple
(no varargs) functions are working nicely in Ruamoko.
2022-01-24 16:46:49 +09:00
Bill Currie 00b7bced7f [gamecode] Rework PR_RESET_PARAMS to use PR_SetupParams
PR_SetupParams is new and sets up the parameter pointers so older code
that expects only up to 8 parameter will work with both v6p and Ruamoko
progs without having to check what progs are running. PR_SetupParams is
useful even when Ruamoko progs are expected as it reserves the required
space (respecting alignment) on the stack and returns a pointer to the
top (bottom? confusing) of the stack. PR_PushFrame and PR_PopFrame
need to be used around PR_SetupParams, regardless of using temp strings,
to avoid a stack leak (need to do an audit).
2022-01-24 12:50:15 +09:00
Bill Currie 9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie a818fa4b8e [gamecode] Rearrange bfunction_t in preparation for param offsets
The builtin and progs function data is overlaid so the extra data
doesn't cause too much memory to be used (it's actually 8 bytes smaller
now).  The plan is to pre-compute the offsets based on the parameter
size and alignment data.
2022-01-24 00:19:13 +09:00
Bill Currie a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie e746e39738 [gamecode] Create macros for progs sizeof and alignof
I wound up needing the idioms in too many places.
2022-01-23 14:29:33 +09:00
Bill Currie 3c86660d4a [gamecode] Rename MAX_PARMS to PR_MAXPARAMS 2022-01-23 14:17:25 +09:00
Bill Currie cfaf158ebc [math] Add some bit-op functions
Just 32-bit rounding to next higher power of two, and base 2 logarithm.
Most importantly, they are suitable for use in initializers as they are
constant in, constant out.
2022-01-23 13:47:14 +09:00
Bill Currie 861e98725c [gamecode] Return early if the entered function has no locals
As even the simplest v6p functions that take parameters but have no
local or temporary variables still have locals for the local copy of the
parameters, this is a both a good check for for the Ruamoko ISA as its
functions never have locals (everything's on the progs data stack), and
an optimization for v6p functions that have no params or locals (simple
getters (very rare?), most .ctor, etc).
2022-01-22 21:41:35 +09:00
Bill Currie 06b1ea6837 [gamecode] Tweak some docs and macro names
And fix an incorrect definition for RETURN_QUAT.

Prefixed MAX_STACK_DEPTH and LOCALSTACK_SIZE (and LOCALSTACK_SIZE got an
extra _).

The rest is just edits to documentation comments.
2022-01-22 11:38:14 +09:00
Bill Currie 7a5ee6a55a [gamecode] Initialize .stack if it's available
And implement bounds checks for adjstk.
2022-01-21 20:33:15 +09:00
Bill Currie 9199a0ee54 [gamecode] Don't check v6p progs for Ruamoko progs
It doesn't end well. For now, the Ruamoko check is just a stub, but I do
plan on doing similar checks.
2022-01-21 20:31:49 +09:00
Bill Currie 3df46d197f [gamecode] Add instructions for stack adjust, nop, and ldconst
ldconst isn't implemented yet but the plan is to load various constants
(eg, 0, 1, 2, pi, e, ...).

Stack adjust is useful for adding an offset to the stack pointer without
having to worry about finding it (and it checks for alignment).

nop is just that :)
2022-01-21 20:00:38 +09:00
Bill Currie c53127707b [qfcc] Set the return of Ruamoko calls
Of course, I had the width of opc wrong :P. But with this, it seems that
unoptimized calls should work once I get the stack frame working.
2022-01-21 13:50:21 +09:00
Bill Currie 16a203c643 [gamecode] Partially implement conversion code debug
The code is simply printed in octal for now, but it's better than
breaking the rest of the format string.
2022-01-21 10:12:50 +09:00
Bill Currie 578314c5a3 [gamecode] Use a buffer for discarded return values
Due to how OP_RETURN works, a destination is required for any function
returning data, but the caller may not have allocated any space for the
value. Thus the VM maintains a buffer into which the data can be put and
ignored. It also makes a good place for return values when the engine
calls Ruamoko code as trusting progs code with return sizes seems like a
recipe for disaster, especially if the return location is on the C
stack.
2022-01-21 10:09:02 +09:00
Bill Currie 4b87d24737 [gamecode] Correct call's operator types 2022-01-21 10:07:35 +09:00
Bill Currie 5f66bfe887 [gamecode] Update printed opcode width
Opcodes now need 3 hex digits (hexits?) to print.
2022-01-20 18:37:28 +09:00
Bill Currie c39558efaa [gamecode] Audit the widths of rest of the instructions
I can't test them properly until I get qfcc up and running with basic
ruamoko code, but they are at least more correct than they were.
2022-01-20 17:27:56 +09:00
Bill Currie 854e45485a [gamecode] Correct the widths for load, store and lea
The different addressing modes complicate the width calculations, and
lea is particularly fun in that it doesn't care what the width of value
is.
2022-01-20 16:33:04 +09:00
Bill Currie e20aed5c5a [gamecode] Change address mode B to entity.field
It turned out that address mode B was redundant as C with 0 offset
(immediate) was the same (except for the underlying C code of course,
but adding st->b is very cheap). This allowed B to be used for
entity.field for all transfer operations. Thus instructions 0-3 are now
free as load E became load B, and other than the specifics of format
codes for statement printing, transfers+lea are unified.
2022-01-20 14:55:29 +09:00
Bill Currie 6ae9daf4b7 [gamecode] Clean out dead any/all/none data
The instructions are gone as hor/hand/hnor take care of them.
2022-01-20 14:52:59 +09:00
Bill Currie 875d4dc7cf [gamecode] Correct some ruamoko instruction meta data
There were some errors in instruction names and operand types resulting
in unsearchable instructions.
2022-01-20 13:08:05 +09:00
Bill Currie a4ebd6aa58 [gamecode] Fix a few missed opcode renames
if and ifnot became ifnz and ifz, and return_v lost its tail (it was
always redundant, except in dags, and that's fixed with a pointer check).
2022-01-20 13:07:57 +09:00
Bill Currie 143030fec4 [gamecode] Use text for all v6p opcode names
This makes the v6p instruction table consistent with the ruamoko
instruction table, and clears up some of the ugliness with the load,
store, and assign instructions (. .= and = are now spelled out). I think
I'd still prefer an enum code (faster) but at least this is more
readable.
2022-01-20 09:26:01 +09:00
Bill Currie df890432b7 [qfcc] Add support for unsigned, long, etc
long is ignored for double, and v6p progs are stuck with 32 bits for
longs (don't feel like extending v6p any further), but the basics are
there for Ruamoko.

short is ignored for ints because the minimum size is 32, and signed is
just noise for ints anyway (and no chars, so...).

unsigned, however, is finally implemented properly (or at least seems to
be working correctly: tests pass after getting things compiling again,
and lt.u is used where it should be :)
2022-01-19 18:08:58 +09:00
Bill Currie 8d20997b2b [gamecode] Move pr_void_t to pr_comp.h
I think I had decided to put it there but forgot before committing the
size change, but I wound up needing it for qfcc.
2022-01-18 22:58:26 +09:00
Bill Currie 068c04ece6 [gamecode] Add ev_ushort and partial support
Really, only just enough to get everything compiling (which does include
vkgen running correctly).
2022-01-18 22:08:37 +09:00
Bill Currie ed501b7734 [gamecode] Specify the alignment for progs types
And provide a table for such for qfcc and the like. With this, using
pr_double_t (for example) in C will cause the double value to always be
8-byte aligned and thus structures shared between gcc and qfcc will be
consistent (with a little fuss to take care of the warts).
2022-01-18 18:41:39 +09:00
Bill Currie 25f8d3a23d [gamecode] Use pr_type_names.h for type sizes
The goal of the previous mess of commits. Ruamoko needs to wait until
qfcc has the new types.
2022-01-18 17:05:12 +09:00
Bill Currie 2c52e26d1a [gamecode] Be more consistent with access types
Eg, pointers via ptr, entities via entity, etc.
2022-01-18 17:05:12 +09:00
Bill Currie cd30408675 [gamecode] Rename ev_quat to ev_quaternion
I much prefer the full name, though the short version is easier to type.
2022-01-18 17:05:12 +09:00
Bill Currie e9e54d08c0 [gamecode] Rename func_t to pr_func_t
Even more consistency.
2022-01-18 15:36:58 +09:00
Bill Currie afd1eb775b [gamecode] Rename ev_pointer to ev_ptr
Rather short (no worse than ev_int, though) but more consistency is
usually a good thing.
2022-01-18 14:36:06 +09:00
Bill Currie cfe7c44df0 [gamecode] Rename ev_integer to ev_int
And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
2022-01-18 13:27:19 +09:00
Bill Currie 978d6fd3e8 [gamecode] Macro-ize the progs type names
Now they'll never get out of sync again :)
2022-01-18 13:27:19 +09:00
Bill Currie 2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie 9348f7b89c [gamecode] Preserve the return pointer across calls
This required delaying the setting of the return pointer by call until
after the current pointer had been saved, and thus passing the desired
pointer into PR_CallFunction (which does have some advantages for C
functions calling progs functions, but some dangers too (should ensure a
128 byte (32 word) buffer when calling untrusted code (which is any,
really)).
2022-01-17 19:12:28 +09:00
Bill Currie e9af549195 [gamecode] Fix some goofs in the callchain test
They made it difficult to tell when I got things working :P
2022-01-17 18:51:50 +09:00
Bill Currie 306fcbfbd0 [gamecode] Improve callchain test
Add another function call to further mess up the return value address
and verify just where it is pointing.
2022-01-17 16:55:39 +09:00
Bill Currie 89e120ba34 [gamecode] Make return support 32 words
This took interpreting the lower 5 bits of operand c as size - 1, and
0xffff as void (0 words).
2022-01-17 16:54:27 +09:00
Bill Currie 94ef9931a5 [gamecode] Add two more call/return tests
The two tests check that 32 words can be returned (fails) and that
function calls can be nested and their values returned properly (also
fails).
2022-01-17 16:30:13 +09:00
Bill Currie 736387bc88 [gamecode] Preserve base registers across calls
With this, functions can call other functions without having to worry
about whether the base registers they set up are still valid.
2022-01-17 15:08:58 +09:00
Bill Currie 8da1163a82 [gamecode] Add bases check to callret test
The base registers must be preserved across a function call and they
currently are not, thus the updated test fails again.
2022-01-17 14:59:17 +09:00
Bill Currie 213434b705 [gamecode] Save and restore data stack in call stack
This fixes the issue of the data stack not being restored properly
because the returning function needs to return a value from its local
variables (stored on the stack) and accessing stack data below the stack
pointer is a bad idea (sure, no interrupts yet, but who knows...).
2022-01-17 14:45:14 +09:00
Bill Currie 8e5c2c6534 [gamecode] Correct type of return address in stack
This is another one of those "why signed?" things: can't have negative
return addresses.
2022-01-17 14:43:43 +09:00
Bill Currie cf3106ce28 [gamecode] Correct call's mode selection
Call's operand c is used to specify where the return value of the
function is to be stored. This gets both the correct function being
called, and the value being returned correctly. Test still fails due to
the stack restoration issue.
2022-01-17 14:29:14 +09:00
Bill Currie b3909dbe4c [gamecode] Add a test for call and return
It currently fails for two reasons:
 - call's mode selection is incorrect (never updated from when there was
   only the one call instruction and the mode was encoded in operand c)
 - return should automatically restore the stack pointer to the value it
   had on entry to the function, thus allowing local values stored on
   the stack to be safely returned.
2022-01-17 14:26:12 +09:00
Bill Currie 56d8bdee82 [gamecode] Add a fixme about using gcc's vec convert
It might produce better code than the way I'm currently doing it.
2022-01-17 10:32:19 +09:00
Bill Currie 1beadbf871 [gamecode] Add tests for the branch instructions 2022-01-17 09:57:54 +09:00
Bill Currie 1baf17b780 [gamecode] Add tests for the jump instructions 2022-01-17 09:34:16 +09:00
Bill Currie 1397c94ef5 [gamecode] Add tests for the state instructions 2022-01-16 22:17:17 +09:00
Bill Currie 0bd05c71ac [gamecode] Use unsigned for entity values
I don't know why they were ever signed (oversight at id and just
propagated?). Anyway, this resulted in "unsigned" spreading a bit, but
all to reasonable places.
2022-01-16 22:15:18 +09:00
Bill Currie 2b82533526 [gamecode] Add double time state instructions
This has been a long-held wishlist item, really, and I thought I might
as well take the opportunity to add the instructions. The double
versions of STATE require both the nextthink field and time global to be
double (but they're not resolved properly yet: marked with
"FIXME double time" comments).

Also, the frame number for double time state is integer rather than
float.
2022-01-16 21:27:49 +09:00
Bill Currie d57712975e [gamecode] Add tests for the hops instructions
And, of course, fix a bug in the inverted hops (yay for tests).
2022-01-16 18:46:29 +09:00
Bill Currie 7ea12b3ff9 [gamecode] Implement the HOPS sub-instructions
In the end, I decided any/all/none should be separate from the other
horizontal ops, if I even do them (can be implemented by first
converting to bool, then using the appropriate horizontal operation (& |
etc).
2022-01-16 16:28:48 +09:00
Bill Currie 8050c7bd77 [gamecode] Rearrange several instructions
ANY/ALL/NONE have been temporarily removed until I implement the HOPS
(horizontal operations) sub-instructions, which will all both 32-bit and
64-bit operands and several other operations (eg, horizontal add).

All the fancy addressing modes for the conditional branch instructions
have been permanently removed: I decided the gain was too little for the
cost (24 instructions vs 6). JUMP and CALL retain their addressing
modes, though.

Other instructions have been shuffled around a little to fill most of
the holes in the upper block of 256 instructions: just a single small
7-instruction hole.

Rearrangements in the actual engine are mostly just to keep the code
organized. The only real changes were the various IF statements and
dealing with the resulting changes in their addressing.
2022-01-16 14:22:04 +09:00
Bill Currie dc4df49fff [gamecode] Add tests for the swizzle instructions
While not always generated (yet?) the tests are at least in. Just not
sure about auto-generated tests that can't be hand-edited.
2022-01-15 22:44:58 +09:00
Bill Currie 49dcd5ef40 [gamecode] Add tests for the with instruction(s)
While mode 4 was tested a lot, none of the rest were. Also added a full
reset instruction.
2022-01-15 18:44:11 +09:00
Bill Currie 38ab0f0243 [gamecode] Move pushregs and popregs into with
This frees up another two instructions.
2022-01-15 16:51:59 +09:00
Bill Currie a14b9f8252 [gamecode] Move the lea block
It just feels better with it being close the load/store etc
2022-01-15 16:39:52 +09:00
Bill Currie e133de8c89 [gamecode] Drop B addressing for lea
When creating the tests for lea, I noticed that B was yet another simple
assign, so I decided it was best to drop it and move E into its place
(freeing up another instruction).
2022-01-15 16:27:46 +09:00
Bill Currie 11e89c8c97 [gamecode] Add tests for lea 2022-01-15 16:07:11 +09:00
Bill Currie fae432f46e [gamecode] Make no-op conversions simple copies
Most useful for 64-bit values as only one instruction is needed to move
the data around rather than two, but could be slightly faster for 32-bit
as the addressing is simpler (needs profiling).
2022-01-15 15:44:53 +09:00
Bill Currie bffcbfc9fc [gamecode] Add tests for bitops 2022-01-15 13:59:03 +09:00
Bill Currie 7cd398d4a7 [gamecodee] Add tests for move and memset 2022-01-15 13:20:33 +09:00
Bill Currie 6f1f56aea7 [gamecode] Make commented braces match
They annoyed me
2022-01-14 22:51:18 +09:00
Bill Currie 1aa4844bf6 [gamecode] Make string ops mostly conform with bools
The compare/ne operator returns "random" -ve, 0, +ve values (really,
just the numerical difference between the chars of the strings), but all
the rest return -1 for true and 0 for false, as with the rest of the
comparison operators.
2022-01-14 22:44:08 +09:00
Bill Currie c8362c28fe [gamecode] Add tests for string ops
Does not include string concatenation because I don't feel like messing
with zone init, but all the other operators are tested (currently
failing due to bool convention)
2022-01-14 22:42:56 +09:00
Bill Currie f4eeed36b7 [gamecode] Add tests for the scale instructions 2022-01-14 19:46:35 +09:00
Bill Currie 1a2ac24d8d [gamecode] Make num_globals() calculate actual globals
It calculating only the size of the array (which was often 4 or 8
globals per element) proved to be a pain when I forgot to alter the size
for the new scale tests. Fixing the size calculation even found a bug in
the shiftop tests.
2022-01-14 19:45:51 +09:00
Bill Currie a81067603c [gamecode] Mention possibly undefined behavior
It seems casting from float/double to [unsigned] int/long when the value
doesn't fit is undefined (which would explain the inconsistent results).
Mentioning the possibility seems like a good idea should the results for
such casts change and cause the tests to fail.
2022-01-14 16:52:44 +09:00
Bill Currie a1c1c9fcf0 [gamecode] Add test for conversions to double
And fix an incorrect base index in the bool64 tests.
2022-01-14 15:51:49 +09:00
Bill Currie 1f73b26d24 [gamecode] Correct incorrect bool32-bool64 conversion
And add tests for long, ulong and bool64 conversions.
2022-01-14 14:54:35 +09:00
Bill Currie 4bf934e6b9 [gamecode] Correct incorrect bool64-bool32 conversion
And add tests for float, uint and bool32 conversions.
2022-01-14 13:54:03 +09:00
Bill Currie e26fb49df7 [gamecode] Get conversion to int working for all types
Bools turned out to be a problem to due to me wanting any non-zero value
to be treated as true thus had to expand them out as well as the
floating point <-> integral conversions.
2022-01-14 12:11:23 +09:00
Bill Currie cd68455e46 [gamecode] Add tests for converting to int
They currently fail because for vector values, gcc casts the view, not
the value, so vec4 cast to ivec4 simply views the bits as int rather
than doing the actual conversion.
2022-01-14 12:11:22 +09:00
Bill Currie e8e0a69628 [gamecode] Add conversions to/from bool
For now, from bool results in 0/1, but conversion to bool guarantees
0/-1 and correct interpretations for floating point types.
2022-01-13 17:37:44 +09:00
Bill Currie ba1d73200f [gamecode] Clean up a pile of duplicate code
All those duplicated formats were getting unwieldy, especially as I want
to add more conversion modes.
2022-01-13 16:10:06 +09:00
Bill Currie 3eb2194343 [gamecode] Invert the meaning of the skip matrix
Rather than specifying that the conversion should be skipped, it now
specifies the mode of the conversions (with 0 being no conversion). This
is in preparation for boolean conversion.
2022-01-13 15:58:12 +09:00
Bill Currie 6f6f47e27e [gamecode] Drop bool ops in favor of long bit ops
I realized that being able to do bit-wise operations with 64-bit values
(and 256-bit vectors) is far more important than some convenient boolean
logic operators. The logic ops can be handled via the bit-wise ops so
long as the values are all properly boolean, and I plan on adding some
boolean conversion ope, so no real loss.
2022-01-13 14:24:11 +09:00
Bill Currie 424bdcbf96 [gamecode] Implement the scale instructions
Both float 2,3,4 vectors and double 2,3,4 vectors (1 would be just a
copy of the mul instructions).

This completes the currently planned instructions. Now for testing.
2022-01-13 13:53:07 +09:00
Bill Currie 3587b13a40 [gamecode] Implement the conversion instructions
Not all possibilities are supported because converting between int and
uint, and long and ulong is essentially a no-op. However, thanks to
Deek's suggestion, not only are all reasonable conversions available,
conversions for all widths are available, so vector conversions are
supported.

The code for the conversions is generated.
2022-01-13 13:51:24 +09:00
Bill Currie f7181a09b4 [gamecode] Add tests for shiftops
They're in test-unsigned because 2/3 of them are unsigned.
2022-01-12 10:24:59 +09:00
Bill Currie 6229ae8ecc [gamecode] Add tests for unsigned comparisons
And fix the implementation: I had used the wrong macro.
2022-01-11 13:00:54 +09:00
Bill Currie e7d7ec1989 [gamecode] Add tests for signed comparison ops
Fortunately, they all pass without issues.
2022-01-11 09:37:38 +09:00
Bill Currie 0fb6619585 [gamecode] Compact the convert instructions into one
Thanks to Deek for the suggestion: the mode (ie, src and dst types) are
encoded in st->b. Actual code not written yet, but this frees up 13
instructions: now have 74 available for really interesting stuff :)
2022-01-10 11:53:57 +09:00
Bill Currie b9e32ee2f5 [gamecode] Rework call and return instructions
The call1-8 instructions have been removed as they are really not needed
(they were put in when I had plans of simple translation of v6p progs to
ruamoko, but they joined the dinosaurs).

The call instruction lost mode A (that is now return) and its mode B is
just the regular function access. The important thing is op_c (with
support for with-bases) specifies the location of the return def.

The return instruction packs both its addressing mode and return value
size into st->c as a 3.5 value: 3 bits for the mode (it supports all
five addressing modes with entity.field being mode 4) and 5 for the
size, limiting return sizes to 32 words, which is enough for one 4x4
double matrix.

This, especially with the following convert patch, frees up a lot of
instructions.
2022-01-10 11:53:14 +09:00
Bill Currie ba29be3f82 [gamecode] Rename ifnot and if to be less confusing
I think :) anyway, now they're ifz and ifnz, making them consistent with
the rest of the if instructions.
2022-01-10 11:27:57 +09:00
Bill Currie db7a67e5b7 [gamecode] Rearrange vector instructions
This allows the dot products to be consistent with their sizes: cdot is
really dot_2, vdot dot_3, and qdot dot_4.
2022-01-10 11:16:55 +09:00
Bill Currie 494a6908bb [gamecode] Improve with's comment 2022-01-10 11:04:43 +09:00
Bill Currie 86e81ba250 [gamecode] Rearrange the branch instructions
Now they're in a much more consistent arrangement, in particular with
the comparison opcodes if the conditional branch instructions are
considered to be fast comparisons with zero (ifnot -> ifeq, if -> ifne,
etc). Unconditional jump and call fill in the gaps. The goal was to get
them all in an arrangement that would work as a small enum for qfcc: it
can use the enum directly for the ruamoko IS, and a small map array for
v6p (except for call).
2022-01-09 01:07:23 +09:00
Bill Currie 7d5c692313 [gamecode] Generate the new opcodes enum too
It turns out I'll be tweaking it more than I expected.
2022-01-09 01:04:51 +09:00
Bill Currie 4111d44dcc [gamecode] Move progs auxiliary headers into a subdirectory
Just another step along the road of tidying up the QF include directory
(and desirable for generated data).
2022-01-09 00:26:52 +09:00
Bill Currie ed6b84fbde [gamecode] Add missed long and ulong info
Both pr_type_size and pr_type_name. I want to macroize the enum, but
need to sort out the clutter of headers first, just need to decide on
naming. This at least sorts out the missed values for now.
2022-01-08 03:07:17 +09:00
Bill Currie e186d5064d [gamecode] Correct return's opname
Not meant to have the size in it.
2022-01-07 21:48:19 +09:00
Bill Currie 8559a4fe2d whitespace 2022-01-07 21:48:02 +09:00
Bill Currie 14d95f81d1 [gamecode] Remove PR_Opcode_Init
It was idempotent, then it became impotent. Now it's just not needed.
2022-01-07 19:25:34 +09:00
Bill Currie aee31a8be5 [sys] Use tailless INT64_C macro
I guess I missed the non-internal version when searching for it before.
2022-01-06 22:27:42 +09:00
Bill Currie 1cb35b1fe3 [gamecode] Fix some more operand formats
With and relative branches.
2022-01-06 22:27:09 +09:00
Bill Currie 0d9294d541 [gamesource] Work around a windows gcc bug
The bug (alignment issues with AVX on windows) seems to have in gcc from
the 4.x days, and is still present in 11.2: it does not ensure stack
parameters that need 32 byte alignment are aligned. Telling gcc to use
the sysv abi (safe on a static function) lets gcc do what it does for
linux (usually pass the parameters in registers, which it seems to have
done).
2022-01-06 22:21:24 +09:00
Bill Currie c3317f8e5e [gamecode] use INT64_C instead of l-suffix
Once again, I had forgotten that long is not always 64-bits.
2022-01-06 22:20:16 +09:00
Bill Currie 80c5e2c3f6 [simd] Remove requirements for AVX2 for vec4d
It seems gcc-11 does a pretty good job of emulating the instructions (it
no longer requires avx2 for 256-bit wide vectors).
2022-01-06 18:06:56 +09:00
Bill Currie c0277c0b03 [gamecode] Fix incorrect entity load format
Had a typo in load and forgot to edit lea, but now they share the
formats (like they should have in the first place).
2022-01-06 11:51:38 +09:00
Bill Currie d9d37fda47 [gamecode] Implement ruamoko opcode lookup
And get the debugger working with the new instruction set.
2022-01-06 11:47:05 +09:00
Bill Currie c74cfb9bf6 [gamecode] Generate instruction widths and types
Not everything is correct, but this is enough to get started on
supporting disassembly in the various tools and code generation in qfcc.
2022-01-05 22:33:59 +09:00
Bill Currie c9b2a740a0 [gamecode] Add etypes for long and ulong
And partial implementations in qfcc (most places will generate an
internal error (not implemented) or segfault, but some low-hanging fruit
has already been implemented).
2022-01-05 22:32:07 +09:00
Bill Currie 0b92cd3a88 [gamecode] Generate the new opcode table
As I expect to be tweaking things for a while, it's part of the build
process. This will make it a lot easier to adjust mnemonics and argument
formats (tweaking the old table was a pain when conventions changed).

It's not quite done as it still needs arg widths and types.
2022-01-05 19:09:07 +09:00
Bill Currie 0b674f5ed4 [gamecode] Clean up some opcode names
While working on the new opcode table, I decided a lot of the names were
not to my liking.  Part of the problem was the earlier clash with the
v6p opcode names, but that has been resolved via the v6p tag.
2022-01-05 19:04:43 +09:00
Bill Currie 6d9c63999c [gamecode] Rename pr_opcode.c
Just to make way for new tables :)
2022-01-04 20:45:45 +09:00
Bill Currie 35387b5450 [gamecode] Fix a pile of incorrect base register refs
The problem with copying code is it's all to easy to forget to make all
necessary edits.
2022-01-04 19:01:05 +09:00
Bill Currie 59292393e6 [gamecode] Fix up MOD (%%) for integral types
Use the new "1" versions of loadvec3 to get a 1 in w to avoid
divide-by-zero errors, and use the correct type for longs (forgot to
change i to l on the vector types).
2022-01-04 18:36:13 +09:00
Bill Currie 2f09ece65b [gamecode] Add more modes to WITH
It turned out I had no way of using a pointer or field as the value to
load, so all 4 modes are duplicated with loads from where operand b
points, but the loaded value interpreted the same way. Also, fixed an
error in the calculation of op-b offsets.
2022-01-04 17:55:20 +09:00
Bill Currie f2b258ba76 [gamecode] Add statement bounds checking
Statements can be bounds checked in the one place (jump calculation),
but memory accesses cannot as they can be used in lea instructions which
should never cause an exception (unless one of lea's operands is OOB).
2022-01-04 17:53:10 +09:00
Bill Currie 9d74fcc181 [gamecode] Add tests for the basic math ops
* / % %% + -

As a bonus, includes partial tests for a few extra operators. Several
things are broken at this stage, but uncommitted code is already
working.
2022-01-04 17:50:49 +09:00
Bill Currie 5de4c21557 [gamecode] Fix relative offset jumps
Yet another missed sign extension.
2022-01-04 14:30:20 +09:00
Bill Currie 4777f44ba1 [gamecode] Rename test-math to test-vector
I decided to stick with the minimal tests per test program rather than
try to cram all the math operator tests into the one program.
2022-01-03 23:50:38 +09:00
Bill Currie a6badaa05d [gamecode] Complete the vector instruction tests
Finish up the float tests and add double tests.
2022-01-03 23:27:01 +09:00
Bill Currie 6de1ba6901 [gamecode] Clean up the conversion instructions
Float bit-ops as well.

Also, add q*v4 and v4*q instructions. There are currently 48 free
opcodes, and I might remove the scale instructions, but they could be
useful as expanding a single float to a vector would take 3 instructions
(copy to temp, swizzle-expand temp, multiply, vs just scale).
2022-01-03 23:27:01 +09:00
Bill Currie b6f9b68434 [gamecode] Implement 64-bit swizzles
See commit for 32-bit swizzles.
2022-01-03 23:27:01 +09:00
Bill Currie bebc811f11 [gamecode] Implement 4-component 32-bit swizzle
The swizzle instruction is very powerful in that in can do any of the
256 permutations of xyzw, optionally negate any combination of the
resulting components, and zero any combination of the result components
(even all). This means the one instruction can take care of any actual
swizzles, conjugation for complex and quaternion values, zeroing vectors
(not that it's the only way), and probably other weird things.

The python file was used to generate the jump table and actual swizzle
code.
2022-01-03 23:27:01 +09:00
Bill Currie b8d04874c3 [gamecode] Add some math tests
Hit a show stopper when it came to swizzle (not implemented yet). I
guess I know what I need to do next :P.
2022-01-03 23:27:01 +09:00
Bill Currie fd298f3601 [gamecode] Create a mask for extracting the opcode
Got tired of copying the full thing around.
2022-01-03 23:27:01 +09:00
Bill Currie ffbb6122b9 [gamecode] Add tests for push and pop 2022-01-03 23:27:01 +09:00
Bill Currie c86f1f671b [gamecode] Add tests for load instructions
This needed the test struct declaration to be moved out to a head file
so it can be shared with other tests.
2022-01-03 23:27:01 +09:00
Bill Currie 28df32eb0d [gamecode] Use pr_memset instead of memset
This keeps things inline and matches the quakec exec loop. Also removes
the need to calculate the size.
2022-01-03 23:27:01 +09:00
Bill Currie bf604b99b3 [gamecode] Add automated tests for store ops
They even found a bug in the addressing mode functions :) (I'd forgotten
that I wanted signed offsets from the pointer and thus forgot to cast
st->b to short in order to get the sign extension)
2022-01-03 23:27:01 +09:00
Bill Currie 920c5fd99b [gamecode] Add debug event name strings
Makes it easier to print nice debug event messages.
2022-01-03 23:26:50 +09:00
Bill Currie 8a2788c267 [gamecode] Add PROG_V6P_VERSION and bump PROG_VERSION
This allows the VM to select the right execution loop and qfcc currently
still produces only the old IS (it doesn't know how to deal with the new
IS yet)
2022-01-03 13:56:43 +09:00
Bill Currie 925797b1d4 [gamecode] Add a new Ruamoko instruction set
When it's finalized (most of the conversion operations will go, probably
the float bit ops, maybe (very undecided) the 3-component vector ops,
and likely the CALLN ops), this will be the actual instruction set for
Ruamoko.

Main features:
 - Significant reduction in redundant instructions: no more multiple
   opcodes to move the one operand size.
 - load, store, push, and pop share unified addressing mode encoding
   (with the exception of mode 0 for load as that is redundant with mode
   0 for store, thus load mode 0 gives quick access to entity.field).
 - Full support for both 32 and 64 bit signed integer, unsigned integer,
   and floating point values.
 - SIMD for 1, 2, (currently) 3, and 4 components. Transfers support up
   to 128-bit wide operations (need two operations to transfer a full
   4-component double/long vector), but all math operations support both
   128-bit (32-bit components) and 256-bit (64-bit components) vectors.
 - "Interpreted" operations for the various vector sizes: complex dot
   and multiplication, 3d vector dot and cross product, quaternion dot
   and multiplication, along with qv and vq shortcuts.
 - 4-component swizzles for both sizes (not yet implemented, but the
   instructions are allocated), with the option to zero or negate (thus
   conjugates for complex and quaternion values) individual components.
 - "Based offsets": all relevant instructions include base register
   indices for all three operands allowing for direct access to any of
   four areas (eg, current entity, current stack frame, Objective-QC
   self, ...) instructions to set a register and push/pop the four
   registers to/from the stack.

Remaining work:
 - Implement swizzle operations and a few other stragglers.
 = Make a decision about conversion operations (if any instructions
   remain, they'll be just single-component (at 14 meaningful pairs,
   that's a lot of instructions to waste on SIMD versions).
 - Decide whether to keep CALL1-CALL8: probably little point in
   supporting two different calling conventions, and it would free up
   another eight instructions.
 - Unit tests for the instructions.
 - Teach qfcc to generate code for the new instruction set (hah, biggest
   job, I'm sure, though hopefully not as crazy as the rewrite eleven
   years ago).
2022-01-03 00:49:49 +09:00
Bill Currie 0c17c6dc24 [gamecode] Rename the old opcodes
To reflect their basis on v6 progs instructions, they sport the v6p tag
where the p is for "plus" due to the QuakeForge extensions.
2022-01-02 21:30:02 +09:00
Bill Currie bc0a09f452 [gamecode] Switch to using type parameter op macros
I wish I'd done it this way years ago (but maybe gcc 2.95 couldn't hack
the casts, I do know there were aliasing problems in the past). Anyway,
this makes operand access much more consistent for variable sized
operands (eg float vs double vs vec4), and is a big part of the new
instruction set implementation.
2022-01-02 20:46:32 +09:00
Bill Currie 7b0eceda32 [gamecode] Split out the old quake c execution loop
There is no reasonable way (due to hardware-enforced alignment issues)
to simply convert old bytecode to new (probably best done with an
off-line tool, preferably just recompiling when I get qfcc up to the
job), so both loops will need to be present. This just moves the
original loop into its own function in order to make it easy to bring in
the new (and iron out integration issues).
2022-01-02 20:16:45 +09:00
Bill Currie ba5f6d97c6 [gamecode] Remove the right_associative field
It has been useless pretty much since I switched to using bison for the
parser.
2022-01-02 19:09:58 +09:00
Bill Currie 0e1964bf74 [simd] Split out the ivec implementations
And add any/all/none functions.
2022-01-02 16:02:57 +09:00
Bill Currie 5fb28d7c38 [math] Clean up vector component operations
And add a unary op macro. Having VectorCompOp makes it easy to write
macros that work for multiple data widths, which is why it and its users
now use (dst, ...) instead of (..., dst) as in the past. I'll sort out
the other macros later now that I know the compiler handily gives
messages about the switched order (uninitialized vars etc).
2022-01-02 01:15:17 +09:00
Bill Currie 937f36384b [cexpr] Use correct functions for double trunc/floor
Found while sorting out the changes for the new 2d vectors.
2022-01-02 01:13:17 +09:00
Bill Currie 97034d9dde [simd] Add 2d vector types
For int, long, float and double. I've been meaning to add them for a
while, and they're part of the new Ruamoko instructions set (which is
progressing nicely).
2022-01-02 00:57:55 +09:00
Bill Currie 365762b8a6 [gamecode] Switch to using indexed initializers
The opcode table is a nightmare to maintain, but this does clean it up
and speed up opcode lookups since they can now be indexed. Of course, it
turns out I had missed adding several instructions, so had to fix that,
and qfcc needed a bit of a re-jigger to get the opcode out of the table.
2021-12-31 19:16:02 +09:00
Bill Currie be474d9937 [gamecode] Remove the wart from def and function names
I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
2021-12-31 15:02:31 +09:00
Bill Currie 70aaafda10 [ruamoko] Clear dtable list on reset
The list of all allocated dispatch tables is used to free all the tables
when the progs are reloaded. Not clearing the list meant that the next
instance (second map change) corrupted the list.
2021-12-30 00:21:29 +09:00
Bill Currie 3c17efe91b [console] Unhook hooked functions on shutdown
Forgetting to unhook the functions (Sys_Printf and the client console's
input event handler) was not a problem for static builds because the
functions were always present, but in builds with dynamic plugins, the
client console's code got ripped away and thus Sys_Printf and the event
hander were being sent into invalid memory. Too much work, not enough
play (with a fully installed client).
2021-12-29 21:50:38 +09:00
Bill Currie 5f4a330b02 [console] Tweak the server status bar colors
Now the yellow stands out nicely.
2021-12-28 00:06:12 +09:00
Bill Currie 1be220559a [zone] Add function to retrieve memory usage 2021-12-27 20:12:03 +09:00
Bill Currie 65f78b43ac [gamecode] Try to set field def size
This fixes the edicts command not printing anything useful.
2021-12-27 19:02:39 +09:00
Bill Currie 94871671d2 [qw] Use a callback for netchan logging
This gets outgoing packet logging working again. Yay, fill my hard-drive
faster ;)
2021-12-27 17:54:58 +09:00
Bill Currie cafc6a541f [gamecode] Get PR_Profile working
The switch from using pr_functions (dfunction_t) to function_table
(bfunction_t) for keeping track of the current function (and thus
profiling data) broke PR_Profile as it never saw anything but 0.
2021-12-27 13:50:49 +09:00
Bill Currie 6368791d2b [gamecode] Check entity_var is valid before display
Even NUM_FOR_BAD_EDICT will have a bad day if the edict pointer is
invalid, so make sure that the entity pointer is valid (within the edict
area AND a multiple of edict size).
2021-12-27 13:47:55 +09:00
Bill Currie f373192a02 [gamecode] Set pr_string_resources in PR_Strings_Init
Like for debug, this is the most sensible place as the pointer will
never change.
2021-12-26 22:46:07 +09:00
Bill Currie 5588d0de60 [gamecode] Separate debug byte-swap and pointer init
PR_LoadDebug now does only the initial version and crc checks, and the
byte-swapping of the loaded symbols file. PR_DebugSetSym sets up all the
pointers.
2021-12-26 22:39:37 +09:00
Bill Currie c9f372fa38 [gamecode] Set pr_debug_resources in PR_Debug_Init
And use the cached value in PR_LoadDebug.
2021-12-26 20:35:09 +09:00
Bill Currie c163b311d0 [gamecode] Create hash tables in PR_Init
This makes much more sense than in PR_LoadProgsFile (and simplifies the
latter, too).
2021-12-26 20:33:37 +09:00
Bill Currie c11a930436 [simd] Set the homogeneous coord in the csvf test
The homogeneous coord was not being initialized and thus was picking up
rubbish from the stack. This is why the test would succeed in some
circumstances but fail in others.
2021-12-26 12:25:06 +09:00
Bill Currie 8385046486 [qfcc] Warn when super dealloc invocation is missing
Forgetting to invoke [super dealloc] in a derived class's -dealloc
method has caused me to waste far too much time chasing down the
resulting memory leaks and crashes. This is actually the main focus of
issue #24, but I want to take care of multiple paths before I consider
the issue to be done.

However, as a bonus, four cases were found :)
2021-12-24 22:45:43 +09:00
Bill Currie 5bfe0e5d34 [sw] Update for changed particle field names
Fixes 32-bit x86 target builds.
2021-12-24 19:33:06 +09:00
Bill Currie 2b25748cc4 [ruamoko] Correct SetIterator memory handling
This makes SetIterator more compatible with autorelease.
2021-12-24 06:45:13 +09:00
Bill Currie 7571231100 [input] Get single axis info for unbound devices
This doesn't fix the problem of keyhelp not working for axes belonging
to unbound devices, but may be a step in the right direction.
2021-12-24 06:45:13 +09:00
Bill Currie 2e3e9ea7c0 [ruamoko] Actually save the cooke
This fixes the listener leak.
2021-12-24 06:45:13 +09:00
Bill Currie f77da210ff [ruamoko] Merge listener cookie code
I know that duplication would turn around and bite me :P
2021-12-24 06:45:13 +09:00
Bill Currie b726c24b05 [ruamoko] Reset parameters before setting in listener
It's right there in the docs, even (though only on the macro, which I'd
forgotten about). Fixes some nasty corruption.
2021-12-24 06:45:13 +09:00
Bill Currie dad19aa2ad [input] Correct balanced range calculation
Fixes axis inputs being half what they should be. Can't quite get +1,
though (need to figure something out for the positive axis range being
slightly smaller than the negative range).
2021-12-24 06:45:13 +09:00
Bill Currie f3918471d5 [ruamoko] Add bindings for the main IMT functions
IMT_SetContextCbuf is not bound as that requires cbuf to be bound.
However, imt contexts can be created, fetched and set.
2021-12-24 06:45:13 +09:00
Bill Currie 0c41c11f1d [gamecode] Use a new developer flag for builtin debug
rua_resolve works for now
2021-12-24 06:45:13 +09:00
Bill Currie 6d64b2c47c [vulkan] Build particle buffers 2021-12-24 06:45:13 +09:00
Bill Currie a4c4155a51 [vulkan] Clean up packet submission
In the end, there's no need for the two paths and I want to be able to
submit empty packets with semaphores.
2021-12-24 06:45:13 +09:00
Bill Currie dcd1fa28ba [ruamoko] Get the input bindings working
With some hacks that are not included (plan on handling events and
contexts properly), button inputs, including using listeners, are
working nicely: my little game is working again. While the trampoline
code was a bit repetitive (and I do want to clean that up), connecting
button listeners directly to Ruamoko instance methods proved to be quite
nice.
2021-12-24 06:45:13 +09:00
Bill Currie 23e3b4c2e5 [ruamoko] Retrieve a plitem_t from PropertyList
And also internally for cross-builtin use.
2021-12-24 06:45:13 +09:00
Bill Currie f1d097c0c4 [ruamoko] Add bindings for Mercenne Twister 2021-12-24 06:45:13 +09:00
Bill Currie 91a686d1f5 [util] Add mtwist float random number functions
mtwist_rand_0_1 produces numbers in the range [0, 1) and
mtwist_rand_m1_1 produces numbers in the range (-1, 1). The numbers will
not be denormal, so the distribution should be fairly uniform (as much
as Mersenne Twister itself is), but this needs proper testing.

0 is included for the mtwist_rand_0_1 as it seems useful, but -1 is not
included in mtwist_rand_m1_1 in order to keep the extremes of the
distribution balanced around 0.
2021-12-24 06:45:13 +09:00
Bill Currie 6411518603 [ruamoko] Make some progress on the input bindings 2021-12-24 06:45:13 +09:00
Bill Currie 3cb93d4cbe [input] Add functions to get single axis/button info
Handy for retrieving the current state (raw) of a single axis or button.
2021-12-24 06:45:13 +09:00
Bill Currie 803c9defae [input] Clean out more keys.h refs 2021-12-24 06:45:13 +09:00
Bill Currie 33e48025dd [ruamoko] Replace rua_key with rua_input
And create rua_game to coordinate other game builtins.

Menus are broken for key handling, but have been since the input rewrite
anyway. rua_input adds the ability to create buttons and axes (but not
destroy them). More work needs to be done to flesh things out, though.
2021-12-24 06:45:13 +09:00
Bill Currie 2cb987fdb5 [build] Clean up a pile of distcheck issues 2021-12-24 06:45:13 +09:00
Bill Currie 2d109e615b [client] Clean up a stray reference to the renderer
Reaching into the renderer internals for r_worldmodel doesn't work when
the plugins are not static.
2021-12-24 06:45:13 +09:00
Bill Currie 194f958666 [console] Add a comment about skipping the first char
I had to dig through logs of deleted files to find out what was going
on. Forget six months later, twenty years...
2021-12-24 06:45:13 +09:00
Bill Currie e0863ff067 [net_chan] Clean out unnecessary include
net_chan was still including client.h from qw when it no longer needed
it (I guess I forgot to clean that out when I resolved any last
dependencies).
2021-12-24 06:45:13 +09:00
Bill Currie d70d72e6e4 [particles] Create a psystem object
This takes care of the global variables to a point (there is still the
global struct shared between the non-vulkan renderers), but it also
takes care of glsl's points-only rendering.
2021-12-24 06:45:13 +09:00
Bill Currie 372c89b479 [particles] Merge physics code
The particle physics is called by the renderer.
2021-12-24 06:45:13 +09:00
Bill Currie 8d2791752e [particles] Merge particle spawning into client
After yesterday's crazy marathon editing all the particles files, and
starting to do another big change to them today, I realized that I
really do need to merge them down. All the actual spawning is now in the
client library (though particle insertion will need to be moved). GLSL
particle rendering is semi-broken in that it now does only points (until
I come up with a way to select between points and quads (probably a
context object, which I need anyway for Vulkan)).
2021-12-24 06:45:13 +09:00
Bill Currie 81a5e076ac [vulkan] Move render pass array init
Having it in Vulkan_Init_Common means the array can be used in more
places than just Vulkan_CreateRenderPass (which probably needs a
rename).
2021-12-24 06:45:13 +09:00
Bill Currie 2be19046b6 [vulkan] Allow render passes to not have a render pass
This may seem a little contradictory, but it's due to the difference
between a high level (engine) render pass and a Vulkan render pass
object (and quite likely a poor choice in names for the high level
object). This is necessary for supporting compute shader dispatches as
they cannot be submitted inside a Vulkan render pass.
2021-12-24 06:45:13 +09:00
Bill Currie 43cdca330b [client] Add bindings for load and quickload in demos 2021-12-24 06:45:13 +09:00
Bill Currie aacd2575d2 [sw,sw32] Ensure the particle system is initialized
This fixes the missing particles (because mtwist_rand was returning 0).
2021-12-24 06:45:13 +09:00
Bill Currie ce4bb1d56c [renderer] Move particles over to simd
This has the advantage of getting entity_t out of the particle system,
and much easier to read math. Also, it served as a nice test for my
particle physics shaders (implemented the ideas in C). There's a lot of
code that needs merging down: all but the actual drawing can be merged.

There's some weirdness with color ramps, but I'll look into that later.
2021-12-24 06:45:13 +09:00
Bill Currie 4d1e8b2375 [vulkan] Update the number of drawn quads correctly
They should increment by one for each pic, not 4 (I think some fluff
remaining from copying glsl's draw code).

I noticed the problem when I saw large gaps of 0s in the vertex data in
renderdoc.
2021-12-24 06:45:13 +09:00
Bill Currie be7216e660 [vulkan] Implement crosshair rendering
That makes quite the difference to playability.
2021-12-24 06:45:13 +09:00
Bill Currie 6b84ae5554 [renderer] Update crosshair color on palette changes
This gets the crosshair working in Vulkan (next commit) and fixes issues
with changing the palette (though I've never seen a different palette
for quate, there's still the change from "all black" to an actual
palette).
2021-12-24 06:45:13 +09:00
Bill Currie 83ec2be2a6 [vid] Add a listener set for palette changes
This was needed to get crosshaircolor working correctly, but is likely
another step towards resizable windows (the listener set types are
generic for any viddef event, not just palette changes).
2021-12-24 06:45:13 +09:00
Bill Currie cd641e2b1c [vulkan] Clean up alias push-constants 2021-12-24 06:45:13 +09:00
Bill Currie 8b1eec08cf [scene] Provide direct access to the world matrix
Holding onto the pointer is not a good idea, and it is read-only as
direct manipulation of the world matrix is not supported. However, this
is useful for passing the matrix to the GPU.
2021-12-24 06:45:13 +09:00