Commit graph

2737 commits

Author SHA1 Message Date
Bill Currie
ed5ef3a5fb [ui] Implement event handling in imui
Button presses work nicely thanks to both Casey Muratori and Darian (for
clearing up some of Casey's comments about `hot`).
2023-07-02 01:25:27 +09:00
Bill Currie
e89b5a88fa [input] Add a shift enum element for numlock
I don't know why I missed this one.
2023-07-02 01:23:28 +09:00
Bill Currie
5099633bc8 [console] Start work on a debug UI
It does almost nothing (just puts a non-function button on the screen),
but it will help develop the IMUI code and, of course, come to help with
debugging in general.
2023-07-01 20:00:26 +09:00
Bill Currie
0257165b7d [ui] Add the beginnings of an immediate mode UI
Based on the articles on Hidden Grove
(https://www.rfleury.com/archive?sort=new). So far, I can get a
non-functional button on the screen :)
2023-07-01 19:55:19 +09:00
Bill Currie
4eef11c329 [ui] Add visibility control to canvases 2023-07-01 19:53:26 +09:00
Bill Currie
c1cd81222d [ui] Add font text drawing to canvas
Both passage and simple text are supported, but only simple text has
been tested at this stage. However, as passage text was taken directly
from rua_gui.c and formed the basis for simple text rendering, I expect
it's at least close to working.
2023-07-01 19:49:49 +09:00
Bill Currie
32346b6123 [ui] Add support for simple text strings
The same underlying mechanism is used for both simple text strings and
passages, but without the intervening hierarchy of paragraphs etc.
Results in only the one view for a simple text string.
2023-07-01 19:42:02 +09:00
Bill Currie
5fcc743d1a [ui] Use fontconfig to find system fonts
I'm not sure I like fontconfig (docs are...), but it is pretty standard,
and I was able to find some reasonable examples on stackexchange
(https://stackoverflow.com/questions/10542832/how-to-use-fontconfig-to-get-font-list-c-c).
Currently, only the one font is handled, no font sets for fall backs
etc. It's meant for the debug UI I'm working on, so that shouldn't be a
big deal.
2023-07-01 19:15:22 +09:00
Bill Currie
31151ec5d5 [ui] Rename Text_View to Text_PassageView
It works with passages but I want to be able to create simple text views
from strings, so Text_View was kind of polluting the namespace.
2023-07-01 14:40:20 +09:00
Bill Currie
0b0271ee76 [console] Provide control of cursor visibility
It's usually desirable to hide the cursor when playing quake, but when
using the console, or in various other states, being able to see the
cursor can be quite important.
2023-06-30 14:57:04 +09:00
Bill Currie
759e67bb7c [x11] Implement mouse visibility control
That was nicely easy.
2023-06-30 14:53:47 +09:00
Bill Currie
ec0c6ad906 [vid] Add an api function to control mouse visibility
It's currently very simplistic (visible, not visible), but it gets
things started for making QF more usable in a windowed environment (not
having a visible cursor was fine in DOS, or when full screen, but not
when windowed (and not actively playing).
2023-06-30 14:50:47 +09:00
Bill Currie
2b2398b193 [bspfile] Correct some typos in the documentation 2023-06-29 11:31:24 +09:00
Bill Currie
2a9e700c92 [sw] Separate draw frames from render frames
This is necessary because fisheye rendering draws the scene up to 6
times per frame, which results in many of the limits being hit
prematurely, but updating r_framecount that often breaks dynamic lights.
2023-06-29 01:26:54 +09:00
Bill Currie
585f1161db [renderer] Clean up R_MarkLeaves
Really? More to clean up before (vulkan) bsp rendering is thread-safe?
However, R_MarkLeaves was pretty close: just oldviewleaf and
visframecount, but that's still too much. Also, the reliance on
r_refdef.worldmodel irked me.
2023-06-29 00:49:14 +09:00
Bill Currie
ecb9a15946 [model] Clean up the brush leaf api a little
Those functions now all take mod_brush_t since they don't work with any
other type of model.
2023-06-28 21:45:41 +09:00
Bill Currie
3bdc4adb4c [vulkan] Use per-pass entity queues
While there will be some GPU resources to sort out for multi-pass bsp
processing, I think this is the last piece required before shadow passes
can be implemented.
2023-06-28 17:57:41 +09:00
Bill Currie
85128a3e86 [vulkan] Rework lighting to use splats
It's currently slower, and the cone splats are buggy, but the lighting
code itself got some nice cleanups.
2023-06-28 01:01:56 +09:00
Bill Currie
614ca744ab [vulkan] Support multi-layer OIT rendering
This fixes fisheye rendering. I'm not too happy with always allocating
the cube OIT heads buffer, but that's for another day.
2023-06-26 18:00:46 +09:00
Bill Currie
8f1de6865f [vulkan] Get fisheye working except for translucency
The OIT heads buffer is only a single-layer image, which breaks cube
map rendering, but once this is sorted, it looks like fisheye will work
well.
2023-06-26 14:03:19 +09:00
Bill Currie
25dfa75505 [vulkan] Support disabling pipelines
This is useful for selecting post-processing pipelines at run-time.
2023-06-26 11:54:28 +09:00
Bill Currie
0a50fb1bf1 [cexpr] Add support for the bool type
It's currently rather limited, but enough to make use of it in vkgen and
vkparse.
2023-06-26 10:59:16 +09:00
Bill Currie
17ee6911f9 [vulkan] Clean up the sampler config loading
Samplers have no direct relation to render passes or pipelines, so
should not necessarily be in the same config file. This makes all the
old config files obsolete, and quite a bit of support code in vkparse.c.
2023-06-25 23:41:21 +09:00
Bill Currie
f2d2db9ef3 [vulkan] Integrate screen capture in the new system
This gets screenshots working again. As the implementation is now a
(trivial) state machine, the pause when grabbing a screenshot is
significantly reduced (it can be reduced even further by doing the png
compression in a separate thread).
2023-06-25 23:41:21 +09:00
Bill Currie
eb176c37e2 [vulkan] Get brush models rendering again
The new system seems to work quite nicely with brush models, which was
the intent, but it's nice to see. Hopefully, it works well when it comes
to shadows. There's still water warp and screen shots to fix, and
fisheye to get working, as well.
2023-06-25 00:22:03 +09:00
Bill Currie
65a63e7423 [vulkan] Fix a silly typo
Sprites seem to be rather slow to draw, so "sprint" makes even less
sense.
2023-06-25 00:20:19 +09:00
Bill Currie
b9bb841744 [vulkan] Use the descriptor set manager
This cleans up a lot of ugly code that I always thought was rather dumb.
2023-06-24 21:42:46 +09:00
Bill Currie
8470ae5a28 [vulkan] Create a descriptor set manager
The manager allows recycling of descriptor sets and takes care of
creating pools as needed.
2023-06-24 17:23:34 +09:00
Bill Currie
92368eafb2 [vulkan] Clean out old pipeline and layout refs
It's not perfect as some subsystems still create resources from the old
system (necessarily), but this cleans up a lot of the mess.
2023-06-24 11:53:00 +09:00
Bill Currie
5140346c22 [vulkan] Nuke the old render pass code from orbit
Gotta be sure :)

With the new system mostly up and running (just bsp rendering and
descriptor sets/layout handling to go, and they're independent of the
old render pass system), the old system can finally be cleared out.
2023-06-24 10:42:27 +09:00
Bill Currie
41d69586d2 [vulkan] Get particles mostly working in the new system
The particles die instantly due to curFrame not updating (next commit),
but otherwise work nicely, especially sync is better (many thanks to
Darian for his help with understanding sync scope).
2023-06-24 03:26:22 +09:00
Bill Currie
87356a5211 [vulkan] Hook up sprite rendering in the new system
That one went smoothly for a change.
2023-06-23 20:37:06 +09:00
Bill Currie
e4df35ac48 [vulkan] Move scr_funcs handling into vulkan_draw
This was necessary to get the 2d elements drawn after the fence had been
fired (thus indicating descriptors could be updated) but before actual
rendering of the 2d elements (which is how it was done before the switch
to the new system).
2023-06-23 18:07:40 +09:00
Bill Currie
0ec2aa2bf7 [vulkan] Get iqm rendering working again
It turns out there was a bug in the old iqm push constants spec (I still
need to figure out how to use layouts in the new system so I can
completely delete the old).
2023-06-23 09:38:41 +09:00
Bill Currie
a186df90f3 [vulkan] Connect the main and output render steps
The output system's update_input takes a parameter specifying the render
step from which it is to get the output view of that step and updates
its descriptors as necessary.

With this, the full render job is working for alias models (minus a few
glitches).
2023-06-23 02:30:58 +09:00
Bill Currie
7eb14b0a32 [vulkan] Get the compose subpass working
That seems to be the main render pass working. Next is to get the output
render pass to use the main render pass's output.
2023-06-23 02:30:58 +09:00
Bill Currie
942b503486 [vulkan] Get lighting mostly working
Lights seem to be good in renderdoc, but still need to get the compose
subpass working.
2023-06-23 02:30:58 +09:00
Bill Currie
d2e85f775d [vulkan] Get alias model rendering mostly working
Mostly because no lighting or compositing to the output buffer is done,
but the model is there in renderdoc's image viewer.
2023-06-23 02:30:58 +09:00
Bill Currie
854b612597 [vulkan] Name the managed command buffer pool
Not that it mattered in the end, but it helps with debugging (found the
bug while doing the edits).
2023-06-22 20:06:46 +09:00
Bill Currie
12f1b31701 [vulkan] Use a command buffer pool manager
Many thanks to Peter and Darian for clearing up my misunderstanding of
how vkResetCommandPool works. The manager creates command buffers from
the command pool on an as-needed basis (when the queue of available
buffers is empty), and keeps track of those buffers in a queue. When the
pool is reset, the queues (one each for primary and secondary command
buffers) are reset such that the tracked buffers are available again.
2023-06-22 20:05:36 +09:00
Bill Currie
bba82d3da1 [vulkan] Move frames from vulkan_ctx to renderctx
Part of the command buffer fix, but also a step towards cleaning up
vulkan_ctx.
2023-06-22 16:47:15 +09:00
Bill Currie
6deeed1829 [vulkan] Get the output step working for draw
It leaks command buffers (due to a misunderstanding of
vkResetCommandPool), but it seems 2d draw (sliced quads) is working
nicely.
2023-06-22 11:17:03 +09:00
Bill Currie
3de39f5408 [vulkan] Destroy frame buffers on shutdown
With this, the new render system, though not doing anything useful, at
least passes validation.
2023-06-22 11:17:03 +09:00
Bill Currie
25cfef18d6 [vulkan] Use per-swapchain images for output framebuffers
Imageless framebuffers would probably be easier and cleaner, but this
takes care of the validation error attempting to present the second
frame (because rendering was being done to the first frame's swapchain
image instead of the second frame's).
2023-06-21 14:47:19 +09:00
Bill Currie
503013dd38 [vulkan] Use per-frame command buffer pools
Command buffer pools can't be reset until the commands have all been
executed. Having per-frame pools makes keeping track of pool lifetime
fairly easy.
2023-06-21 13:46:29 +09:00
Bill Currie
7da8399220 [vulkan] Pass validation for the first frame
The new render system now passes validation for the first frame (but
no drawing is done by the various subsystems yet). Something is wrong
with how swap chain semaphores are handled thus the second frame fails.

Frame buffer attachments can now be defined externally, with
"$swapchain" supported for now (in which case, the swap chain defines
the size of the frame buffer).

Also, render pass render areas and pipeline viewport and scissor rects
are updated when necessary.
2023-06-20 15:18:58 +09:00
Bill Currie
2cadf040d3 [vulkan] Add a step and task to create a framebuffer
I don't like the current name (update_framebuffer), but if the
referenced render pass doesn't have a framebuffer, one is created. The
renderpass is referenced via the active renderpass of the named render
step. Unfortunately, this has uncovered a bug in the setup of renderpass
objects: main.deferred has output's renderpass, and main.deferred_cube
and output have bogus renderpass objects.
2023-06-18 18:42:07 +09:00
Bill Currie
8e25fb13d1 [cexpr] Add string and voidptr types
The string type is useful for passing around strings (the only thing
that they can do, currently), particularly as arguments to functions.
The voidptr type is (currently) never generated by the core cexpr
system, but is useful for storing pointers via cexpr (probably a bit of
a hack, but it seems to work well in my current use).
2023-06-18 17:20:38 +09:00
Bill Currie
d8239bf9e2 [qtypes] Support auto in pre-c23 compilers
I'm not yet ready to do a full-on transition to gcc-13 with -std=gnu2x,
but I'm tired of __auto_type's ugliness.
2023-06-18 17:16:58 +09:00
Bill Currie
3235bb70c8 [vulkan] Move attachement specs into frambuffer
This does a better job of keeping related data together.
2023-06-17 12:13:38 +09:00
Bill Currie
14b24e5b75 [vulkan] Clean up job allocation size calculation
It does the same thing, but it's just nicer to read (thanks for the
idea, HomelikeBrick42).
2023-06-16 23:15:31 +09:00
Bill Currie
274e821c06 [vulkan] Pass the current command buffer to tasks
Compute and render tasks need to be able to submit commands.
2023-06-16 22:34:08 +09:00
Bill Currie
b0d1c0e75b [vulkan] Make push constant ranges structured
Being able to specify the types in the push constant ranges makes it a
lot easier to get the specification correct. I never did like having to
do the offsets and sizes by hand as it was quite error prone. Right now,
float, int, uint, vec3, vec4 and mat4 are supported, and adheres to
layout std430.
2023-06-16 19:05:53 +09:00
Bill Currie
3c65f1494b [vulkan] Get some subsystems passing validation
This is with the new render job scheme. I very much doubt it actually
works (can't start testing until everything passes, and it's disabled
for the moment (define in vid_render_vulkan.c)), but it's helping iron
out what more is needed in the render system.
2023-06-15 15:17:39 +09:00
Bill Currie
97f9fd81d6 [vulkan] Switch around renderpass and subpass names
The old structs will go away eventually, and I'm tired of seeing that _
tail.
2023-06-15 13:13:52 +09:00
Bill Currie
8ff60b4603 [simd] Add unsigned vector types
Mostly as a convenience for working with very small arrays of unsigned
ints.
2023-06-15 09:36:50 +09:00
Bill Currie
dbd3d6502a Nuke qboolean from orbit
I never liked it, but with C2x coming out, it's best to handle bools
properly. I haven't gone through all the uses of int as bool (I'll leave
that for fixing when I encounter them), but this gets QF working with
both c2x (really, gnu2x because of raw strings).
2023-06-13 18:06:11 +09:00
Bill Currie
9871b44d68 [build] Fix a warning in attribute const check
The warning flag check worked too well: it enabled the warning and
autoconf's default main wanted the const attribute. The bug has been
floating around for a while, it seems.
2023-06-13 13:08:38 +09:00
Bill Currie
d5156a2320 [set] Add an edge detection iterator
set_while checks the iterator's current element membership and skips to
the first element with different membership. ie, if the current element
is in the set, then set_while returns the next element *not* in the set,
but if the current is not in the set, then set_while returns the next
element that *is* in the set. Rather handy for dealing with clusters of
set elements.
2023-05-26 21:46:34 +09:00
Bill Currie
89e60bd521 [set] Add functions to add and remove ranges
It is often necessary to add or remove whole ranges of elements, but
doing so one at a time can be quite inefficient.
2023-05-26 16:55:07 +09:00
Bill Currie
6d5e8922a5 [qfcc] Add a handle type for engine resources
I never liked the various hacks I had come up with for representing
resource handles in Ruamoko. Structs with an int were awkward to test,
pointers and ints could be modified, etc etc. The new @handle keyword (@
used to keep handle free for use) works just like struct, union and
enum in syntax, but creates an opaque type suitable for a 32-bit handle.
The backing type is a function so v6 progs can use it without (all the
necessary opcodes exist) and no modifications were needed for
type-checking in binary expressions, but only assignment and comparisons
are supported, and (of course) nil. Tested using cbuf_t and QFile: seems
to work as desired.

I had considered 64-bit handles, but really, if more than 4G resource
objects are needed, I'm not sure QF can handle the game. However, that
limit is per resource manager, not total.
2023-05-25 10:41:28 +09:00
Bill Currie
d07bd20552 [gib] Correct the header in gib.h 2023-05-24 21:04:24 +09:00
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
511389a973 [set] Use correct size for set_bits_t on arm64 2023-03-28 17:10:55 +09:00
Bill Currie
d39f1307c5 [set] Make static init sets compatible with normal
When using SET_STATIC_INIT, the set size needs to be the same as what
set_new() would create for the same number of bits, otherwise the set
will possibly get resized incorrectly (which is bad news when the array
was allocated using alloca). While this is really a symptom of
set_bits_t not getting the right size, getting weird segfaults is not a
good way to diagnose the problem, and set_bits_t being the wrong size is
just a minor pessimism.
2023-03-28 17:01:05 +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
ef2793010c [simd] Improve portability for aarch64
No need for compiler flags for 64-bit arm, and the few intrinsics that
are actually needed are in a different header.
2023-03-25 21:21:13 +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
793525a50a [sw] Free alias model cache memory when clearing models
This fixes a Sys_Error when loading the level for the first demo (and
probably many other times). It was mod_numknown getting set to 0 that
triggered the issue, but that seems to be necessary for the other
renderers. I think the whole model loading and caching system needs an
overhaul as this doesn't feel quite right due to removing part of the
advantage of caching the model data.
2023-03-20 17:45:28 +09:00
Bill Currie
654b208641 [plist] Add functions to extend dictionaries and arrays
The idea is to make it easy (and efficient) to merge property list
items.
2023-03-15 19:47:30 +09:00
Bill Currie
7d4c1d79b1 [plist] Use reference counts for items
This makes it much easier to share items between property lists (eg,
targets and the main entity list in cl_light).
2023-03-13 11:26:13 +09:00
Bill Currie
ea77df2daa [plist] Add parsing for bare dictionaries and arrays
Requiring top-level {} or () for (usually) hand-written files is awkward
and even a little error prone, and certainly ugly at times. With this,
loaders that expect a particular format can specify the format a little
more directly.
2023-03-12 14:31:17 +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
f12b3ea134 [vid] Allow render systems to unload late
This cleans up the tangled mess of attempting to unload the gl driver in
X11: for whatever reason, the display gets tied in to the library.
2023-03-06 21:15:15 +09:00
Bill Currie
8efe8e63d3 [ecs] Plug a bunch of memory leaks
The hierarchy leak was particularly troublesome to fix, but now the
hierarchies get updated (and freed) automatically just by removing the
hierarchy reference component from the entity. I suspect there will be
issues with entities that are on multiple hierarchies, but I'll sort
that out later.
2023-03-05 22:03:01 +09:00
Bill Currie
76ac446156 [util] Fix an out-by-one in QF_bsearch_r
And rename _bsearch to QF_bsearch_r since that's far less confusing.
Also, update the test to make it possible for valgrind to detect the
out-by-one. The problem was found when trying to remove components from
an entity when using subpools.
2023-03-05 18:31:30 +09:00
Bill Currie
b84bf16cab [util] Add a function to reverse delete cbuf stacks
I'm not 100% sure this is the best fix for the issue, but the way the
cbuf interpreter stack works (especially in the console code) meant that
the stack was built in the order opposite to how it could be safely
deleted with the existing function. Yeah, more leaks :P
2023-03-05 18:31:30 +09:00
Bill Currie
9605de53d7 [audio] Plug yet more leaks
What a sieve QF became.
2023-03-05 18:31:30 +09:00
Bill Currie
3e30b7b9e2 [image] Allow color conversion caches to be cleaned up
More leaks, but only ruamoko takes advantage of it so far.
2023-03-05 18:31:30 +09:00
Bill Currie
3f9873a754 [console] Plug more memory leaks 2023-03-05 18:31:30 +09:00
Bill Currie
9ad4f57348 [glsl] Fix a pile of memory leaks
For the most part harmless, but fixing the leaks has been uncovering
bugs.
2023-03-05 18:31:30 +09:00
Bill Currie
795021e229 [util] Record allocated blocs for ALLOC
Recording the blocks makes it possible to free them later. As a
convenience, ALLOC_STATE declares the freelist and blocks vars needed by
ALLOC.
2023-03-05 18:31:30 +09:00
Bill Currie
be9e6893e5 [util] Free up hash links
Finally, hash links can be freed when the hash context is no longer
relevant. The context is created automatically when needed, and the
owner can delete the context when its done with the relevant hash
tables.
2023-03-04 02:07:31 +09:00
Bill Currie
b8bd83f5cd [gamecode] Clean up a pile of memory leaks
Usually doesn't matter, but it makes it easier to evaluate valgrind's
output.
2023-03-03 22:07:27 +09:00
Bill Currie
9146860f70 [util] Add size limited find and hash functions
Hash_nFind and Hash_nString work like Hash_Find and Hash_String, but
take a maximum string length (like strncmp etc).
2023-03-03 18:50:47 +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
44f058869f [gamecode] Fix a doxygen warning 2023-02-26 20:53:02 +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
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
a561558748 [console] Switch to using a canvas for the console
While the console background is broken in that alpha doesn't work, it's
now rendered correctly in all renderers.
2023-01-22 03:45:50 +09:00
Bill Currie
89afcfcb6d [ui] Add a lateupdate component to canvas
Like update, the function takes just a view, but is useful for updates
that need to run after the other components are run.
2023-01-22 03:43:58 +09:00
Bill Currie
3c8f02c655 [client] Switch to using canvases for screen and hud
Canvases provide layered rendering as for each canvas all components are
rendered in turn.
2023-01-21 03:43:18 +09:00
Bill Currie
f0fab885d4 [ui] Get canvas into a usable state
Canvas_SortComponentPool now takes the raw canvas component id as it is
specialized to the canvas subpools.

Canvas_SetLen resizes the root view and then updates the hierarchy for
every canvas in the system.

Canvas_InitSys sets up the component system with the systems it needs
(canvas, view, text). This is required to ensure view_href is just past
the canvas components as it is needed for retrieving the actual canvas
component (and thus sub-pool range ids) from arbitrary views in the
canvas.

Entities are fetched with the correct offset from the pool entities.
2023-01-21 03:26:02 +09:00
Bill Currie
1c368724e8 [gib] Fix an struct forward declaration 2023-01-21 02:30:26 +09:00
Bill Currie
32cead5f88 [ui] Add a function to create a new canvas entity
The entity has only a canvas component and (root) view component
attached. The plan is to use it for screen-space canvases.
2023-01-20 15:57:29 +09:00
Bill Currie
873d400766 [scene] Remove scene_resources_t struct
It was made unnecessary by the ECS changes.
2023-01-20 15:53:51 +09:00
Bill Currie
68c7003991 [console] Separate loading and initialization
This will make it easy for client code to set up data needed by the
console before the console initializes. It already separates console
cvar setup and initialization, which has generally been a good thing.
2023-01-20 13:27:17 +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
07d5749a4e [renderer] Make the core of SCR_UpdateScreen dynamic
This is a bit of a hack to allow me to work on vulkan's screen update
"pipeline" without having to mess with the other renderers, since it
turns out they're (currently) fundamentally incompatible.
2023-01-19 11:10:48 +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
31c1420682 [client] Further decouple screen and console
The wording might seem a little odd, but cl_screen is really the full 2D
client HUD while the console is completely independent of the client and
shouldn't know that the client even exists. Ideally, the resize events
would be handled by the canvas system, to which end this is a small
step.
2023-01-16 13:29:20 +09:00
Bill Currie
8833518826 [ecs] Support sorting subpools
Sorting the whole pool when subpools are in use could break the
subpools (very high probability, depending on the sort criteria and
subpool criteria).
2023-01-16 11:32:12 +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
b5912bba9b [ui] Clean up the canvas component
It turns out only the range ids are needed in the canvas component at
this stage, and moving the canvas system base into canvas_system_t makes
sense.
2022-12-21 01:54:10 +09:00
Bill Currie
6decbd18c4 [ui] Add a canvas system
This is the beginning of supporting 2d rendering in 3d space. The idea
is that a canvas can be in 2d orthographic space (not attached to any
entity with a 3d transform), or in 3d perspective space (attached to an
entity with a 3d transform, either as a child of the camera, or of some
object in 3d space).

It will replace the current HUD code when it's working.
2022-12-20 19:45:48 +09:00
Bill Currie
3a2877dd9a [ecs] Adjust subpool range type to return start,end
I found I needed the subrange start as well as the end, but I liked that
the subpools themselves used only the end of the range, so switching to
just a unint32_t for the value and adding a function to return a tuple
made sense. I had kept the struct because I thought I might want to
store additional information (eg, the entity "owning" the subpool), but
found that I didn't need such information as the systems using subpools
that way would have access to the entity by other means.

Interestingly, the change found a bug in subpool creation: I really
don't know why things worked before, but they work better now :)
2022-12-20 17:56:08 +09:00
Bill Currie
d67b8cdf05 [ecs] Add support for subpools
Subpools are for grouping components by some criterion. Any component
that has a rangeid callback will be grouped with other components that
return the same render id. Note that the ordering of components within a
group will be affected by adding a component into a group that comes
before that group (or removing a component).

Component pools can have multiple groups, added and removed dynamically,
but removing a group should (currently) be done only when empty.
2022-12-18 21:11:21 +09:00
Bill Currie
24a85dbadc [ui] Add a component set for passage hierarchy refs
While "set" is a tad strong (there's just the one component for now), I
had missed the changes when adding ECS systems. Fixes the segfault at
the end of demo1 (ie, when any center text is printed).
2022-12-16 18:12:38 +09:00
Bill Currie
61f61baf48 [client] Remove hud_href component
I had missed this when adapting the ecs system for modular systems.
2022-12-15 12:50:27 +09:00
Bill Currie
41d25df0d2 [ui] Attach text views to passage entities
Instead of creating new entities for the text views. This approximately
halves the number of entities required to display flowed text, but also
tests the ability to have an entity in multiple hierarchies (the goal of
the ECS component and system changes).
2022-12-14 22:38:37 +09:00
Bill Currie
fdc0dba58b [ecs] Add a "system" stuct for parameter passing
The system struct bundles the registry and component base together,
making it easier to reuse systems in multiple registries, or really,
easier to separate one set of ECS system components from those of other
systems.
2022-12-14 22:28:45 +09:00
Bill Currie
b230fe18ce [ecs] Split component registration from pool creation
While this does require an extra call after registering components, it
allows for multiple component sets (ie, sub-systems) to be registered
before the component pools are created. The base id for the registered
component set is returned so it can be passed to the subsystem as
needed.
2022-12-13 22:58:44 +09:00
Bill Currie
3c4dccf801 [ecs] Organize headers and code
There's now a main ecs.h file that includes the sub-system headers,
removing the need to explicitly include several header files, but the
sub-systems are a less cluttered.
2022-12-13 15:31:35 +09:00
Bill Currie
1a56376f98 [scene,ui] Be more consistent with component enum names
Actual registry component counts are *_comp_count while hierarchy type
component counts are *_type_count.
2022-12-12 13:37:01 +09:00
Bill Currie
bb677a1a7c [ecs] Move href_comp into hierarchy_t
This means that the component id used for hierarchy references must be
passed to Hierarchy_New and Hierarchy_Copy, but does all an entity to
have more than one hierarchy, which is useful for canvases (hierarchies
of views) in the 3d world (the canvas root would have a 3d hierarchy
reference and a 2d (view) hierarchy reference).
2022-12-12 00:20:20 +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
d98eb8abc6 [ui] Add support for setting text attributes
Font cannot be overridden yet, but script attributes (language, script
type, direction) and features can be set at all three levels in a
passage. Attributes on the root level act as defaults for the paragraph
and word levels, and paragraph attributes act as defaults for the word
level.
2022-12-09 18:46:26 +09:00
Bill Currie
b93ab95c47 [ruamoko] Add some builtins for passages and text
Just some basic implementation so I can test shaping of passage text.
2022-12-09 15:18:47 +09:00
Bill Currie
5fd510ade4 [ui] Add font to renderer when loading
This causes some problems with linking if libQFgui is linked with
libQFrenderer (which is necessary in the long run), but it seems
everything gets away with it for now (which, tbh, I don't like).
2022-12-08 16:57:45 +09:00