Commit graph

275 commits

Author SHA1 Message Date
Bill Currie
eb8fc0fb9a [vulkan] Be clearer about descriptor set layouts vs sets
This get pretty confusing when you refer to both the sets and the set
layouts in close vicinity.
2023-03-29 09:45:17 +09:00
Bill Currie
47bfa23d09 [vulkan] Stub out the basic job execution
Really, a bit more than stub as the basic code is there, but nothing
works properly yet due to missing resources (especially descriptor sets
and pools), and the frame buffer creation is still disabled.
2023-03-28 10:28:44 +09:00
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
aba057b827 [vulkan] Correct type of queue family
No idea why I had int32_t instead of uint32_t.
2023-03-27 23:51:32 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
cbb43d8b29 [vulkan] Fix incorrect header guard 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
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
ae0b781818 [vulkan] Implement water warp
The separated output pass made the implementation very easy, as did
having most of the parts already in place.
2023-01-19 23:05:06 +09:00
Bill Currie
4e1ddaa964 [renderer] Add fitted pic rendering
The pic is scaled to fill the specified rect (then clipped to the
screen (effectively)). Done just for the console background for now, but
it will be used for slice-pics as well.

Not implemented for vulkan yet as I'm still thinking about the
descriptor management needed for the instanced rendering.

Making the conback rendering conditional gave an approximately 3% speed
boost to glsl with the GL stub (~12200fps to ~12550fps), for either
conback render method.
2023-01-17 11:33:47 +09:00
Bill Currie
c8afad4d3d [vulkan] Make QFV_PacketCopyBuffer take destination offset
It's useful being able to update a subregion of a buffer (needed for the
quad drawing changes).
2023-01-11 11:34:22 +09:00
Bill Currie
b310ece7bd [vulkan] Clean up draw a little bit
It's just removing some functions that will never be implemented, and an
unnecessary field.
2023-01-09 13:31:53 +09:00
Bill Currie
5668006087 [renderer] Replace Draw_FontString with Draw_Glyph
While Draw_Glyph does draw only one glyph at a time, it doesn't shape
the text every time, so is a major win for performance (especially
coupled with pre-shaped text).
2022-12-10 18:55:08 +09:00
Bill Currie
136bf882f6 [ui] Move font loading into new gui library
Font and text handling is very much part of user interface and at least
partially independent of rendering, but does fit it better with GUI than
genera UI (ie, both graphics and text mode), thus libQFgui as well as
libQFui are built in the ui directory.

The existing font related builtins have been moved into the ruamoko
client library.
2022-12-07 17:38:38 +09:00
Bill Currie
17c3f12ba2 [vulkan] Add a cvar for oit fragment buffer size
My laptop can't have a buffer larger than 128MB, but 16M fragments wants
512MB. Also, someone running at 4k will probably want a larger buffer.
2022-12-02 13:34:33 +09:00
Bill Currie
1d84d54509 [vulkan] Add cvars to control vulkan 3d frame buffer size
Thanks to the 3d frame buffer output being separate from the swap chain,
it's possible to have a different frame buffer size from the window
size, allowing for a smaller buffer and thus my laptop can cope (mostly)
with the vulkan renderer.
2022-12-02 13:17:07 +09:00
Bill Currie
966ef949c5 [vulkan] Move oit blending into compose subpass
I had debated putting the blending in the compose subpass or a separate
pass but went with the separate pass originally, but it turns out that
removing the separate pass gains 1-3% (5-15/545 fps in a timedemo of
demo1).
2022-12-01 23:03:55 +09:00
Bill Currie
00cade072c [vulkan] Implement order implement transparency
It's a bit flaky for particles, especially at higher frame rates, but
that's due to supporting only 64 overlapping pixels. A reasonable
solution is probably switching to a priority heap for the "sort" and
upping the limit.
2022-12-01 03:00:47 +09:00
Bill Currie
30b38d7f3f [vulkan] Implement particle rendering
They sort of kind of maybe try to work, but there's plenty wrong. I
suspect synchronization and probably other factors.
2022-11-28 10:21:20 +09:00
Bill Currie
d9b0ee22e6 [vulkan] Get particle compute pipelines running
I don't yet know whether they actually work (not rendering yet), but the
system isn't locking up, and shutdown is clean, so at least resources
are handled correctly.
2022-11-28 00:52:07 +09:00
Bill Currie
85d40123e7 [vulkan] Remove depth pass from 2d rendering
I realized afterwards it wasn't really want I want as it would mess with
things like water warp and other effects.
2022-11-27 00:35:38 +09:00
Bill Currie
3360578875 [vulkan] Rework render pass setup
This splits up render pass creation so that the creation of the various
resources can be tailored to the needs of the actual render pass
sub-system. In addition, it gets window resizing mostly working (just
some problems with incorrect rendering).
2022-11-26 23:26:35 +09:00
Bill Currie
87f99f9081 [vulkan] Limit shadow textures to 32
This is the minimum maximum count for sampled images, and with layered
shadow maps (with a minimum of 2048 layers supported), that's really way
more than enough.
2022-11-25 13:35:07 +09:00