Commit graph

2503 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Bill Currie
421467529f [vulkan] Create the render images and views
And tear them down again on shutdown. The images and views are in a
qfv_resource_t block, making their management much easier.
2023-02-19 13:13:01 +09:00
Bill Currie
1ef658a260 [vulkan] Add a function to config render output
It just moves the already existing code from vulkan_main.c.
2023-02-19 12:38:46 +09:00
Bill Currie
fc06547dd9 [vulkan] move qfv_output_t to render.h
The plan is qf_renderpass.h (and vulkan_renderpass.c) will eventually
disappear as they get absorbed by render.[ch].
2023-02-19 12:31:40 +09:00
Bill Currie
fd36147749 [vulkan] Complete resource image and image view
I don't remember why I kept the abbreviated configs for images and image
views, but it because such that I need to be able to specify them
completely. In addition, image views support external images.

The rest was just cleaning up after the changes to qfv_resobj_t.
2023-02-19 12:25:13 +09:00
Bill Currie
ed74a6420b [vulkan] Set a reasonable default for color blend
Vulkan requires color blend state is only for color attachments (ignored
otherwise), but it shouldn't be necessary to actually specify the blend
state and instead have it default to something reasonable.
Unfortunately, colorWriteMask affects the output even if blending is
disabled, so it must be initialized to something reasonable (r|g|b|a)
for when the default is used.
2023-02-18 17:22:06 +09:00
Bill Currie
868db37461 [vkgen] Improve .type parse spec handling
.dictionary can ask for standard parsing via a .parse key (value is
ignored currently).

Fields can use $auto to use standard parsing for that field.

If either is used, the plist field descriptors are written.
2023-02-18 17:16:31 +09:00
Bill Currie
422aaf4bc6 [vulkan] Register task functions for the pipelines
They're currently just stubs, but this gets the render info loading
working without any errors. The next step is to connect up pipelines and
create the image resources, then implementing the task functions will
have meaning.
2023-02-14 15:29:00 +09:00
Bill Currie
f78aab1cb5 [vulkan] Create a render context
This gets an empty (no tasks or pipelines connected) render context
initialized and available for other subsystems to register their task
functions. Nothing is using it yet, but the test parse of rp_main_def
fails gracefully (needs those tasks).
2023-02-14 15:26:06 +09:00
Bill Currie
91d9d0b251 [vulkan] Implement task parameter parsing
This should fill in the task function's parameters nicely. The parameter
count check is known to work.
2023-02-14 15:25:35 +09:00
Bill Currie
2c3b89f722 [vulkan] Implement task function parsing
This just sets up the memory block and cexpr descriptors for the
parameters, parameter parsing is separate (and next). The parameters are
aligned to their size.
2023-02-14 15:25:04 +09:00
Bill Currie
3fea31875c [vulkan] Get render pass inheritance working
Needed to add the render passes plitem to the cexr symbol table, too.
All that remains is to figure out how to deal with multiview (or really
@next) and get task parsing working.
2023-02-14 15:24:42 +09:00