Commit graph

5985 commits

Author SHA1 Message Date
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
3d65376f87 [cvar] Delete enum symbol tables on shutdown
More memory leaks. Might need to make some soup.
2023-03-05 18:31:30 +09:00
Bill Currie
d8466b6cca [util] Fix a linked-list error in segtext
Uncovered by the memory leak cleanup: the nodes were all being "linked"
to the first node, those nodes in between the first and last were
getting lost.
2023-03-05 18:31:30 +09:00
Bill Currie
13f8f2b66b [util] Fix a pile of memory leaks
Some were actually legitimate (in that they'd cause problems in a long
running game).
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
9193a92a81 [util] Make Hash_DelContext null-safe 2023-03-05 18:31:30 +09:00
Bill Currie
f9e442d323 [util] Make sys globals all thread-local
This was mainly for the shutdown functions, thus allowing Sys_Shutdown
(and Sys_RegisterShutdown) to be per-thread, but it seemed like a good
idea to make everything per-thread.
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
161ccc282f [ruamoko] Unlink passage nodes when deleting
Fixes a segfault on shutdown after the memory leak changes.
2023-03-04 02:23:37 +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
c28ffbb766 [vkgen] Plug some memory leaks
Not that they really matter, but it makes checking valgrind easier.
2023-03-04 00:41:38 +09:00
Bill Currie
e57427142b [util] Clean up some memory leaks in cmd 2023-03-04 00:38:32 +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
70aa970c32 [gamecode] Make modules responsible for freeing resources
It should have been this way all along, and it seems I thought they were
when I did rua_gui.c as it already freed its resource block, which would
have been a double free (oops). Fixes an invalid write when shutting
down progs in qwaq-cmd (relevant change not committed).
2023-03-03 20:26:00 +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
d0a3040b26 [vulkan] Fix a missed pure attribute
I don't have a compile pre-push hook on my laptop.
2023-03-03 10:31:54 +09:00
Bill Currie
c0048c14b3 [vulkan] Fix a typo in a comment
Double "the"
2023-03-02 18:34:10 +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
926e3b76b0 [gib] Clean up regex.c in anticipation of c23
I tried out -std=c2x (doesn't work due to typeof (gcc bug?)) and
-sdt=gnu2x (still no #embed) and found that only regex.c was a problem
(nice), and now it no longer is a problem.
2023-02-28 12:37:30 +09:00
Bill Currie
3b9e0a786e [vkgen] Support renaming of auto fields 2023-02-27 18:44:21 +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
fdcd972ff9 [vulkan] Use correct index for pl item setup
Due to a typo in the list of extra property list items to add to the
symbol table (corrected), subsequent symbols were pointing to the wrong
memory address.
2023-02-27 15:00:40 +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
918237507e [vulkan] Support parsing pipeline layout info
This is for the new system.
2023-02-27 02:54:51 +09:00
Bill Currie
acf828baa3 [vulkan] Allow null extra items and symbols
Don't want to have to pass empty lists.
2023-02-27 02:53:03 +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
461bb9f434 [vkgen] Make labeled arrays independent of struct order
It turns out labeled arrays don't work if structs aren't declared in the
right order (no idea what that is, though) as the struct might not have
been processed when the labeled array field is initialized. Thus, do a
pro-processing pass to set up any parse data prior to writing the
tables.
2023-02-26 20:43:52 +09:00
Bill Currie
a907f78143 [vulkan] Create a function for symtab creation
Most importantly, this cleans up creation of self-referencing symbol
tables from property lists, but adds in C-defined symbols as well. While
QFV_ParseRenderInfo is currently the only the function that uses it, it
might be helpful in the future, especially as I clean up the other parse
support code.
2023-02-26 13:51:24 +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
f13bc4f4b1 [vkgen] Allow mixed dictionary .type parsing 2023-02-21 00:42:12 +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
ed74a6420b [vulkan] Set a reasonable default for color blend
Vulkan requires color blend state is only for color attachments (ignored
otherwise), but it shouldn't be necessary to actually specify the blend
state and instead have it default to something reasonable.
Unfortunately, colorWriteMask affects the output even if blending is
disabled, so it must be initialized to something reasonable (r|g|b|a)
for when the default is used.
2023-02-18 17:22:06 +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
d89ad6b00f [plist] Fix a typo in the type mismatch message 2023-02-18 16:56:38 +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
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
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
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
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
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
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
99d32d5e54 [client] Add a comment on light attenuation
Saves me having to look in the shader every time.
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
158c45d120 [vulkan] Correct calculation of conback position
The problem with setting con_size to 0.5 and con_speed to 0 is it's
difficult to tell when the console positioning is backwards.
2023-01-22 03:28:32 +09:00
Bill Currie
254fcff8ff [ecs] Find correct correct sub-pool range
Returning -1 for key > value doesn't work too well for bsearch.
2023-01-22 01:04:23 +09:00
Bill Currie
bc041d6291 [vulkan] Zero draw's frame structs
Some of the queues start don't get fully initialized, but rather than go
through everything making sure they do, it's just easier to zero the
whole lot at the beginning.
2023-01-21 16:35:21 +09:00
Bill Currie
d10cfb348e [client] Ensure status char buffers are cleared
Fixes uninitialized values when hud_pl is enabled for overkill in qw (pl
is never updated, so it never gets set).
2023-01-21 16:33:45 +09:00
Bill Currie
3d52caadec [ecs] Avoid shuffling components in empty ranges
When bubbling a component past an empty range, there's no need for any
actual movement other than adjusting the range itself, and doing so
corrupts the sparse/dense array relationship. Fixes a segfault when
hiding the deathmatch overlay (that resulted from the change to using
canvases).
2023-01-21 13:58:43 +09:00
Bill Currie
03e867f0f8 [ui] Remove some extra debug outlines
Forcing hidden views and doing the outlines for the screen canvas were
part of sorting out weirdnesses with canvases and component sub-pools.
2023-01-21 11:20:09 +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
9384442834 [ecs] Remove a debug print 2023-01-21 03:14:27 +09:00
Bill Currie
4949f52b58 [console] Move gib hud control into hud
I don't know why it was ever in console.
2023-01-21 02:57:05 +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
06fdef52e8 Clean up some unneeded console.h includes 2023-01-20 12:59:45 +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
d7b1fceb12 [vulkan] Remove a dead FIXME
The flashing pink around the Q menu cursor was caused by vulkan command
buffer writes and draw queue population being out of phase, which was
fixed by the recent screen update changes (specifically,
42441e87d4).
2023-01-19 21:36:03 +09:00
Bill Currie
cdc5f8a912 [vulkan] Get line rendering working again
Rather important for debugging 2d stuff (draw's lines are 2d-only).
Other than translucent console, this gets the vulkan draw api back to
full operation.
2023-01-19 21:29:39 +09:00
Bill Currie
b91a76cbcc [vulkan] Get Draw_TextBox working again
This needed either more font ids to be supported, or small lump pics (up
to 32 x 32) to be loaded into the atlas. I went with both. The menus
don't use Draw_TextBox, but quakeworld's netgraph does.
2023-01-19 17:56:37 +09:00
Bill Currie
91adb6ad6c [console] Go back to using Draw_ConsoleBackground
Using Draw_FitPic was for testing.
2023-01-19 17:35:30 +09:00
Bill Currie
e332164329 [vulkan] Implement fitted pic rendering
This makes use of slice rendering to achieve the effective scaling, but
the slice data is created only when needed so pics that never use slices
don't waste 16 vertices.
2023-01-19 17:18:51 +09:00
Bill Currie
7785eebe4c [vulkan] Clean up some unnecessary interface functions
Not all the empty stubs have been removed as the core model and skin
code still needs to be cleaned up.
2023-01-19 12:58:02 +09:00
Bill Currie
9349a739db [renderer] Run particle update in renderer update
This has little effect on sw/gl/glsl, but makes it so the particle
system isn't run on the CPU (redundantly) for vulkan.
2023-01-19 12:39:26 +09:00
Bill Currie
42441e87d4 [vulkan] Create a vulkan-specific UpdateScreen
The goal is to get vulkan relying on the "renderpass" abstraction, but
this gets vulkan up and running again, and even fixes the rendering
issues (in the end, getting canvas working wasn't required, but is still
planned).
2023-01-19 11:33:49 +09:00
Bill Currie
93e5c84a20 [gui] Link against freetype and harfbuzz
Ran into the issue while testing the screen update change ("release"
build couldn't run due to broken plugins).
2023-01-19 11:11:05 +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
d2467f1424 [vulkan] Use dynamic descriptors for dynamic verts
When a pic needs dynamic vertices (eg, for sub-pics), a descriptor set
is allocated and updated if one has not been created for the pic. This
is done each frame: the descriptor sets are recycled (there currently is
rarely a need for more than a small handful of dynamic descriptors, so
64 should be plenty for now).

Unfortunately, due to the order of operations issue between draw items
getting queued and submitting commands to vulkan (the cause of the pics
not rendering correctly per 8fff71ed4b),
the validation layers complain (correctly) about the command buffers
being executed with updated descriptor sets. Getting the canvas system
up and running will fix that.
2023-01-17 20:49:22 +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
96c82106f9 [sw] Remove hand loop unrolling from pic and conback
GCC has done a better job for about twenty years. Readability for the
win :).
2023-01-17 11:31:46 +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
2383c12a4a [renderer] Move r_framecount update out of render_scene
This fixes the broken dynamic lighting in fisheye rendering. It does
mean that frustum culling of lit surfaces needed to be removed, but if
not doing frustum culling on lit surfaces was good enough for a P90,
it's probably good enough for an i7-6850K.
2023-01-16 00:38:43 +09:00
Bill Currie
73e5ccd0d5 [vulkan] Set transparent color to black
I had forgotten that the draw pipeline expects pre-multiplied alpha,
thus the pink background for the menu pics.
2023-01-13 18:36:14 +09:00
Bill Currie
0953446c3e [vulkan] Load cachepics as separate images
They are usually larger images (eg, the main menu graphic) and thus make
a mess of the atlas (thus, making them separate means a smaller atlas
can be used). All sorts of things are in a mess (descriptor management,
subpic rendering not supported, wrong alpha value for the transparent
pixel), but this gets the basic loader going.
2023-01-13 11:15:44 +09:00
Bill Currie
2f564ca5a6 [vulkan] Use slices to implement fills
Again, not really the most optimal as 8/9 quads are degenerate, but it
went a long way to testing the slice part of the pipeline.
2023-01-12 17:10:43 +09:00
Bill Currie
65005656cb [vulkan] Implement tile clear
This just takes advantage of the dynamic verts for doing subpics. It's
not really the most optimal code as it has to write both the vertices
(64 bytes per quad) and the instances (24 bytes per quad), but that's
still better than the old 128 bytes per quad (and having a single
pipeline is nice).
2023-01-12 17:06:18 +09:00
Bill Currie
89ecde787a [vulkan] Use dynamic quad vertices for subpics
This gets subpics and the crosshairs working again.
2023-01-11 17:16:49 +09:00
Bill Currie
456003f8cb [vulkan] Create static vertex data for pics
This gets full pic rendering working. Subpics and other dynamic quad
rendering doesn't work yet.
2023-01-11 13:34:27 +09:00
Bill Currie
77fc6355cc [vulkan] Use correct descriptor set for core quads
The problem was that I had mixed up the purpose of the per-frame vertex
buffers and used them for the core quad data when they were meant for
subpic and the like, and forgotten about the static vertex buffer.

This gets at least conchars working (pic in general not tested yet).
2023-01-11 12:47:22 +09:00
Bill Currie
8fff71ed4b [vulkan] Rework quad drawing to use a single pipeline
Any performance gains will be utterly swamped by the deferred renderer,
but it will allow better control of quad render order by any client
code (and should be slightly better for simpler renderers when I get
support for them working).

Right now, plenty is broken (much of the higher level draw functions are
disabled, and pics don't render correctly), but this gets at least the
basics in so I'm not bouncing diffs around as much.
2023-01-11 11:34:32 +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
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
70e93bb7e8 [ruamoko] Advance glyphset when working through the pool
It seems to help if the right font data is used when rendering glyphs.
Fixes use of multiple fonts in different passages.
2023-01-03 20:20:02 +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
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
34930ba195 [ecs] Fix a bit of white space 2022-12-20 10:59:26 +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
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
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
cb45fe7034 [x11] Warp the mouse when it touches a barrier
It seems that the mouse escaping the barriers requires some combination
of hitting two at once, and holding your mouth just right (something
about sliding the mouse up and down one barrier near the other).
However, sending the mouse back to the center of the screen when it
touches a barrier makes such sliding impossible.

This seems to fix #38
2022-12-11 19:14:35 +09:00
Bill Currie
203e490be0 [x11] Fix a couple of missed XFixes related blocks
Disabling XFixes but keeping XInput2 wouldn't compile.
2022-12-11 17:28:31 +09:00
Bill Currie
b553c313fe [x11] Don't double-divide for window center
I obviously need a better way to test legacy code because the fix for
unsigned-int behavior with clang broke mouse warping when using
XGrabPointer instead of XInput2's XIGrabEnter.
2022-12-11 16:46:58 +09:00
Bill Currie
65214fb7f8 [ui] Split flowed line separation
The separation now uses height above (right of) the base line, and depth
below (left of) the base line. This puts the text exactly where I want
it, but there's still the problem of uneven line spacing caused by
descenders and ascenders. However, I suspect that's more up to the
text/font handling code to get the boxes right (maybe set spaces to have
the right dimensions?).
2022-12-10 22:07:54 +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
50d588567b [ui] Fix a pile of errors in text shaping
The main problem was the confusion about the coordinates within a single
glyph, and thus the glyphs position within the view's box. With this,
flowed text works fairly well except for some issues with spacing
between lines (which I think is due to the flow code not having been
tested with offset boxes).
2022-12-10 19:05:39 +09:00
Bill Currie
c316b6b5d1 [ruamoko] Wrap more text and view functions
rua_gui.c is still a horrible mess of hacks, but it does the job for
testing the text code.
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
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
c5af5728fe [ui] Fix some passage text shaping bugs
Passage_Delete needs to check if the hierarchy is valid as no text may
have been added, which results in a null pointer for the hierarchy.

Text shaping needs to set language etc every time it resets the buffer.
2022-12-09 15:20:10 +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
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
8e1bf69d5d [scene] Correct the calculation of world scale
World scale can only be approximate if non-uniform scales and
non-orthogonal rotations are involved, but it is still useful
information sometimes.

However, the calculation is expensive (needs a square root), so remove
world scale as a component and instead calculate it on an as-needed
basis because it is quite expensive to do for every transform when it is
used only by the legacy-GL alias model renderer.
2022-12-05 09:45:13 +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
7a64bb1149 [client] Use realtime for net icon check
viewstate's time is from cl.time which is not what's used to set
last_servermessage (that uses realtime). After careful investigation, I
found that cl.time is not at all suitable and that the original id code
used realtime (I think it was just me being lazy when I merged the
code). Fixes the stuck net icon.
2022-12-01 17:52:40 +09:00
Bill Currie
07fd93a56f [client] Use a separate explosion type for nq
quake changes rocket and grenade models to explosion models, but
quakeworld does not. This resulted in nq drawing two explosion sprites
instead of one. Separating the types allows nq to skip adding a sprite
for the explosion.
2022-12-01 15:59:14 +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
0dab26ce8f [cexpr] Allow untyped result values
If the result object type pointer is null, then the parsed result type
and value pointers are written directly to the result object rather than
testing the parsed result type against the object type and copying the
parsed result value data to the location of the object value. It is then
up to the caller to check the type and copy the value data.
2022-11-26 22:10:29 +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
Bill Currie
f9e45aec4c [vulkan] Be more consistent with parse context naming 2022-11-23 11:34:20 +09:00
Bill Currie
8842db082f [vulkan] Add ScreenSize to shader def
This had somehow gotten lost from the previous commit.
2022-11-22 21:06:12 +09:00
Bill Currie
2cee2f2ab8 [vulkan] Add a module to handle output
When working, this will handle the output to the swap-chain images and
any final post-processing effects (gamma correction, screen scaling,
etc). However, currently the screen is just black because the image
for getting the main render pass output isn't hooked up yet.
2022-11-22 17:47:36 +09:00
Bill Currie
7b15caee04 [vulkan] Adjust shutdown order slightly
It makes more sense to shutdown the render passes before textures.
2022-11-22 13:30:29 +09:00
Bill Currie
a886b9432c [render] Tidy up Makemodule ever so slightly
I really need to find a good way to handle all the non-standard files.
2022-11-22 13:29:11 +09:00
Bill Currie
0a3417d38e [vulkan] Add support for code-only render passes
Still very preliminary, but it allows for CPU-only passes to be added to
the tasks run for each frame.
2022-11-22 13:25:09 +09:00
Bill Currie
b7947b48a5 [vulkan] Move matrices uniform def to a header file
Too many places to keep up to date.
2022-11-21 20:02:18 +09:00
Bill Currie
5df9b506e0 [vulkan] Rename the pipeline file
The pl_prefix helps with organization, and the rest of the name makes it
clear it's for the quake deferred renderer.
2022-11-21 17:41:39 +09:00
Bill Currie
7a50cdd7a8 [vulkan] Correct the render pass order comparison
Since pointers are being sorted, need to use double pointer (I often
make this mistake).
2022-11-21 17:29:26 +09:00
Bill Currie
aac4c6ef7a [vulkan] Get multiple frame buffers working
Now each (high level) render pass can have its own frame buffer. The
current goal is to get the final output render pass to just transfer the
composed output to the swap chain image, potentially with scaling (my
laptop might be able to cope).
2022-11-21 17:25:55 +09:00
Bill Currie
e50be73501 [vulkan] Rename the render pass files
Prefixing them with "rp_" helps a little with organization.
2022-11-21 13:11:50 +09:00
Bill Currie
82d1a6e6cd [vulkan] Do a depth pass for 2d objects
While the HUD and status bar don't cut out a lot of screen (normally),
they might start to make a difference when I get transparency working
properly. The main thing is this is a step towards pulling the 2d
rendering into another render pass so the main deferred pass is
world-only.
2022-11-21 02:29:03 +09:00
Bill Currie
2828a4ce0c [vulkan] Use a swizzle view for coverage-alpha
And thus a single pipeline for either colored glyphs or coverage-alpha
glyphs, making for better batching when I get to that.
2022-11-20 15:46:16 +09:00
Bill Currie
40b319bf42 [vulkan] Support swizzles in resource image views
Using swizzles in an image view allows the same shader to be used with
different image "types" (eg, color vs coverage).

Of course, this needed to abandon QFV_CreateImageView, but that is
likely for the best.
2022-11-20 15:31:23 +09:00
Bill Currie
534d5367de [vulkan] Use linear sampling for glyphs
This requires having padding around the glyphs to avoid texel leak, but
as the atlas is created at runtime, it's possible to get the padding in.
2022-11-20 03:59:01 +09:00
Bill Currie
4cbacc1149 [vulkan] Remove the pic texel offsets
It turns out that nearest filtering doesn't need any offsets to avoid
texel leaks so long as the screen isn't also offset. With this, the 2d
rendering looks good at any scale (minus the inherent blockiness).
2022-11-20 01:26:14 +09:00
Bill Currie
4ff3ca104d [gl] Make conchars use nearest sampling
Linear sampling in a texture atlas (which is what conchars is) requires
the use of border pixels to avoid pixel leakage.
2022-11-20 01:21:45 +09:00
Bill Currie
e0b9e118a0 [renderer] Remove the 1/2 pixel shift of the 2d screen
It seemed like a good idea at the time, but it exacerbates pixel leakage
in atlas textures that have no border pixels (even in nearest sampling
modes).
2022-11-20 01:17:09 +09:00
Bill Currie
7e442a9019 [renderer] Correct crosshair sizes
I'm pretty sure they're meant to be 8x8 and not 16x16. Certainly they're
a tad large at 16x16 when using scaled 2d.
2022-11-20 00:50:59 +09:00
Bill Currie
2a8c12426d [sw] Ensure the view model has a visibility component
The rest of the system won't add one automatically (since entity
creation no longer does), but the alias and iqm rendering code expect
there to be one. Fixes a segfault when starting a scene (demo etc).
2022-11-19 14:06:24 +09:00
Bill Currie
b59505b7c1 [glsl] Remove glpic_t struct
It hasn't been necessary for a long time and is a tad misleading as all
it does is wrap a pointer to subpic_t.
2022-11-19 00:41:52 +09:00
Bill Currie
ae200e4e40 [renderer] Compensate for scale in cross-hair placement
I was wondering where it had gone (south east, actually).
2022-11-18 11:23:32 +09:00
Bill Currie
2a1255de59 [renderer] Make cross hair data easier to see in code
It is rather hard to pick out an image from a mass of 0xff and 0xfe.
2022-11-18 11:11:38 +09:00
Bill Currie
bffe9413b7 [vulkan] Add support for 9-slice rendering
There's no API yet as I need to look into the handling of qpic_t before
I can get any of this into the other renderers (or even vulkan, for that
matter).

However, the current design for slice rendering is based on glyphs (ie,
using instances and vertex pulling), with 3 strips of 3 quads, 16 verts,
and 26 indices (2 reset). Hacky testing seems to work, but real tests
need the API.
2022-11-18 09:44:01 +09:00
Bill Currie
b1d7bad2e3 [renderer] Move call to R_ClearEfrags to SCR_NewScene
Probably more such should be moved, but efrags is on my mind. There's no
need for the call to be spread through all the renderers.
2022-11-17 22:12:41 +09:00
Bill Currie
06f410b0b6 [renderer] Clear the visibility components on scene reset
I don't know why it didn't happen during the demo loop, but going from
the start map to e1m1 caused a segfault due to the efrags for a lava
ball getting double freed (however, I do think it might be because the
ball passed through at least two leafs, while entities in the demos did
not). The double free was because SCR_NewScene (indirectly) freed all
the efrags without removing them from entities, and then the client code
deleting the entities caused the visibility components to get deleted
and thus the efrags freed a second time. Using ECS_RemoveEntities on the
visibility component ensures the entities don't have a visibility
component to remove when they are later deleted.
2022-11-17 22:12:41 +09:00
Bill Currie
ac0079f872 [ecs] Add a function to remove a component from all entities
While simple component pools can be cleared simply by zeroing their
counts, ones that have a delete function need that function to be called
for all the components in the pool otherwise leaks can happen.
2022-11-17 21:49:38 +09:00
Bill Currie
387f17dc0c [scene] Add a color map component
It's currently used only by the vulkan renderer, as it's the only
renderer that can make good use of it for alias models, but now vulkan
show shirt/pants colors (finally).
2022-11-15 15:30:35 +09:00
Bill Currie
a28488d2e1 [vulkan] Move both alias color maps into the one layer
This cuts down on the memory requirements for skins by 25%, and
simplifies the shader a bit more, too. While at it, I made alias skins
nominally compatible with bsp textures: layer 0 is color, 1 is emissive,
and 2 is the color map (emissive was on 3).
2022-11-15 13:09:41 +09:00
Bill Currie
668f7f2cd2 [vulkan] Use palette lookups for top/bottom colors
As the RGB curves for many of the color rows are not linearly related,
my idea of scaling the brightest color in the row just didn't work.
Using a masked palette lookup works much better as it allows any curves.
Also, because the palette is uploaded as a grid and the coordinates are
calculated on the CPU, the system is extendable beyond 8-bit palettes.

This isn't quite complete as the top and bottom colors are still in
separate layers but their indices and masks can fit in just one, but
this requires reworking the texture setup (for another commit).
2022-11-15 11:53:07 +09:00
Bill Currie
4d7f72948d [vulkan] Correct alias g-buffer push-constants
For whatever reason, I had added an extra 4 bytes to the fragment
shader's push-constants. It took me a while to figure out why renderdoc
wouldn't stop complaining about me not writing enough data.
2022-11-15 09:28:34 +09:00
Bill Currie
2e21ca4b9a [vulkan] Upload palette as a 16x16 image
It turns out my approach to alias skin coloring just doesn't work for
the quake data due to the color curves not having a linear relationship,
especially the bottom colors.
2022-11-15 09:26:17 +09:00
Bill Currie
251e47f4d6 [vulkan] Add a function to update texture contents
It works on only one layer and one mip, and assumes the provided texture
data is compatible with the image, but does support sub-image updates
(x, y location as parameters, width and height in the texture data).
2022-11-15 09:18:26 +09:00
Bill Currie
8fa6167a57 [vid] Add a function to set the palette and colormap
Mostly for qwaq as it uses the default VGA palette but I need to do some
testing with the quake palette.
2022-11-14 19:39:55 +09:00
Bill Currie
7c53a68ad7 [scene] Move efrag code from renderer to scene
While culling is very much part of rendering, it's more scene related
than renderer related.

Fixes the transform test failing to link.
2022-11-14 12:43:33 +09:00
Bill Currie
053c2c47db [vulkan] Double alias top/bottom color values
The bright end of the color map is actually twice the palette value, but
I didn't understand this when I came up with the shirt/pants color
scheme for vulkan. However, the skin texture can store only 0..1, so the
mapping to 0..2 needs to be done in the shader. It looks like it works
at least better: the gold key at the end of demo1 doesn't look as bleh,
though I do get some weird colors still on ogres etc.
2022-11-14 11:35:26 +09:00
Bill Currie
9f6c367fce [console] Resurrect console scaling
Currently only for gl/glsl/vulkan. However, rather than futzing with
con_width and con_height (and trying to guess good values), con_scale
(currently an integer) gives consistent pixel scaling regardless of
window size.
2022-11-14 09:49:13 +09:00
Bill Currie
0e64f959e2 [scene] Move visibility management into scene code
Well, sort of: it's still really in the renderer, but now calling
R_AddEfrags automatically updates the visibility structure as necessary,
and deleting an entity cleans up the efrags automatically. I wanted this
over twenty years ago.
2022-11-13 15:08:18 +09:00
Bill Currie
767b39b7bd [client] Implement the scoreboards and spectator
This gets the status bar/hud back into function state.
2022-11-13 04:15:26 +09:00
Bill Currie
47fb887724 [vulkan] Implement Draw_TileClear
The status bar doesn't look right without it when it's supposed to be
there.
2022-11-13 04:15:26 +09:00
Bill Currie
2d3c2da64d [qfcc] Support advanced progs again
The support for the new vector types broke compiling code using
--advanced. Thus it's necessary to ensure vector constants are
float-type and vec3 and vec4 are treated as vector and quaternion, which
meant resurrecting the old vector expression code for v6p progs.
2022-11-12 20:04:19 +09:00
Bill Currie
bbd2cdb8c8 [console] Check for curses before calling updaters
If curses isn't being used, then there are no entities and thus no
components to run. Fixes a segfault when running a server without curses
enabled.
2022-11-12 14:37:42 +09:00
Bill Currie
1a9ec15a41 [client] Include hud overlay in hud_debug 2022-11-12 01:50:31 +09:00
Bill Currie
0d9b475759 [client] Implement finale overlay and death-solo
Deathmatch overlay isn't working properly for end of level or death in
qw.
2022-11-12 01:47:17 +09:00
Bill Currie
749a110b76 [util] Check share path too when filling file lists
This fixes maplist showing only those maps in the user directory.
However, no checking is done for duplicate files due to earlier search
paths overriding later paths.
2022-11-11 22:05:10 +09:00
Bill Currie
5333c78f7a [client] Implement rogue's team (ctf) face
I don't like that teamplay is just a local cvar that doesn't get set by
the server.
2022-11-11 19:41:47 +09:00
Bill Currie
7b167b2f35 [client] Implement rogue inventory bar switching
And fix rogue ammo icons.
2022-11-11 18:27:51 +09:00
Bill Currie
acedc906dd [client] Implement hipnotic and rogue items
This involved disabling sigils for hipnotic and rogue (not used),
adjusting the number of items views, and moving the two keys views for
hipnotic. Rogue is not yet using the correct status bar pics.
2022-11-11 15:18:31 +09:00
Bill Currie
a91ae7aeb9 [client] Implement hipnotic and rogue weapon views
The functionality of the hipnotic and rogue weapon power-ups is now done
by a various mappings instead of separate functions. In theory, this
should make things more flexible, but most importantly, there's a lot
less code duplication.
2022-11-11 13:00:40 +09:00
Bill Currie
017bba8869 [client] Fix some view placement and buffer sizes 2022-11-10 21:27:49 +09:00
Bill Currie
c6b79d49a4 [client] Fix incorrect function component setup
Need to pass the address of the pointer :/
2022-11-10 21:23:04 +09:00
Bill Currie
2fb5b67012 [vulkan] Implement line graph rendering
I should probably just use the line rendering for all renderers and pull
the graph drawing out to the client code.
2022-11-10 21:19:01 +09:00