Commit Graph

13317 Commits

Author SHA1 Message Date
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
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 105bbbc0f2 [vulkan] Use correct type for subpass attachments
Subpass attachments needs to be an attachment set, not just an array of
refs. The parsing was correct.
2023-02-18 17:16:50 +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 d89ad6b00f [plist] Fix a typo in the type mismatch message 2023-02-18 16:56:38 +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
Bill Currie 728807bd7a [vulkan] Use references for views and pipelines
I'm pretty sure I don't want to require views to be created and
pipelines to be parsed just to parse the render pass info.
2023-02-14 15:24:24 +09:00
Bill Currie 345aa8e094 [vkgen] Add support for directly scripted parsing
It's very early, but it does the job for what I needed (storing the
string item and line number).
2023-02-14 15:23:32 +09:00
Bill Currie cd1b20dc22 [vulkan] Get render info parsing mostly working
Just frame buffer and pipeline info to clean up before worrying about
tasks.
2023-02-14 15:23:02 +09:00
Bill Currie 2287a3de3f [vulkan] Get render info parsing partially working
A bunch of missed struct members, incorrect parse types, and some logic
errors in the parse setup. Still not working due to problems with
vectors from plist string references and some other errors, but getting
there.
2023-02-14 15:22:35 +09:00
Bill Currie 7235fcb5b9 [vkgen] Support direct parsing of a single struct field
This is most useful when parsing a labeled array where the key/value
pairs go into a simple array:

    key = value;

going to:

    struct foo {
        const char *key;
        enumtype    value;
    };
2023-02-14 15:22:11 +09:00
Bill Currie 3498d8b2ae [vkgen] Add support for labeled array elements
This treats dictionary items as arrays ordered by key creation (ie, the
order of the key/value pairs in the dictionary is preserved). The label
is written to the specified field when parsing the struct. Both actual
arrays and single element "arrays" are supported.
2023-02-14 15:22:09 +09:00
Bill Currie 061f90ab83 [vkgen] Add support for array element data
While I wound up not needing it in the end, it's now possible to specify
extra data for array element parsing.
2023-02-14 15:19:58 +09:00
Bill Currie 9e050ebf9a [vulkan] Attempt to load the render info spec
It fails due to not supporting labeled arrays yet. I'm currently
thinking about the design for vkgen.
2023-02-14 15:17:18 +09:00
Bill Currie c94e691e7e [vkgen] Fix some whitespace
I thought I'd indented that block, but I guess I'd gotten confused while
doing some before and after checks of the indent.
2023-02-14 15:15:58 +09:00
Bill Currie c3f8e5bcc5 [vkgen] Support ignored fields
This allows having sections in a spec used for things like `properties`
that have no corresponding fields in the actual struct: the field is
ignored when parsing and no cexpr field symbol is emitted.
2023-02-14 15:15:35 +09:00
Bill Currie d34e6cffdf [vkgen] Clean up most of the generated header
I'll probably completely remove it as only vkparse.c includes it, but
this tidies things up a bit and even simplifies vkgen's loops a little.
2023-02-14 15:15:14 +09:00
Bill Currie 7aa5470c68 [vulkan] Add initial render info parser
It doesn't work yet, but I've some otherwise breaking changes I want in
(getting this in now prevents the breakage).
2023-02-14 15:14:50 +09:00
Bill Currie e10b084d36 [vulkan] Generate parse data for new render pass structs
There's still a lot of work to do, but the basics are in. The spec will
be parsed into info structs that can then be further processed to
generate all the actual structs, generally making things a little less
timing dependent (eg, image view info refers to its image by name).

The new render pass and subpass structs have their names mangled for now
until I can switch over to the new system.
2023-02-14 15:14:45 +09:00
Bill Currie 97b2f2afb0 [vkgen] Support vec4f_t fields
It's currently a bit of a hack via aliases, but it fits in with the
current support for uint32_t and size_t.
2023-02-14 15:10:46 +09:00
Bill Currie 403c6eea73 [vkgen] Recognize `char *` as a string
Ruamoko currently doesn't support `const`, so that's not relevant, but
recognizing `char *` (via a hack to work around what looks like a bug
with type aliasing) allows strings to be handled without having to use a
custom parser. Things are still a little clunky for custom parsers, but
this seems to be a good start.
2023-02-14 15:10:09 +09:00
Bill Currie d5cd4f6ede [vkgen] Use typedef name for structs
Using the typedef name makes using structs declared as

    typedef struct foo_s { ... } foo_t;

easier and cleaner. Sure, I could have written the "struct foo_s" for
the output name, but I'm much more likely to look for foo_t than foo_s
when checking the generated code.
2023-02-14 13:42:25 +09:00
Bill Currie 7c1aff6736 [vulkan] Begin work on a new render pass system
While the old system did get things going, it felt clunky to set up,
especially when it came to variations on render passes (eg, flat vs
cube-mapped). Also, much of it felt inside-out, especially the
separation of pipelines and render passes: having to specify the render
pass and subpass in the pipeline spec made the spec feel overly coupled
to the render pass setup. While this is the case in Vulkan, it is not
reflected properly in the pipeline spec. The new system will adjust the
render pass and subpass parameters of the pipeline spec as needed,
making the pipeline specs more reusable, and hopefully less error prone
as the pipelines are directly referenced by the subpasses that use them.

In addition, subpass dependencies should be much easier to set up as
only the dependent subpass specifies the dependency and the subpass
source dependency is mentioned by name. Frame buffer attachments also
get a similar treatment.

The new spec "format" isn't quite finalized (needs to meet the enemy
known as parsing) but it feels like a good starting place.
2023-02-14 13:39:07 +09:00
Bill Currie 477057a5ad [vulkan] Fix some forward declarations and namespace issues 2023-02-14 13:24:47 +09:00
Bill Currie b08639fc82 [vulkan] Run sky surfaces through the depth pass
I suspect this is a hold-over from before the bsp thread safety changes,
but with the nicely separated queues, it's easy to pass the sky surfaces
through the depth pass as well as the translucency pass (I think the
reason for that is lighting). This prevents bits of world being seen
through sky surfaces when the sky isn't fully opaque (like skysheet due
to the shortcuts in the shader).
2023-02-14 13:24:47 +09:00
Bill Currie cbb43d8b29 [vulkan] Fix incorrect header guard 2023-02-14 13:24:47 +09:00
Bill Currie 8601e09569 [vulkan] Use view local dependencies for cube rendering
It doesn't fix the problems on my laptop, but it might improve
performance on my 1080 (but I doubt it will make much difference).
2023-02-14 13:24:47 +09:00
Bill Currie f78fcec689 [vulkan] Create view matrices for fisheye cube maps
Really any cube maps, but currently the check is for fisheye rendering.
2023-02-14 13:24:47 +09:00
Bill Currie 0ccee3032e [vulkan] Add partial support for cube maps to OIT
Partial because frame buffer creation isn't handled yet (using six
layers), but using layer a layer capable view and shaders doesn't cause
problems (other than maybe slightly slower code).
2023-02-14 13:24:47 +09:00