Commit Graph

3828 Commits

Author SHA1 Message Date
Bill Currie 0a847f92f1 [util] Use mmap/munmap for cmem internal alloc/free
This reduces the overhead needed to manage the memory blocks as the
blocks are guaranteed to be page-aligned. Also, the superblock is now
alllocated from within one of the memory blocks it manages. While this
does slightly reduce the available cachelines within the first block (by
one or two depending on 32 vs 64 bit pointers), it removes the need for
an extra memory allocation (probably via malloc) for the superblock.
2021-07-12 16:33:47 +09:00
Bill Currie 6db6f8f0e2 [win] Fix a pile of bitrot
Man, those bits rot quickly. Must be stored with a rotfish.
2021-07-11 13:30:52 +09:00
Bill Currie ef6dd422e5 [qfcc] Add source line number to statement blocks
For statement dot blocks.
2021-07-06 18:06:47 +09:00
Bill Currie ddc6f6bcb0 [qfcc] Un-dereference src expression early for movep
The VM has no pointer to direct reference move instruction.

Fixes #9
2021-06-30 20:05:27 +09:00
Bill Currie 9d140d1d15 [qfcc] Use {>...} for unnamed alias types
The ... is the encoding of the aliased type. Avoids (null) in the
encoding. Fixes #10.
2021-06-30 11:00:05 +09:00
Bill Currie a3aebc983b [qfcc] Add dependency edges for moved labels
When moving an identifier label from one node to another, the first node
must be evaluated before the second node, which the edge guarantees.
However, code for swapping two variables

    t = a; a = b; b = t;

creates a dependency cycle. The solution is to create a new leaf node
for the source operand of the assignment. This fixes the swap.r test
without pessimizing postop code.

This takes care of the core problem in #3, but there is still room for
improvement in that the load/store can be combined into a move.
2021-06-29 14:42:16 +09:00
Bill Currie 76b3bedb72 [qfcc] Revert "Kill dag leaf nodes on assignment."
This reverts commit 2fcda44ab0.

Killing the node is not the correcgt answer as it blocks many
optimization opportunities. The correct answer is adding edges to
describe the temporal dependencies. Of course, this breaks the swap.r
test.
2021-06-29 12:09:35 +09:00
Bill Currie 5291cfb03d [qfcc] Keep track of reachable dag nodes
In order to correctly handle swap-style code

    { t = a; a = b; b = t; }

