Commit graph

5833 commits

Author SHA1 Message Date
Bill Currie
717cbaff87 [gamecode] Support offset for lea on globals
Allows using `array + offset` addressing. Both constant and variable
offsets are supported.
2023-05-14 12:45:08 +09:00
Bill Currie
e2464ed879 [build] Fix some library install issues
Removed a bogus dependency from libQFecs, and fixed the order of ui
libraries. This takes care of some first-time make install issues.
Libtool needs the libraries to be specified in dependency order.
2023-04-20 15:15:12 +09:00
Bill Currie
eb8fc0fb9a [vulkan] Be clearer about descriptor set layouts vs sets
This get pretty confusing when you refer to both the sets and the set
layouts in close vicinity.
2023-03-29 09:45:17 +09:00
Bill Currie
9317ce7358 [ruamoko] Handle missing fonts correctly
Carrying on as if the missing font had been loaded leads to way too many
issues for it to be a good thing (not that that really needs to be
said). Fixes the segfaults in my test scene.
2023-03-28 13:23:14 +09:00
Bill Currie
b1de1b8747 [util] Fix more ULP issues in the simd tests on arm
This time for debug (unoptimized) builds. While I could just do an
approximate check, I think it's better to document (as such) the
expected errors.
2023-03-28 12:43:05 +09:00
Bill Currie
47bfa23d09 [vulkan] Stub out the basic job execution
Really, a bit more than stub as the basic code is there, but nothing
works properly yet due to missing resources (especially descriptor sets
and pools), and the frame buffer creation is still disabled.
2023-03-28 10:28:44 +09:00
Bill Currie
34ece7ad03 [vulkan] Add buffer and buffer view support
Not fully implemented, but the parsing is done. Needed image view refs
to be renamed.
2023-03-28 00:15:04 +09:00
Bill Currie
a1e15603a3 [vulkan] Implement job initialization
The step dependencies are not handled yet as threading isn't used at
this stage, but since I'll require dependencies to always come earlier,
this shouldn't cause a problem.
2023-03-26 18:22:46 +09:00
Bill Currie
a8efde1dd3 Fix some mxe build issues 2023-03-25 21:36:45 +09:00
Bill Currie
c59840683d [plist] Use correct attribute for pl_error
Because mxe builds need gnu_printf instead of printf, need to use
PRINTF. I had forgotten that.
2023-03-25 21:31:24 +09:00
Bill Currie
86f2df4939 [vulkan] Respect the VULKAN_SDK environment variable
Thanks to Peter for the report and help in getting it working (I hope I
got all the changes right).
2023-03-25 21:21:13 +09:00
Bill Currie
f098bbf48b [util] Clean up some ULP errors in tests
The problem with floating point in unit tests is, well, comparisons are
finicky.
2023-03-25 21:21:13 +09:00
Bill Currie
f18837f195 [gamecode] Fix a pile of UB in the test cases
I always suspected the overflow conversions were UB, but with gcc doing
different things on arm, I thought it was about time to abandon those
particular tests. What I was not expecting was for the return value of
strcmp to be "UB" (in that there's no guarantee of the exact value, just
< = > 0). Fortunately, nothing actually relies on the value of the op
other than the tests, so modify the test to make the behavior well
defined.
2023-03-25 21:21:13 +09:00
Bill Currie
a058cff59f [util] Fix incorrect check for result of Qgetc
Qgetc returns int, not char. Found via arm compile due to sign of bare
char (or lack thereof).
2023-03-25 21:21:13 +09:00
Bill Currie
a1c67ea24b [vulkan] Implement most of the new job system
There's still the actual job objects to create, but all the vulkan bits
have been created and get destroyed on shutdown.
2023-03-22 19:32:49 +09:00
Bill Currie
2fbc27f6a0 [vkgen] Fix ignored field init and dealloc
I had somehow missed vkfieldignore in a consistency pass, or just messed
up its initialization (and thus deallocation) resulting in a double-free
of the strings.
2023-03-21 17:53:55 +09:00
Bill Currie
3fbac33ee8 [gl] Free alias model cache memory when clearing models
Like sw, gl uses the cache for alias models and thus needs to free the
cache memory when unloading the model.
2023-03-21 13:18:16 +09:00
Bill Currie
793525a50a [sw] Free alias model cache memory when clearing models
This fixes a Sys_Error when loading the level for the first demo (and
probably many other times). It was mod_numknown getting set to 0 that
triggered the issue, but that seems to be necessary for the other
renderers. I think the whole model loading and caching system needs an
overhaul as this doesn't feel quite right due to removing part of the
advantage of caching the model data.
2023-03-20 17:45:28 +09:00
Bill Currie
654b208641 [plist] Add functions to extend dictionaries and arrays
The idea is to make it easy (and efficient) to merge property list
items.
2023-03-15 19:47:30 +09:00
Bill Currie
5255c9c7a8 [set] Initialize pool's dynamic arrays
Testing had missed this because qfvis is the main user of set pools.
2023-03-15 10:17:42 +09:00
Bill Currie
68b5cd89d2 [vkgen] Plug a pile of ruamoko memory leaks
While the previous cleanup took care of the C side, it turns out vkgen
was leaking property list items all over the place, but they were
cleaned up by the shutdown code.
2023-03-13 11:26:13 +09:00
Bill Currie
7d4c1d79b1 [plist] Use reference counts for items
This makes it much easier to share items between property lists (eg,
targets and the main entity list in cl_light).
2023-03-13 11:26:13 +09:00
Bill Currie
45bcb31684 [vulkan] Use bare dictionaries for spec files
Every time I created a new file from scratch, I always forgot the
enclosing {}. Now I will probably include them by accident :P
2023-03-12 14:48:14 +09:00
Bill Currie
3cdcc2c62c [vkgen] Switch to bare dictionary for parse spec
This served as a nice test for the bare dictionary parsing (though
quakefs.c did, too), and even found a bug in vkgen's error handling.
2023-03-12 14:36:47 +09:00
Bill Currie
ea77df2daa [plist] Add parsing for bare dictionaries and arrays
Requiring top-level {} or () for (usually) hand-written files is awkward
and even a little error prone, and certainly ugly at times. With this,
loaders that expect a particular format can specify the format a little
more directly.
2023-03-12 14:31:17 +09:00
Bill Currie
e57a06f37b [plist] Refactor the dictionary and array parsing
This makes it easier to reuse the code for parsing bare dictionaries and
arrays.
2023-03-12 12:27:45 +09:00
Bill Currie
4cf1c167bd [vulkan] Start work on a render job system
The jobs will become the core of the renderer, with each job step being
one of a render pass, compute pass, or processor (CPU-only) task. The
steps support dependencies, which will allow for threading the system in
the future.

