Commit graph

14459 commits

Author SHA1 Message Date
Bill Currie
dfcad353fb [vulkan] Free the alias model resource block
I forgot to do so when switching to using resource (plugs a leak).
2024-01-03 12:39:54 +09:00
Bill Currie
f5ebc1083f [ecs] Pass the registry in to the component destroy function
This makes it possible for hierarchies to clean themselves up (by
deleting their entities (though that will cause other problems later
when the hierarchy doesn't own the entities)), thus plugging a memory
leak when parsing passage text.
2024-01-03 12:39:54 +09:00
Bill Currie
35eec0b2e5 [ecs] Implement hierarchies as components
The main goal of this change was to make it easier to tell when a
hierarchy has been deleted, but as a side benefit, it got rid of the use
of PR_RESMAP. Also, it's easy to track the number of hierarchies.

Unfortunately, it showed how brittle the component side of the ECS is
(scene and canvas registries assumed their components were the first (no
long the case), thus the sweeping changes).

Centerprint doesn't work (but it hasn't for a while).
2024-01-02 16:38:01 +09:00
Bill Currie
fc9c2fa544 [ui] Add a function to get root view from any view
This proved useful with canvas references.
2023-12-31 14:39:14 +09:00
Bill Currie
6b2bd02b14 [ui] Add a canvas reference component
It's used for finding the entity that has the actual canvas component
attached. Useful for sharing a single canvas between multiple view
hierarchies, and worked as a proof of concept for doing similar with
hierarchy references, and might work for properly destroying canvas
items (fills etc) when a view entity is deleted (if attached to every
view).
2023-12-31 14:15:05 +09:00
Bill Currie
9a74fb0a14 [ecs] Add basic entity and registry printing
Entities print their status and attached component names, registries
print their component counts for each pool.
2023-12-31 14:08:01 +09:00
Bill Currie
f5de553949 [ui] Take passage view parent parameter
I'm not sure this will be useful in imui, but it might in a retained
mode UI.
2023-12-28 16:43:31 +09:00
Bill Currie
f4f81db440 [ui] Free any preexisting passage glyphs
This plugs a memory leak in Text_PassageView.
2023-12-28 16:40:26 +09:00
Bill Currie
dc8ee14f50 [ruamoko] Use a single dstring for (v)sprintf
Rather than creating and destroying one every call. Didn't make any real
difference to the memory leaks, but it should make the calls
fractionally faster and reduce fragmentation.
2023-12-28 16:31:00 +09:00
Bill Currie
0a7042f318 [sys] Don't use va_copy in Sys_Error
It shouldn't be necessary since Sys_Error can restart args itself.
2023-12-28 16:11:06 +09:00
Bill Currie
4c704e9a2e [ecs] Give registries a name
This makes debugging a little easier when there are multiple ECS
registries. Currently, the name parameter must be a stable pointer.
2023-12-28 16:08:40 +09:00
Bill Currie
1a5b421933 [ruamoko] Share registry between gui and imui
I can't say I like there being a hard-coded registry, but gui and imui
need to agree on all aspects of the ECS registry they use.
2023-12-28 16:06:47 +09:00
Bill Currie
6b6c91e993 [alsa] Fix a missing \n in a message
I guess I had thought it was Sys_Error instead of Sys_Printf (or maybe I
changed it).
2023-12-27 16:05:24 +09:00
Bill Currie
d5b0a51b6e [dstring] Use va_copy correctly
Every use of va_copy needs a corresponding call to va_end. I had somehow
missed that when getting _dvsprintf to work properly. This seems to plug
a memory leak (certainly doesn't make things worse).
2023-12-27 16:03:05 +09:00
Bill Currie
75171743a4 [ecs] Destroy component pools in reverse order
This seems to be the best solution for interlinked entities/components,
the idea being that components with higher indices can "own" those with
lower (eg, imui_reference can "own" a view_href, but not the other way)
and makes it relatively easy to manage (components that can own others
get added to the registry later), and might even allow validation at a
later stage.
2023-12-26 11:10:07 +09:00
Bill Currie
767f4ff02e [ui] Plug a hierarchy reference leak
I'm not entirely sure what's going on yet, but deleting the referenced
view via its entity rather than the view results in a corrupted href in
the component pool (with a null entity id in the dense array) and then
an href component leak (as well as some very weird numbers when dumping
canvas bounds). I suspect Hierref_DestroyComponent is missing a few
steps (though I do need to verify that it's getting called in this
particular case).
2023-12-24 02:22:46 +09:00
Bill Currie
dd11a7b378 [vulkan] Apply 2d scale to clipping bounds
It was a little off-putting getting an incorrectly clipped console when
using non-unitary scale (especially since I was trying to show abbator
something).
2023-12-24 02:14:24 +09:00
Bill Currie
101c50e3e1 [ui] Sort out most of the nested canvas layout issues
Draw order is now stable and sizing is mostly correct.
2023-12-23 19:25:30 +09:00
Bill Currie
a50c1d0f81 [ui] Implement nested canvases
This is for scroll boxes (the nesting of canvases is for the clipping
they provide). There are some issues with automatic layout, but this
gets things mostly working, in particular the management of the link
between hierarchies as a canvas is always the root of its hierarchy.
2023-12-23 14:36:57 +09:00
Bill Currie
6faa78eaa1 [ui] Change draw order from 16-bit to 32-bit
With the scroll box work I'm doing, I realized 16 bits is a little
cramped. Although I doubt it would be that much of a problem, switching
to 32 bits turned out to be free because of alignment.
2023-12-23 14:31:58 +09:00
Bill Currie
34f16e10e4 [ui] Correct the spelling of imui_size_t
Really, just a stale comment from when I first started down the imui
path.
2023-12-23 14:26:50 +09:00
Bill Currie
86326c8179 [ui] Clip rendering to canvas bounds
This causes minor problems when the window gets too small, but it will
allow for scrollable regions.
2023-12-22 18:27:23 +09:00
Bill Currie
00d9f039fc [vulkan] Set debug windows to auto_fit
I'd missed this earlier, thus the vulkan debug windows wound up a tad
small.
2023-12-22 18:25:04 +09:00
Bill Currie
7f1c20afa9 [ui] Implement window resizing
There are some rather iffy parts (windows can get too small), and the
drag bars are a little odd, but the concepts are working.
2023-12-22 18:22:21 +09:00
Bill Currie
650ea052ea [vulkan] Support clipping rectangles via scissor
Seems to work well. The other renderers have stubs because I don't feel
like implementing clipping for them. The gl and glsl wouldn't be too
difficult (need to handle the draw queues), but sw needs a fair bit of
work and I'm not sure it's worth the effort.
2023-12-22 18:17:09 +09:00
Bill Currie
f3eebae9bc [vulkan] Destroy the tracy GPU contexts
I had forgotten about doing so because I was doing my profiling without
validation layers.
2023-12-22 13:44:31 +09:00
Bill Currie
dc0b4880e3 [vulkan] Use VkValidationFeatureEnableEXT
It's currently unused as it does flag a pile of things I need to fix,
but I don't want to deal with them right now (though I have fixed a
few).
2023-12-22 12:29:59 +09:00
Bill Currie
1ca655c0d8 [ui] Clean up a lot of duplicate code
Much of the state handling was highly redundant (in particular, handling
entity and old_entity). This should make it easier to get dragable items
for window resizing.
2023-12-21 19:59:40 +09:00
Bill Currie
a300e2330d [ui] Make windows respect their size fields
If auto_fit is true, then the old behavior is retained.

This is actually better than the set size thing, but that's probably
still useful.
2023-12-21 19:57:02 +09:00
Bill Currie
f80f265a07 [ui] Support pixel sizing of im views
This will allow for user-controllable window sizes.
2023-12-21 17:02:59 +09:00
Bill Currie
4483368319 [ruamoko] Add bindings for imui
Things are a little clunky, but I've got a little window I can
manipulate in my test scene :)
2023-12-21 16:11:30 +09:00
Bill Currie
866cdcf068 [renderer] Reset fov when fisheye disabled
This fixes the badly stretched view after disabling fisheye.
2023-12-21 13:28:52 +09:00
Bill Currie
c5d27f5162 [client] Merge sbar into hud
This cleans up a lot of the twisted code between the two files. With the
rewrite of hud/sbar last year, there's really no separation between the
two.
2023-12-21 12:35:02 +09:00
Bill Currie
a3e1a01adf [cl_menu] Set input line width
I have no idea when this became necessary, but at least the API was
already there.
2023-12-21 10:30:57 +09:00
Bill Currie
3dd7678962 [cl_menu] Add CvarIntRange for integer sliders
Fixes viewsize not working (sort of: the slider now works, but the cvar
itself does not, but that's an engine issue).
2023-12-21 10:29:20 +09:00
Bill Currie
fc6c426241 [console] Clean up bitrot surrounding inputline
pr_argc no longer works for all functions (only for varargs). Fixes a
segfault when hitting enter in an input line in the menus. Also fix the
cursor.
2023-12-21 10:27:47 +09:00
Bill Currie
cc4fd5920f [ruamoko] Return float cvar values correctly
They don't work too well when going through int.
2023-12-21 10:25:44 +09:00
Bill Currie
ee986e3b2a [ruamoko] Use cvar toggle function
This fixes menu toggle items not working (eg fullscreen).
2023-12-21 10:24:21 +09:00
Bill Currie
ba0cf5fa9b [cvar] Add toggle and reset functions
The toggle function is needed for handling listeners, and reset was done
as part of the API cleanup.

Also clean up some of the names and API.
2023-12-21 10:22:21 +09:00
Bill Currie
92f68844f5 [ruamoko] Remove keys.h and keys.r
The functions haven't existed for two years now. And in the interest of
"throw one away", the controls_o.r has been gutted.
2023-12-21 08:40:09 +09:00
Bill Currie
5d4ce73ff4 [zone] Fix sentinel spelling in unit test 2023-12-21 02:30:39 +09:00
Bill Currie
049566062d [zone] Correct the spelling of sentinel 2023-12-21 02:18:56 +09:00
Bill Currie
82428ffb9d [zone] Fix z_split_block and Z_Realloc
z_split_block missed updating the back pointer in the block after the
split block, and Z_Realloc missed setting the sentinel.
2023-12-21 02:13:40 +09:00
Bill Currie
18c0ea3657 [qfcc] Ensure one is the correct type for incop expressions
This makes for nicer generated code when the incop (especially post) is
used in a condition.
2023-12-20 23:10:17 +09:00
Bill Currie
dd183d3ba6 [qfcc] Handle signed-unsigned int comparison better
This fixes the upostop-- test by auto-casting implicit constants to
unsigned (and it gives a warning for signed-unsigned comparisons
otherwise). The generated code isn't quite the best, but the fix for
that is next.

Also clean up the resulting mess, though not properly. There are a few
bogus warnings, and the legit ones could do with a review.
2023-12-20 23:09:06 +09:00
Bill Currie
54839db826 [qfcc] Add some tests for postop--
Interestingly, intval-- works properly, but unsignedval-- does not (test
case fails). This is why menus blow up when opening the load/save
sub-menu.
2023-12-20 21:50:51 +09:00
Bill Currie
aed637e4de [zone] Reimplement Z_Realloc
It now checks the next block to see if it is free with enough space and
carves off a chunk if so, or chops off the end of the current block if
smaller, otherwise it allocates *before* freeing.
2023-12-20 21:16:16 +09:00
Bill Currie
de7293c16a [zone] Be more consistent with pointer to block conversion
Most importantly, the error checking is consistent.
2023-12-20 18:37:47 +09:00
Bill Currie
1266ede2b1 [zone] Make zone_error be like printf
It's so much nicer being able to just print normally.
2023-12-20 18:32:53 +09:00
Bill Currie
10451fac0d [nq] Don't delete player entity if no model set
The model gets unset during intermission and deleting the entity breaks
the intermission camera. This doesn't really feel right, but it does fix
the intermission camera. Really, the whole entity linking thing and
camera control needs a cleanup (and merging between nq and qw).
2023-12-19 21:33:19 +09:00