edges need to be created for each of the assignments moving an
identifier lable, but the dag must remain acyclic (the above example
wants to create a cycle). Having the reachable nodes recorded makes
checking for potential loops a quick operation.
2021-06-29 09:41:03 +09:00
Bill Currie 0d1fad12f0 [qfcc] Add some comments 2021-06-29 09:12:57 +09:00
Bill Currie d50f2c3145 [qfcc] Correctly check for constant op
Identifiers can be constants. I don't remember quite what it fixed other
than some bogus kill relations in the dags (which might have caused
issues later).
2021-06-28 20:25:26 +09:00
Bill Currie 38a6ccdc85 [qfcc] Use indexed initializers for expr functions
This will make adding new expression types easier (though the current
reason for doing so has been abandoned for now).
2021-06-28 18:12:15 +09:00
Bill Currie 365e298908 [qfcc] Make internal_error const correct
This way it can be used with const expr objects.
2021-06-28 18:12:15 +09:00
Bill Currie 93167279fc Fix a bunch of issues found by gcc-11 2021-06-13 14:30:59 +09:00
Bill Currie 13b4b44e35 [qfcc] Handle l and ll integer suffixes
They're ignored, but allow recent vulkan headers to compile.
Fixes #13
2021-06-13 13:25:18 +09:00
Bill Currie 927a446bd3 [qfcc] Ensure type src type is a class
If the src type is not a class, there is no inheritance chain to walk.
Fixes a segfault when returning self after a syntax error in the
following:

    +(EditStatus *)withRect:(Rect)rect
    {
	return [[[self alloc] initWithRect:rect]:
    }

    -setCursorMode:(CursorMode)mode
    {
	cursorMode = mode;
	return self;
    }
2021-06-09 12:08:13 +09:00
Bill Currie 88c9517629 [qfprogs] Dump class ivars when dumping modules 2021-06-04 14:59:15 +09:00
Bill Currie 778c07e91f [util] Get vectors working for non-SSE archs
GCC does a fairly nice job of producing code for vector types when the
hardware doesn't support SIMD, but it seems to break certain math
optimization rules due to excess precision (?). Still, it works well
enough for the core engine, but may not be well suited to the tools.
However, so far, only qfvis uses vector types (and it's not tested yet),
and tools should probably be used on suitable machines anyway (not
forces, of course).
2021-06-01 18:53:53 +09:00
Bill Currie 18247a8c8e [tools] Fix up 32-bit cross-compile scripts 2021-04-02 08:55:16 +09:00
Bill Currie 574a123716 [qfvis] Remove obsolete notes file
While some of it is still correct, I'd rather start afresh next time I
need to sort that stuff out.
2021-03-28 21:14:17 +09:00
Bill Currie 634219ea06 [qfvis] Add set debug prints (disabled)
They were useful for narrowing down why mightsee wasn't being updated.
2021-03-28 21:11:13 +09:00
Bill Currie 9f42943589 [qfvis] Reset portal status after base vis
This fixes the mightsee updates never occurring, but it doesn't make a
huge difference (though I suppose it might have back in the 90s, or with
a different map).
2021-03-28 21:06:50 +09:00
Bill Currie 0fa65be106 [qfvis] Fix stats collection for mightseeupdate
The stats were being updated before UpdateMightsee was getting called,
and it was incrementing the wrong value (so it would not have been
thread-safe).
2021-03-28 21:06:50 +09:00
Bill Currie ff4cd84891 [qfvis] Use simd vector code
While whether it's any faster is debatable (it's slightly slower, but
many more portals are being tested due to different rounding in the base
vis stage), it's certainly easier to read.
2021-03-28 19:55:47 +09:00
Bill Currie eb325376b1 [qfvis] Collect base vis culling stats
Specifically, just how many are culled by sphere and winding tests.
2021-03-28 12:17:15 +09:00
Bill Currie d072a7b99c [qfvis] Add stats for memory usage
Verbosity levels probably need more tweaking, but -v is at least a
little more usable.
2021-03-27 23:04:13 +09:00
Bill Currie 3ef38188ce [qfvis] Add an option to limit the processed portals
It's not documented as I needed it for debugging memory allocations and
it causes qfvis to error out due to unprocessed portals.
2021-03-27 20:59:56 +09:00
Bill Currie f2b6b23acc [qfvis] Switch to unsigned for various counts 2021-03-27 20:55:15 +09:00
Bill Currie 72280186bf [qfvis] Use cmem for memory management
While the main bulk of the improvement (36s down from 42s for
gmsp3v2.bsp on my i7-6850K) comes from using a high-tide allocator for
the windings (which necessitated using a fixed size), it is ever so
slightly faster than using malloc as the back-end.
2021-03-27 20:30:35 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie 238e80c89b [build] Fix selective build of tools
A couple of things get built when they shouldn't (eg, vkgen) but this
gets the build system back to its pre-non-recursive-make
configurability.
2021-03-26 16:11:29 +09:00
Bill Currie c901fe74f9 [qfvis] Fix pthread portability macros
Those that were defined were incorrectly defined (didn't swallow the
parameter), and portal lock macros were missing.
2021-03-26 15:27:48 +09:00
Bill Currie c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie 0cae54d25d Move the tex conversion to libQFimage.
This is for the conversion /to/ paletted textures. The conversion is
necessary for csqc support. In the process, the conversion has been sped up
by implementing a color cache for the conversion process. I haven't
measured the difference yet, but Mr Fixit does seem to load much faster for
the sw renderer than it did before the change (many months old memory).
2021-03-25 18:16:24 +09:00
Bill Currie 66fda1fddb Rewrite edict access.
The server edict arrays are now stored outside of progs memory, only the
entity data itself (ie data accessible to progs via ent.fld) is stored in
progs memory. Many of the changes were due to code accessing edicts and
entity fields directly rather than through the provided macros.
2021-03-25 18:13:48 +09:00
Bill Currie 5d9bf32d3c Merge branch 'vulkan' 2021-03-23 12:31:58 +09:00
Bill Currie a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie 9e633e7230 [qflight] Remove minlights
It seems to be have been DOA (even in the original qutils light).
2021-03-21 10:11:53 +09:00
Bill Currie e3444b726f [model] Add a re-entrant Mod_LeafPVS
Double benefit, actually: faster when building a fat PVS (don't need to
copy as much) and can be used in multiple threads. Also, default visiblity
can be set, and the buffer size has its own macro.
2021-03-20 12:13:58 +09:00
Bill Currie f8961e4376 [qflight] Fix some typos in comments 2021-02-25 10:12:19 +09:00
Bill Currie bc763da9f6 [qfcc] Fix a typo in the man page 2021-02-09 15:02:22 +09:00
Bill Currie dfa7af03c6 [util] Plug a thread-safety hole in plists 2021-02-09 09:57:07 +09:00
Bill Currie 84dc73da2c [test] Get the tests building again
They happen to all pass, which is nice :)
2021-02-05 21:43:12 +09:00
Bill Currie 0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +09:00
Bill Currie 22fe49d0ef Add support for loading an alternative palette.
Sort of at the request of leileilol (a utility to create quakepal.py was
asked for, but this seems to be better approach). However, the feature is
not used yet (needs hooks in the import and export modules).
2021-02-02 21:47:34 +09:00
Bill Currie 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie 97febc0888 [tools/misc] Update mdl.py for python 3 2021-01-27 12:51:22 +09:00
Bill Currie e50430e00c [image] Add parameter to load only the header
I want to be able to calculate texture sizes without actually loading
the images.
2021-01-19 10:15:57 +09:00
Bill Currie 64c7efdc0c [qfcc] Use local_expr only for local variables
ie, not function-scope static variables.
2021-01-13 18:35:24 +09:00
Bill Currie 1fcb16d8cf [qfcc] Add failing test for static init
The function local static init is being treated as a non-static init
(ie, initialized each call).
2021-01-13 18:35:24 +09:00