Currently, just the structures, parse support, and prototype job
specification (render.plist) have been implemented. No conversion to
working data is done yet, and many things, in particular resources, will
need to be reworked, but this gets the basic design in.
2023-03-10 19:47:40 +09:00
Bill Currie
374ca602a7 [vkgen] Use designated init for fixed array data
It seems I hadn't used fixed arrays for a while as the size field (which
really should be count) had moved and its spot taken by a data pointer.
2023-03-09 15:32:52 +09:00
Bill Currie
b9106c09cb [plist] Clean up string parsing
I had looked into doing reference counting on the strings, but didn't
like the implementation. However, it did make for better string handling
in the property list parser.
2023-03-09 13:33:49 +09:00
Bill Currie
faef61aab6 [vulkan] Ensure host-visible buffers are big enough to flush
Flushing memory requires nonCoherentAtomSize alignment, but this can
cause the flush range to go out of bounds of an improperly sized buffer.
However, only host-visible (and probably really only cached, but all
three covered) needs flushing, so no rounding up is done for
device-local memory.
2023-03-09 10:19:24 +09:00
Bill Currie
00d1ae0b91 [ecs] Invalidate entity in hierarchy before removal
I'm not sure just what was going on other than *other* components were
getting double-removed when the hierarchy reference component was
removed when the entity was being deleted. This might even prevent
issues with removing the hierarchy from an entity that's not being
deleted as the pre-invalidation prevents the removal from deleting the
entity.
2023-03-07 02:00:19 +09:00
Bill Currie
f12b3ea134 [vid] Allow render systems to unload late
This cleans up the tangled mess of attempting to unload the gl driver in
X11: for whatever reason, the display gets tied in to the library.
2023-03-06 21:15:15 +09:00
Bill Currie
5821ef8d1f [model] Reset mod_numknown when clearing models
Vulkan actually needs Mod_ClearAll, and mod_numknown not getting reset
was the actual cause of the segfault.
2023-03-06 21:04:00 +09:00
Bill Currie
488ccdc512 [glsl] Be more null-safe for free/destroy functions 2023-03-06 18:21:13 +09:00
Bill Currie
e079d95cb0 [vkgen] Add header guards to stdint.h
Recent vulkan headers have added at least one more include of stdint.h,
so need to protect against the double-inclusion.
2023-03-06 12:49:02 +09:00
Bill Currie
d14162eed9 [model] Ensure all models are unloaded
Cleans up not only vulkan (had to remove the clearing from vulkan to
avoid a segfault).
2023-03-06 01:52:57 +09:00
Bill Currie
e19e7cad0c [ecs] Invalidate entity before removing components
It turns out that the fixes for other problems related to removing
hierarchy reference components fixed the problem moving the entity
invalidation fixed, and invalidating the entity late somehow broke the
sprite renderer (at least in glsl).
2023-03-05 23:31:20 +09:00
Bill Currie
8efe8e63d3 [ecs] Plug a bunch of memory leaks
The hierarchy leak was particularly troublesome to fix, but now the
hierarchies get updated (and freed) automatically just by removing the
hierarchy reference component from the entity. I suspect there will be
issues with entities that are on multiple hierarchies, but I'll sort
that out later.
2023-03-05 22:03:01 +09:00
Bill Currie
28226ac75c [ecs] Handle indices beyond the subpools
It turns out that the bsearch bug was hiding incorrect handling of
indices in the subpool beyond the last tracked subpool. In which case, a
correctly working bsearch correctly fails to find the range, but the
search can be skipped entirely.
2023-03-05 18:53:33 +09:00
Bill Currie
76ac446156 [util] Fix an out-by-one in QF_bsearch_r
And rename _bsearch to QF_bsearch_r since that's far less confusing.
Also, update the test to make it possible for valgrind to detect the
out-by-one. The problem was found when trying to remove components from
an entity when using subpools.
2023-03-05 18:31:30 +09:00
Bill Currie
370c36f6cc [vulkan] Fix some memory leaks
And deal with a shutdown order issue causing cvars to crash on shutdown
(due to the hash links being freed too early).
2023-03-05 18:31:30 +09:00
Bill Currie
24ac95ef6e [cvar] Ensure enum cvars tables don't get double freed
Currently doesn't happen, but all it takes is for two or more cvars to
use the same enum type.
2023-03-05 18:31:30 +09:00
Bill Currie
004ebd40b8 [ui] Fix more memory leaks
The text passage component was a legitimate leak, but the rest just
shutdown losses (ie, valgrind noise).
2023-03-05 18:31:30 +09:00
Bill Currie
e81c3a6015 [model] Plug more leaks 2023-03-05 18:31:30 +09:00
Bill Currie
b84bf16cab [util] Add a function to reverse delete cbuf stacks
I'm not 100% sure this is the best fix for the issue, but the way the
cbuf interpreter stack works (especially in the console code) meant that
the stack was built in the order opposite to how it could be safely
deleted with the existing function. Yeah, more leaks :P
2023-03-05 18:31:30 +09:00
Bill Currie
340127fff2 [ruamoko] Plug yet more memory leaks
Some of them, especially in rua_obj, were quite legitimate and even a
problem for thread-safety (rua_cmd is currently not thread-safe, but it
needs a lock, which I don't feel like doing at this stage).
2023-03-05 18:31:30 +09:00
Bill Currie
f256ab167d [gamecode] Yet more leaks 2023-03-05 18:31:30 +09:00
Bill Currie
9605de53d7 [audio] Plug yet more leaks
What a sieve QF became.
2023-03-05 18:31:30 +09:00
Bill Currie
3e30b7b9e2 [image] Allow color conversion caches to be cleaned up
More leaks, but only ruamoko takes advantage of it so far.
2023-03-05 18:31:30 +09:00
Bill Currie
3f9873a754 [console] Plug more memory leaks 2023-03-05 18:31:30 +09:00