Commit graph

1819 commits

Author SHA1 Message Date
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
82d0b7ecd5 [vulkan] Use slice pipeline for glyphs
It turns out the slice pipeline is compatible with the glyph pipeline in
that its vertex attribute data is a superset (just the addition of the
offset attributes). While the queues have yet to be merged, this will
eventually get glyphs, sliced sprites, and general (static) quads into
the one pipeline. Although this is slightly slower for glyph rendering
(due to the need to pass an extra 8 bytes per glyph), this should be
faster for quad rendering (when done) as it will be 24 bytes per quad
instead of 32 bytes per vertex (ie, 128 bytes per quad), but this does
serve as a proof of concept for doing quads, glyphs and sprites in the
one pipeline.
2023-01-05 16:34:01 +09:00
Bill Currie
3da90b612f [vulkan] Remove superfluous glyph fragment shader
The main reason I had created in the first place was I hadn't thought of
using image view swizzles to handle coverage-alpha textures (for
monochrome glyphs), and for whatever reason also had the texture in a
different binding slot to the twod fragment shader. With both issues out
of the way, there's no reason to have an almost identical (just some
naming) shader just for glyphs.
2023-01-05 13:34:52 +09:00
Bill Currie
37b6d4da7e [vulkan] Switch glyph vertex and texture data bindings
With an eye towards merging the 2d pipelines as much as possible, I
found that the glyph and basic 2d quad texture descriptors were in
different slots for no reason I can think of. Having them in the same
slot would mean I could use the same fragment shader for all 2d
pipelines (though the plan is to get it down to two: (sliced) quads and
lines).
2023-01-05 13:25:46 +09:00
Bill Currie
5477749280 [vulkan] Use correct input assembly for sprite depth
I hadn't noticed the problem until playing with early fragment tests for
the sprite fragment shaders, but passing data that expects triangle
strips to a pipeline that expects triangle lists doesn't work too well
when drawing quads.
2022-12-23 12:47:28 +09:00
Bill Currie
ead5e89165 [renderer] Don't mark made pics as cached
Marking them as cached means that they'll be "uncached" instead of
destroyed when freed, which would not be a particularly good thing. I
have no memory as to how I found this as I found the change in my git
stash.
2022-12-14 12:40:14 +09:00
Bill Currie
6a9985c8aa [vulkan] Fix an uninitialized field
Yay valgrind. Luckily, there was a very tiny probability for it causing
problems, but 0 is better.
2022-12-10 19:05:39 +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
95f55dfc34 [ui] Move text handling into gui lib
And add a function to process a passage into a set of views with glyphs.
The views can be flowed: they have flow gravity and their sizes set to
contain all the glyphs within each view (nominally, words). Nothing is
tested yet, and font rendering is currently broken completely.
2022-12-08 15:33:50 +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
46967dbc05 [glsl] Implement font rendering
It's not the best code, but it does the job of getting the basics
working.
2022-12-06 01:18:01 +09:00
Bill Currie
1f5ec68b4a [sw] Convert built in 8x8 font transparent pixels
I had done the loader for the GPU renderers, so the CPU renderer didn't
draw the characters transparently. Fixes the pink block in my ruamoko
test scene (due to the notify text area).
2022-12-05 21:06:42 +09:00
Bill Currie
a9745d0540 [vulkan] Use tex_a instead of tex_l for glyphs
While it doesn't really make any difference to the texture upload (8-bit
is 8-bit), and the sampler is in control of the interpretation, this
makes vulkan more consistent with the specification of the glyph
texture.
2022-12-05 17:13:32 +09:00
Bill Currie
113e4d5cf0 [sw] Implement font rendering
That looks better than expected.
2022-12-05 15:24:14 +09:00
Bill Currie
022c49035f [gl] Add a function to load a tex_t image
In theory, it supports all the non-palette formats, but only luminance
and alpha (tex_l and tex_a) have been tested. Fixes the rather broken
glyph rendering.
2022-12-05 13:35:44 +09:00
Bill Currie
b987414c1d [gl] Implement font rendering
It doesn't quite work properly due to the alpha-coverage texture being
uploaded as normal quake data, but all the basics are working nicely.
2022-12-05 11:28:48 +09:00
Bill Currie
7c4ee70d9e [build] Fix windows builds
More bitrot.
2022-12-02 17:33:26 +09:00
Bill Currie
99b568c208 [build] Fix distcheck once again
Probably the hardest part of QF to maintain.
2022-12-02 17:10:04 +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
9b609469ed [vulkan] Prevent particle update buffers escaping the staging buffer
The escape was actually harmless as the buffers would not be read due to
the particle count being 0 (thus why the buffers were at the end of the
staging buffer: no space was allocated for them, only for the system
buffer, but their offsets were just past the system buffer). However,
the validation layers quite rightly did not like that. Thus, the two
buffers are pointed to the system buffer so all three descriptors are
always valid.
2022-12-02 12:46:45 +09:00
Bill Currie
b35854c706 [renderer] Improve time graph display
It now shows 200 frames and markings for 0, 1, 2, 2.5, 3.3, 5 and 10ms.
2022-12-02 10:52:16 +09:00
Bill Currie
958b6ff1d8 [glsl] Implement line graph drawing
Finally :/
2022-12-02 10:51:41 +09:00
Bill Currie
baed4bb160 [gl] Skip lights that are too far from the surface
Where too far is 1024 units as that is the maximum supported, or the
radius. The change to using unsigned for the distances meant the simple
checks missed the effective max dist going negative, thus leading to a
segfault.
2022-12-02 10:12:54 +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
9ba2d26542 [client] Move sbar.h into client
Where it belongs :P
2022-12-01 15:00:09 +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
ecd5e1de9f [vulkan] Ensure render passes have at least one subpass
Non-graphics render passes don't normally specify render pass info, but
still want frames and command buffers.
2022-12-01 02:50:07 +09:00
Bill Currie
b81a77c3f7 [vulkan] Get particle colors working for id style
This required making the texture set accessible to the vertex shader
(instead of using a dedicated palette set), which I don't particularly
like, but I don't feel like dealing with the texture code's hard-coded
use of the texture set. QF style particles need something mostly for the
smoke puffs as they expect a texture.
2022-11-28 22:57:22 +09:00
Bill Currie
76258906f9 [vulkan] Skip use of the physics event
It doesn't want to work on my nvidia (or more recent sid?) and doesn't
seem to be necessary. The problem may be multiple event sets before the
first wait, but investigation can wait for now.
2022-11-28 21:35:46 +09:00
Bill Currie
38b56b4ce8 [vulkan] Use correct offsets for new particle descriptors
This is probably the biggest reason I had problems with particles not
updating correctly: the descriptors were generally point pointing to
where the data actually was in the staging buffer.
2022-11-28 15:24:40 +09:00
Bill Currie
24c08a8dc4 [vulkan] Wait on physics event before drawing particles
This should be more correct. At least it passes validation on my laptop
(intel/llvm): I had trouble with it on nvidia.
2022-11-28 15:16:52 +09:00
Bill Currie
51f3d9b777 [vulkan] Fix particle local and dispatch sizes
This gets particles working in renderdoc, but they're quite broken
stand-alone, which I think means that synchronization is a problem.
2022-11-28 11:09:20 +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
dd1b15c92f [vulkan] Give staging buffers storage usage
Really, additional usage flags should be a parameter. Needed for
particles as the particle updates are read directly from the staging
buffer.
2022-11-28 00:49:32 +09:00
Bill Currie
efc3443c61 [vulkan] Create a water warp output pipeline
Although it works as intended (tested via hacking), it's not hooked up
as the current frame buffer handling in r_screen is not readily
compatible with how vulkan output is handled. This will need some
thought to get working.
2022-11-27 12:48:51 +09:00
Bill Currie
22615f25ab [vulkan] Move 2d to the output render pass
This separates 2d UI rendering from 3d world rendering, making way for
various post-processing effects on the 3d render.
2022-11-27 09:51:01 +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
2cb3083f97 [vulkan] Support parsing qfv_output_t
This will be needed by the revamped render pass code.
2022-11-26 22:22:22 +09:00
Bill Currie
7829ec3adb [vkgen] Add support for read-only values
This makes it possible to use the parser to read in certain fields, but
skip over others. The read-only is for cexpr parsing of the read-only
fields.
2022-11-26 22:15:15 +09:00
Bill Currie
7e16822f21 [vulkan] Recreate image available semaphore
It turns out the semaphore used for vkAcquireNextImageKHR may be left in
a signaled state for VK_ERROR_OUT_OF_DATE_KHR. While it seems to be
possible to clear the semaphore using an empty queue submission,
destroying and recreating the semaphore works well.

