Commit graph

13253 commits

Author SHA1 Message Date
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
Bill Currie
3d65376f87 [cvar] Delete enum symbol tables on shutdown
More memory leaks. Might need to make some soup.
2023-03-05 18:31:30 +09:00
Bill Currie
d8466b6cca [util] Fix a linked-list error in segtext
Uncovered by the memory leak cleanup: the nodes were all being "linked"
to the first node, those nodes in between the first and last were
getting lost.
2023-03-05 18:31:30 +09:00
Bill Currie
13f8f2b66b [util] Fix a pile of memory leaks
Some were actually legitimate (in that they'd cause problems in a long
running game).
2023-03-05 18:31:30 +09:00
Bill Currie
9ad4f57348 [glsl] Fix a pile of memory leaks
For the most part harmless, but fixing the leaks has been uncovering
bugs.
2023-03-05 18:31:30 +09:00
Bill Currie
e2640d51a7 [gl_stub] Make some gen functions generate indices
This makes gl_stub usable with valgrind (otherwise, the returned indices
are uninitialized).
2023-03-05 18:31:30 +09:00
Bill Currie
9193a92a81 [util] Make Hash_DelContext null-safe 2023-03-05 18:31:30 +09:00
Bill Currie
f9e442d323 [util] Make sys globals all thread-local
This was mainly for the shutdown functions, thus allowing Sys_Shutdown
(and Sys_RegisterShutdown) to be per-thread, but it seemed like a good
idea to make everything per-thread.
2023-03-05 18:31:30 +09:00
Bill Currie
795021e229 [util] Record allocated blocs for ALLOC
Recording the blocks makes it possible to free them later. As a
convenience, ALLOC_STATE declares the freelist and blocks vars needed by
ALLOC.
2023-03-05 18:31:30 +09:00
Bill Currie
161ccc282f [ruamoko] Unlink passage nodes when deleting
Fixes a segfault on shutdown after the memory leak changes.
2023-03-04 02:23:37 +09:00
Bill Currie
be9e6893e5 [util] Free up hash links
Finally, hash links can be freed when the hash context is no longer
relevant. The context is created automatically when needed, and the
owner can delete the context when its done with the relevant hash
tables.
2023-03-04 02:07:31 +09:00
Bill Currie
44ad372adb [ruamoko] Clean up some memory leaks
So many sieves.
2023-03-04 00:50:27 +09:00
Bill Currie
c28ffbb766 [vkgen] Plug some memory leaks
Not that they really matter, but it makes checking valgrind easier.
2023-03-04 00:41:38 +09:00
Bill Currie
8b8bc42038 [ruamoko] Own created property list objects
If the PLItem classes create a property list object, they own it. Plugs
more leaks.
2023-03-04 00:39:37 +09:00
Bill Currie
e57427142b [util] Clean up some memory leaks in cmd 2023-03-04 00:38:32 +09:00
Bill Currie
b8bd83f5cd [gamecode] Clean up a pile of memory leaks
Usually doesn't matter, but it makes it easier to evaluate valgrind's
output.
2023-03-03 22:07:27 +09:00
Bill Currie
70aa970c32 [gamecode] Make modules responsible for freeing resources
It should have been this way all along, and it seems I thought they were
when I did rua_gui.c as it already freed its resource block, which would
have been a double free (oops). Fixes an invalid write when shutting
down progs in qwaq-cmd (relevant change not committed).
2023-03-03 20:26:00 +09:00
Bill Currie
9146860f70 [util] Add size limited find and hash functions
Hash_nFind and Hash_nString work like Hash_Find and Hash_String, but
take a maximum string length (like strncmp etc).
2023-03-03 18:50:47 +09:00
Bill Currie
d0a3040b26 [vulkan] Fix a missed pure attribute
I don't have a compile pre-push hook on my laptop.
2023-03-03 10:31:54 +09:00
Bill Currie
c0048c14b3 [vulkan] Fix a typo in a comment
Double "the"
2023-03-02 18:34:10 +09:00
Bill Currie
9d63d4901f [vulkan] Create a framebuffer for the first render pass
Currently just the one framebuffer is created, but I want to get things
running soon.
2023-03-02 18:33:16 +09:00
Bill Currie
926e3b76b0 [gib] Clean up regex.c in anticipation of c23
I tried out -std=c2x (doesn't work due to typeof (gcc bug?)) and
-sdt=gnu2x (still no #embed) and found that only regex.c was a problem
(nice), and now it no longer is a problem.
2023-02-28 12:37:30 +09:00
Bill Currie
3b9e0a786e [vkgen] Support renaming of auto fields 2023-02-27 18:44:21 +09:00
Bill Currie
9133c0ea3f [vulkan] Initialize most of render pass and subpass state
Render passes and subpasses are now mostly initialized, just command
buffers and frame buffer related info to go (including view/scissor for
pipelines).
2023-02-27 18:10:09 +09:00
Bill Currie
38c10f9c4f [vulkan] Support chained render pass infos
And thus the cube mapped render pass.
2023-02-27 15:02:48 +09:00
Bill Currie
fdcd972ff9 [vulkan] Use correct index for pl item setup
Due to a typo in the list of extra property list items to add to the
symbol table (corrected), subsequent symbols were pointing to the wrong
memory address.
2023-02-27 15:00:40 +09:00
Bill Currie
3700321c5d [vulkan] Clean up the render objects on shutdown
Not only does this quieten the validation layers, it ensures that all
the object handles are named and where they need to be. Also fixes only
one pipeline being created instead of the 15 or so.
2023-02-27 14:15:28 +09:00
Bill Currie
0dccce6c51 [vulkan] Create render passes and pipelines
There are many issues (in particular, shutdown doesn't clean up
properly), but creation passes validation.
2023-02-27 03:00:14 +09:00
Bill Currie
918237507e [vulkan] Support parsing pipeline layout info
This is for the new system.
2023-02-27 02:54:51 +09:00
Bill Currie
acf828baa3 [vulkan] Allow null extra items and symbols
Don't want to have to pass empty lists.
2023-02-27 02:53:03 +09:00
Bill Currie
b10c8dc1a1 [vulkan] Parse in descriptor set layouts
For now, just their create info is parsed, but they will be created on
demand. Most importantly, they are named for ease of use in pipeline
layouts.
2023-02-26 20:54:11 +09:00
Bill Currie
44f058869f [gamecode] Fix a doxygen warning 2023-02-26 20:53:02 +09:00
Bill Currie
694c3ad5f5 [qfcc] Ensure params and arguments have unique flow addresses
This fixes the false-negative in the dealloc-warn4.r test (and thus what
I found in vkgen), and should stave off a few other issues.
2023-02-26 20:43:52 +09:00
Bill Currie
461bb9f434 [vkgen] Make labeled arrays independent of struct order
It turns out labeled arrays don't work if structs aren't declared in the
right order (no idea what that is, though) as the struct might not have
been processed when the labeled array field is initialized. Thus, do a
pro-processing pass to set up any parse data prior to writing the
tables.
2023-02-26 20:43:52 +09:00
Bill Currie
b103709bfd [qfcc] Fix incorrect build error in dealloc-warn2
It was dying due to an undefined symbol rather than the warning.
2023-02-26 20:09:21 +09:00
Bill Currie
e07f25e10f [qfcc] Add failing test for super dealloc
While working on vkgen, I found a dealloc that wasn't calling [super
dealloc] but qfcc hadn't noticed it.
2023-02-26 20:08:56 +09:00
Bill Currie
a907f78143 [vulkan] Create a function for symtab creation
Most importantly, this cleans up creation of self-referencing symbol
tables from property lists, but adds in C-defined symbols as well. While
QFV_ParseRenderInfo is currently the only the function that uses it, it
might be helpful in the future, especially as I clean up the other parse
support code.
2023-02-26 13:51:24 +09:00
Bill Currie
75e553ffa0 [vulkan] Try to create render passes and pipelines
The render passes seem to be created successfully, but pipelines fail
due to not having layout set, resulting in a segfault (bug in validation
layers?).
2023-02-21 11:23:02 +09:00
Bill Currie
f13bc4f4b1 [vkgen] Allow mixed dictionary .type parsing 2023-02-21 00:42:12 +09:00