Commit Graph

49 Commits

Author SHA1 Message Date
Bill Currie db6c76d583 [vulkan] Abandon bindless rendering
At least for now, it is more trouble than it is worth as it (or my
implementation of it) breaks lavapipe and renderdoc.
2021-12-24 06:45:13 +09:00
Bill Currie 6aaf5c3722 [vulkan] Start work on particles for Vulkan
This gets the pipelines loaded (and unloaded on shutdown). Probably the
easy part :P. Still need to sort out the command buffers,
synchronization, and particle generation (and probably a bunch else
that's not coming to mind).
2021-12-24 06:45:13 +09:00
Bill Currie c366b1b7bb [vulkan] Implement the sprite render passes
It turned out the bindless approach wouldn't work too well for my design
of the sprite objects, but I don't think that's a big issue at this
stage (and it seems bindless is causing problems for brush/alias
rendering via renderdoc and on my versa pro). However, I have figured
out how to make effective use of descriptor sets (finally :P).

The actual normal still needs checking, but the sprites are currently
unlit so not an issue at this stage.
2021-12-24 06:45:13 +09:00
Bill Currie 6fbce335bb [vulkan] Add an array view for default_magenta
The validation layers get very picky about image view types (rightfully
so, I imagine).
2021-12-24 06:45:13 +09:00
Bill Currie 8422732505 [vulkan] Move matrices into per-frame buffers
This should fix the horrid frame rate dependent behavior of the view
model.

They are also in their own descriptor set so they can be easily shared
between pipelines. This has been verified to work for Draw.
2021-12-24 06:45:13 +09:00
Bill Currie 928408bad9 [vulkan] Support multiple render passes
Multiple render passes are needed for supporting shadow mapping, and
this is a huge step towards breaking the Vulkan render free of Quake,
and hopefully will lead the way for breaking the GL renderers free as
well.
2021-12-24 06:45:12 +09:00
Bill Currie 8b85e422d7 [vulkan] Add a debug stack to the vulkan instance
The stack is arbitrary strings that the validation layer debug callback
prints in reverse order after each message. This makes it easy to work
out what nodes in a pipeline/render pass plist are causing validation
errors. Still have to narrow down the actual line, but the messages seem
to help with that.
Putting qfvPushDebug/qfvPopDebug around other calls to vulkan should
help out a lot, tool.
As a bonus, the stack is printed before debug_breakpoint is called, so
it's immediately visible in gdb.
2021-11-30 18:10:48 +09:00
Bill Currie c86f0c9449 [vulkan] Move projection matrix code to its own file
And move more stuff over to simd.
2021-04-25 15:48:21 +09:00
Bill Currie f13af65b32 [vulkan] Move viewport and scissor into vulkan_ctx
Not only does it makes sense to centralize the setting of viewport and
scissor, but it's actually necessary in order to fix the upside-down
rendering on windows.
2021-04-01 11:44:30 +09:00
Bill Currie c5c44da727 [vulkan] Implement screenshot
Finally, I can brag about my progress on irc :)
2021-03-24 19:20:53 +09:00
Bill Currie a0d47de439 [vulkan] Suppress all the debug output
silence is golden
2021-03-23 13:04:22 +09:00
Bill Currie 10a1b99a92 [vulkan] Implement lighting and compose passes
Lighting doesn't actually do lights yet, but it's producing pixels.
Translucent seems to be working (2d draw uses it), and compose seems to
be working.
2021-02-24 19:58:31 +09:00
Bill Currie 82eabb5ca2 [vulkan] Parse clear values
And get the render pass working in general. Note that this is only the
render pass and frame buffers: actual commands still have problems.
2021-02-23 14:37:48 +09:00
Bill Currie a94949c009 [vulkan] Start moving towards a deferred renderer
After getting lights even vaguely working for alias models, I realized
that it just wasn't going to be feasible to do nice lighting with
forward rendering. This gets the bulk of the work done for deferred
rendering, but still need to sort out the shaders before any real
testing can be done.
2021-02-14 11:35:06 +09:00
Bill Currie 1275067655 [vulkan] Rename vulkan_framebuffer_t
It turns out I had conflated frame buffers with frames and wound up
making a minor mess when separating the number of frames the renderer
could have in flight from the number of swap-chain images. This is the
first step towards correcting that mistake.
2021-02-05 10:22:32 +09:00
Bill Currie 8179c44042 [vulkan] Rework pipeline parsing for better reuse
It's not entirely there yet, but the basics are working. Work is still
needed for avoiding duplication of objects (different threads will have
different contexts and thus different tables, so necessary per-thread
duplication should not become a problem) and general access to arbitrary
fields (mostly just parsing the strings)
2021-02-04 17:03:49 +09:00
Bill Currie 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie 748217b438 [vulkan] Start work on alias model rendering 2021-01-26 20:58:24 +09:00
Bill Currie 49408c695d [vulkan] Get sky sheets mostly working
They render (incorrectly because the images weren't translated
correctly), but aren't animated (haven't pushed the time constant)
2021-01-23 22:51:59 +09:00
Bill Currie 93e9f89bd3 [vulkan] Create some default textures
Black, white and magenta. This gets glow (full bright) maps working.
2021-01-23 15:40:31 +09:00
Bill Currie d33f5b8d0d [vulkan] Make a lot of progress for brush models
Light maps are maybe updating, but as nothing is actually rendered yet,
it's hard to tell.
2021-01-20 01:28:54 +09:00
Bill Currie c7b2843c0e [vulkan] Create shanders for brush models
The fragment shader is a bit of a mini mega-shader, but I do want to try
out specializations.
2021-01-18 17:13:52 +09:00
Bill Currie 5186d3ae49 [vulkan] Rework draw to use a context struct
Cleans up global space and makes it usable in multiple contexts. Also,
max quads dropped to 32k as each frame now has its own vertex buffer to
avoid issues with vertex overwrites (which I have seen). However, all
vertex buffers are in the one memory/buffer object (using offsets) and
the index buffer has been moved into a device-local memory object.
2021-01-16 14:42:25 +09:00
Bill Currie 904a91c0b7 [vulkan] Use only one global staging buffer
I think I did two as a bit of a ring buffer, but the new ring buffer
system used inside a staging buffer makes it less necessary. Also, the
staging buffer is now a fair bit bigger (4M is probably not really
enough)
2021-01-16 14:37:16 +09:00
Bill Currie bb4ca7683e [vulkan] Get the 2D pipeline up and running
First pixels! This was a nightmare of little issues that the validation
layers couldn't help with: incorrect input assembly, incorrect vertex
attribute specs. Though the layers did help with getting the queues
working. Still, lots of work to go but this is a major breakthrough as
I now have access to visual debugging for textures and the like.
2021-01-12 11:27:41 +09:00
Bill Currie 8f6f32981c [vulkan] Add some matrix buffers
It seems they could all be in the one buffer: there are indications that
uniform binding can be fairly fine-grained. I need to investigate that.
2021-01-12 11:26:20 +09:00
Bill Currie 23db917ec4 [vulkan] Create a staging buffer struct
And move the barrier prefabs into a more convenient place.
2021-01-11 01:24:15 +09:00
Bill Currie ba6450d0b4 [vulkan] Make a start on the 2D pipeline
Short wrappers for Draw functins are in vid_render_vulkan.c so the
vulkan context can be passed on to the actual functions. The 2D shaders
are set up similar to those in glsl, but with full 32-bit color (rgba)
support instead of paletted. However, the textures are not loaded yet,
nor is anything bound.
2021-01-10 15:56:17 +09:00
Bill Currie 01b9c9bf78 [vulkan] Parse descriptor pools 2021-01-10 01:53:15 +09:00
Bill Currie 5eb1afdcb3 [vulkan] Implement pipeline creation
The prototypes for handle parsers needed to be changes because it turned
out "single" was inappropriate for handles as "single" allocates memory
for the parsed object, but handles must be written directly.
2021-01-05 23:42:30 +09:00
Bill Currie 7c661e7cc5 [vulkan] Remove renderpass from generated code
The creation of a render pass seems to need special handling.
2021-01-05 17:43:26 +09:00
Bill Currie e5708100bb [vulkan] Generate code for resource nodes
This makes it easy to add resource nodes defining contextually named
resources. It is already used for shaders, set layouts, and pipeline
layouts.
2021-01-05 14:15:35 +09:00
Bill Currie d8261ade9e [vulkan] Generate code for vulkan handles
The handles can be created in place or in resource blocks and referred
to by name (resource block code gen next).
2021-01-05 08:38:35 +09:00
Bill Currie d919a85c8e [vulkan] Implement pipeline layout creation
It seems to work when parsing the layouts. They can be created in-line
(in theory) or in a "setLayouts" node and then referenced by name.
2021-01-04 17:36:11 +09:00
Bill Currie 7fb335a215 [vulkan] Add support for building and loading shaders
Shaders can be built as spv files and installed into
$libdir/quakeforge/shaders or as spvc files and compiled into the
engine. Loading supports $builtin/name to access builtin shaders,
$shader/path to access external standard shaders and quake filesystem
access for all other paths.
2020-12-23 14:32:29 +09:00
Bill Currie 80aec45e35 [vulkan] Ensure msaa settings are consistent
I had forgotten that msaa samples was governed by the driver (as a max)
and the renderpass setup code simply took the max. Thus why 1 vs 8
caused the display to render incorrectly.
2020-12-21 20:17:27 +09:00
Bill Currie 96df447c45 [vulkan] Hook up the expression parser
The pipeline parser still isn't hooked up yet as something isn't quite
right, but it seems all the parsing works.
2020-12-21 18:38:31 +09:00
Bill Currie ba654b09f7 Create and destroy render pass and frame buffers 2020-02-18 17:18:37 +09:00
Bill Currie 1f4c019abc Create and destroy color/depth resources 2020-02-18 14:28:28 +09:00
Bill Currie 94565c2382 Rework much of the Vulkan array handling
So much for all those little wrappers hiding the device. Some survived,
but mostly just the bigger things like device, swapchain, etc.
2020-02-17 20:29:35 +09:00
Bill Currie 916e57de37 Get the swapchain image switching sort of working
The render pass isn't set up yet, so the validation layer is having a
fit, but cycling through the swapchain images does seem to be working.
2020-02-17 00:50:39 +09:00
Bill Currie 559bd2e636 Create command pool and frame timing fences
Nothing is actually done yet, so the reported fps is around 172k (yes,
k), but startup and shutdown seems to be clean (yay validation layers).
2020-02-16 22:45:27 +09:00
Bill Currie 75f19f7243 Completely rework the vulkan related api
Things don't work yet, but this feels much cleaner.
2019-07-12 13:34:31 +09:00
Bill Currie c0bc5cfad6 Implement swapchain creation 2019-07-11 00:58:14 +09:00
Bill Currie 2771e9c573 Correct extension handling
I had missed a critical bit from the cookbook.
2019-07-10 13:16:46 +09:00
Bill Currie 68449d0f6f Create a window and a surface for vulkan
Yay, segfaults in R_Init :)
2019-07-09 16:33:44 +09:00
Bill Currie b3d982bfc3 Remove global vulkan_ctx
While I can't say that I'm happy with the details of vulkan_ctx_t, I am
pretty sure I don't want to be limited to having only one.
2019-07-09 11:54:23 +09:00
Bill Currie 707bdfc5f2 Get vulkan back to where it was 2019-07-09 09:06:35 +09:00
Bill Currie 8ee06d75a9 Separate render and presentation initialization
This paves the way for clean initialization of the Vulkan renderer, and
very much cleans up the older renderer initialization code as gl and sw
are no longer intertwined.
2019-07-09 01:00:47 +09:00