Commit graph

13194 commits

Author SHA1 Message Date
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
Bill Currie
6d7a9e2bc2 [vulkan] Prioritize fisheye over waterwarp
Pushing waterwarp's constants into fisheye's buffer resulted in some
rather weird effects when underwater with fisheye active.
2023-02-14 13:24:47 +09:00
Bill Currie
36f1c26ac1 [vulkan] Fix incorrect render pass for shadow pipelines
Noticed while getting fisheye limping.
2023-02-14 13:24:47 +09:00
Bill Currie
759e3455c3 [vulkan] Hook up fisheye rendering in the output pass
It turns out that my laptop doesn't do multiview properly (or I've
misconfigured something, later), but the biggest issue I had on my
desktop seems to be that I had the push constants wrong: fov in aspect,
time in fov, and I had degrees instead of radians (half angle) anyway.
2023-02-14 13:24:47 +09:00
Bill Currie
4cb120e878 [vulkan] Implement most of the changes for cube rendering
There are some missing parts from this commit as these are the fairly
clean changes. Missing is building a separate set of pipelines for the
new render pass (might be able to get away from that), OIT heads texture
is flat rather than an array, view matrices aren't set up, and the
fisheye renderer isn't hooked up to the output pass (code exists but is
messy). However, with the missing parts included, testing shows things
mostly working: the cube map is rendered correctly even though it's not
displayed correctly (incorrect view). This has definitely proven to be a
good test for Vulkan's multiview feature (very nice).
2023-02-14 13:24:47 +09:00
Bill Currie
0cf341d1cb [vulkan] Remove brush entity frustum culling
It doesn't gain all that much and gets in the way of efficient
cube-mapping.
2023-02-14 13:24:47 +09:00
Bill Currie
25ac0ff303 [vulkan] Adapt the shaders for multi-view
Multi-view will be used for shadows and fisheye.
2023-02-14 13:24:47 +09:00
Bill Currie
e709eceb75 [vulkan] Use matrices header in geometry shaders
I had missed them earlier as I had forgotten about them (looked only at
vertex shaders).
2023-02-14 13:24:47 +09:00
Bill Currie
d59dcba37d [qw] Update http_progress for recent curl
CURLOPT_PROGRESSFUNCTION was deprecated in favor of
CURLOPT_XFERINFOFUNCTION (and the parameters for the callback adjusted).
I'm not sure why this didn't trigger until now.
2023-02-14 12:45:04 +09:00
Bill Currie
6f429311c9 [cexpr] Use func instead of result type for end of list
While the cexpr parser itself doesn't support void functions, they have
their uses when used with the system, and mixing them into the list of
function overloads shouldn't break non-void functions.
2023-02-14 12:45:04 +09:00
Bill Currie
2748f1c9f7 [ruamoko] Add support for PL_KeyAtIndex
I'd forgotten to wrap the function when I added it, but didn't need it
until now.
2023-02-14 12:45:04 +09:00
Bill Currie
c16d0bae7b [qfcc] Fix handling of storage class {...} blocks
Another victim of the type system, but this one was due to the handling
of storage classes in general.
2023-02-14 12:45:04 +09:00
Bill Currie
3da7ca4421 [qfcc] Support qc function local variables
This had gotten completely lost in the rework.
2023-02-14 12:45:04 +09:00
Bill Currie
3a297c70b3 [qfcc] Handle qc function field parameters
The type system rewrite had lost some of the checks for function fields.
This puts the actual code in the one place and covers parameters as well
as globals.
2023-02-14 12:45:04 +09:00
Bill Currie
fa97074aff [qfcc] Update vector constant folding checks
Internally, * is not really a valid operator for vectors since it can
have many meanings. This didn't cause trouble until trying to build
everything in game-source (since there's still a lot of legacy code in
there).
2023-02-14 12:45:04 +09:00
Bill Currie
b7ad02c71d [qfcc] Use float for v6 comparisons
While simple types used floats, functions, vectors and entities used
ints. This doesn't go so well when compiling for v6 progs.
2023-02-14 12:45:04 +09:00
Bill Currie
67eb38173b [qfcc] Back out incorrect precedence check changes
The precedence check changes done in
63795e790b seem to have been incorrect
(game-source/ctf produced many false positives), so putting that check
against '=' back into the code seems like a good idea (no more false
positives). That sounds a bit cargo-cult, but I'm really not sure what I
was thinking when I did the changes (probably just tired).
2023-02-14 12:45:04 +09:00
Bill Currie
a2b5ebde65 [qfcc] Treat parameter shadowing as an error
This applies only to the top-level scope of the function. I'm not sure
if it's right for traditional quakec code, but that can be adjusted
easily enough.
2023-02-14 12:45:04 +09:00
Bill Currie
bc2204d446 [qfcc] Differentiate symtabs by intended use
The symtab code itself cares only about global/not global for the size
of the hash table, but other code can use the symtab type for various
checks (eg, parameter shadowing).
2023-02-14 12:45:04 +09:00
Bill Currie
65e15c2dd0 [cexpr] Keep track of unidentified symbol names
At least with a push-parser, by the time the parser has figured out it
has an identifier, the lexer has forgotten the token, thus the annoying
and uninformative "undefined identifier " error messages. Since
identifiers should always have a value (and functions need a function
type), setting up a dummy symbol with just the identifier name
duplicated seems to do the trick. It is a bit wasteful of memory if
there are a lot of such errors between cmem resets, though.
2023-02-14 12:45:04 +09:00
Bill Currie
cb99c4d907 [cexpr] Support casts from plist to vector
This makes specifying colors in the vulkan parser a lot easier.
2023-02-14 12:45:04 +09:00
Bill Currie
9706d2d9ce [plist] Fix a typo in a comment 2023-02-14 12:45:04 +09:00
Bill Currie
d5b93c20b3 [plist] Pass array index/label to the parse function
I ran into the need to get at the label of labeled array element and the
best way seemed to be by setting the name field of the plfield_t item
passed to the parser function, and then found that PL_ParseSymtab
already does this. I then decided passing the array index would also be
good, and the offset field made sense.
2023-02-14 12:45:04 +09:00
Bill Currie
35df90cb3f [ruamoko] Add qfot_basic_t to qfot_type_t
qfot_basic_t is necessary for getting at the width of basic value types
(int, uint, float, long, ulong, double) in order to distinguish between
scalars and vectors of those types.

I had forgotten this when doing the Ruamoko VM and qfcc changes.
2023-02-14 12:45:04 +09:00