Still have problems with the frame buffer after window resize, though.
2022-11-25 18:18:41 +09:00
Bill Currie
0fdba75a6e [vulkan] Move swap chain image acquisition to the output module
Swap chain acquisition is part of final output handling. However, as the
correct frame buffers are required for the render passes, the
acquisition needs to be performed during the preoutput render pass.
Window resize is still broken, but this is a big step towards fixing it.
2022-11-25 16:08:15 +09:00
Bill Currie
92b36582ca [vulkan] Change curFrame from size_t to uint32_t
I very much doubt that even 4294967295 frames will be needed, let alone
more. Saves me having to use %zd or %zu all over the place.
2022-11-25 16:02:39 +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
Bill Currie
edc1326736 [vulkan] Search for BGRA8 instead of RGBA8
I guess nvidia gives a non-srgb format as the first in the list, but my
laptop gives an srgb format first, thus the unexpected difference in
rendering brightness. Hard-coding BGRA isn't any better, but it will do
for now.
2022-11-25 12:57:56 +09:00
Bill Currie
7a91c905e0 [vulkan] Fix broken line drawing
Line drawing was broken with the 2d depth pass (which will go away in
the end, but I like the organization of the draw code).
2022-11-25 11:12:05 +09:00
Bill Currie
d673887bf1 [vulkan] Get two render pass rendering working
Things are a bit of a mess with interdependence between sub-module
initialization and render pass initialization, and window resizing is
broken, but the main render pass rendering to an image that is then
post-processed (currently just blitted) is working. This will make it
possible to implement fisheye and water warp (and other effects, of
course).
2022-11-25 11:07:08 +09:00
Bill Currie
7f25c43472 [vulkan] Make script support objects more private
This will help keep changes to the scripting system localized once
things are further cleaned up.
2022-11-24 23:44:07 +09:00