Commit graph

6367 commits

Author SHA1 Message Date
Bill Currie
06d9b1a056 [vulkan] Use provided config property list
There's still a lot of work needed to separate out quake from
quakeforge, but this lets my test scene get a rather mangled scene
rendering (weird translucency: not sure what I've done wrong: probably
bad clear).
2024-02-01 22:07:40 +09:00
Bill Currie
11d970c7c9 [vulkan] Avoid segaults when reporting errors
Never fun.
2024-02-01 22:04:06 +09:00
Bill Currie
e96050daa5 [vulkan] Allow deletion of some null resources
I very much doubt it's all of them but it was enough to let QF shutdown
cleanly mid-initialization.
2024-02-01 22:03:28 +09:00
Bill Currie
a50eaab1e6 [cmem] Allow delete_memsuper on null memsuper
While not done for freeing cmem blocks, it helps clean up shutdown code
when the memsuper may not have been created.
2024-02-01 22:00:26 +09:00
Bill Currie
999f878b76 [vulkan] Rename alias_sampler to qskin_sampler
It's shared by both alias and iqm models.
2024-02-01 21:58:12 +09:00
Bill Currie
6f04c555a4 [ruamoko] Add support for cbuf handling
I'm not sure how this will turn out, but the idea is ruamoko code will
be able to create its own scripting "language".
2024-02-01 18:58:41 +09:00
Bill Currie
140fe93a9c [vulkan] Add some debug to the cascade shadows
It turns out what I thought was a cascade selection bug was just very
bad choice of cascade steps: factors of 8 just don't work nicely. I'm
not sure that simple factors work all that well, either. I need to make
the cascade system configurable and probably support more cascades.
2024-02-01 18:57:25 +09:00
Bill Currie
926dd308c6 [renderer] Set default fog density to 0 2024-02-01 11:31:28 +09:00
Bill Currie
085f56367d [vulkan] Clear position.w to zero
This puts pixels that have not been rendered at infinity. I was rather
surprised to see fog in my test scene, but it depended on my position
relative to the origin, so something was definitely off (the pixels were
at the origin).
2024-02-01 11:27:08 +09:00
Bill Currie
c1b38196d1 [vulkan] Make CSM ranges consistent
I'm not sure why the final range was only a factor of 4 instead of 8.
There are still issues with range selection, but I'll look into them in
a bit (flying around my little test scene really shows the problems).
2024-02-01 11:24:16 +09:00
Bill Currie
e619b4524e [scene] Add support for a scene camera
Used only by qwaq, but I can fly around my little test scene now :)
2024-02-01 11:20:36 +09:00
Bill Currie
1bcc4dddb6 [ruamoko] Wrap some more input functions
IN_UpdateAxis (for nice handling of axis updates, especially relative
motion for mice) and IN_Binding_HandleEvent because registering an event
handler blocks qwaq's internall call to IN_Binding_HandleEvent.
2024-02-01 11:16:36 +09:00
Bill Currie
2e19e2d913 [ruamoko] Add wrapper for IN_SendConnectedDevices
And wrap input/event.h

event.h is a bit messy because of the data pointer in events, but it
works for now.
2024-02-01 01:40:46 +09:00
Bill Currie
6151bab0d1 [quakefs] Support loading dirconf directly
With this, it is a little easier to make qwaq independent of quake. The
default dirconf is still meant for quake, and fs_dirconf can still be
used to override the configuration.
2024-01-31 00:18:05 +09:00
Bill Currie
1d0b0f85af [vulkan] Return nullptr for missing cachepics
Better than storing such in the hash table only to get a segfault on
shutdown.
2024-01-31 00:14:16 +09:00
Bill Currie
743b06d5c1 [vulkan] Script render graph initialization sequence
While every possible subsystem needs an initialization call, all that
does is add the actual initialization task to the render graph system.
This allows the render graph to be fully configurable, initializing only
those subsystems that the graph needs.

Scripted initialization is still separated from startup as render graph
creation needs various resources (eg, attachments) defined before
creating render and compute passes, but all those need to be created
before the subsystems can actually start up.
2024-01-30 23:13:16 +09:00
Bill Currie
8e3532d543 [vulkan] Add a cvar to select between deferred and forward
Finally. However, it has effect only when no render config is provided.

When a config is provided, things will break currently as nothing is
done yet, but getting a config in will take some work in qwaq and also
the render graph system as I want to make the startup functions
configurable.
2024-01-30 23:13:16 +09:00
Bill Currie
f5e39ba263 [renderer] Allow render config to be specified
The config is a pre-parsed property list. Currently unsupported by
anything but Vulkan (but only a warning is given, not a hard error at
this stage), and Vulkan doesn't use it yet.
2024-01-30 23:13:16 +09:00
Bill Currie
db46dc8a55 [sys] Move terminal color escapes to sys.h
This puts them all in the one place, thus easier to use (and the reason
for the console charset change).
2024-01-30 23:13:16 +09:00
Bill Currie
9552f3c133 [console] Make quake encoding optional
Now, if either ormask is set or the first character of the string to be
printed is 1-3, the quake character set is used, otherwise utf-8 is
assumed. Other changes are for mapping untrusted strings.
2024-01-30 23:13:16 +09:00
Bill Currie
68bc9155ac [sw] Clean up some surface names
A few less warts, and some more consistency with surf and face.
2024-01-28 09:00:01 +09:00
Bill Currie
0a9cc91503 [renderer] Use 16 bits for d_lightstylevalue
Even the comment says it's 8.8, so no need for 32 bits for each value.
It seems to have made a very small improvement to my glsl stub test, but
it's probably just noise (< 0.5%). However, having it "officially" 16
bits means that cached values can be 16 bits thus reducing struct sizes
when I rework lightmap surface data (taking the cache from 16 to 8
bytes).
2024-01-28 09:00:01 +09:00
Bill Currie
c5fc34bb0b [vulkan] Correct dynamic light distance for lightmaps
I had gotten confused about how dynamic lights were calculated and thus
used the wrong radius in the final intensity calculation. Takes care of
the scruffy corners often visible on the dynamic lights.
2024-01-28 09:00:01 +09:00
Bill Currie
0401eeeb07 [console] Give camera and input windows decent defaults
Ie, move them out of the extreme top-left corner.
2024-01-28 09:00:01 +09:00
Bill Currie
36509f5296 [ui] Move draw_order update to before clearing
This fixes broken sub-menu placement and even windows overlapping the
top menu bar.
2024-01-28 09:00:01 +09:00
Bill Currie
013fea965b [vulkan] Actually blend lightmaps
An errant + resulted in an attempt to blend lightmaps resulting in using
only the final lightmap.
2024-01-28 09:00:01 +09:00
Bill Currie
cdca28bb10 [vulkan] Add bsp debug rendering to forward
Knowing where face edges are helps no end for lightmap debugging.
2024-01-28 09:00:01 +09:00
Bill Currie
559c5a51ed [vulkan] Fix a missed lightmap stage for forward
This gets dynamic lights working again (well, minus the bad updates, I
need to figure out what's up there, but they're nothing new). I guess I
checked only for things running, not that dynamic lights worked.
2024-01-28 09:00:01 +09:00
Bill Currie
17b00a3d05 [vulkan] Enable synchronization validation
And clean up the resulting errors. While some were tricky, there weren't
all that many: just some attachment issues and the multi-stage image
copy for scraps.

Fixing scraps required a barrier between copies. It might be overkill,
but a transfer_dst to transfer_dst image barrier worked.

Fixing attachments was a bit trickier:
 - depth needed early and late fragment tests to be treated as one stage
 - all attachments that were read later needed storeOp = none (using the
   extension)
 - and then finalLayout needed to be correct to avoid ghost transitions
 - as well, for some reason the deffered gbuffer subpass needed a depth
   dependency on the translucent pass even though neither one writes to
   the depth attachment (possibly a validation bug, needs more
   investigation).
2024-01-28 09:00:01 +09:00
Bill Currie
2203e2b4fd [gl] Use a struct for glpoly_t's vertices
I always hated the float array for the different attributes.
2024-01-28 09:00:01 +09:00
Bill Currie
bc9e85e429 [vulkan] Return default rendering to deferred
Until I design the system for run-time configuration of the render
graph. While forward is fast, it's... not pretty.
2024-01-23 14:54:59 +09:00
Bill Currie
bf50248e34 [vulkan] Remove the iqm fragment shaders
Really, they should never have existed, because iqm is a mesh format,
not a material spec (it just names materials used for the meshes).
2024-01-23 14:45:50 +09:00
Bill Currie
8f20638cd9 [vulkan] Implement deferred fog
It's not perfect (double fog on translucent surfaces, the
scatter/absorption isn't right, and no local lighting on the fog
itself), but it at least seems to look ok.
2024-01-23 14:32:30 +09:00
Bill Currie
60cb5a922a [vulkan] Add job tasks to be run on new scene
I think has been one of the biggest roadblocks to breaking free of
quake, so having dual render paths and thus the different new scene load
sequence has proven to be unexpected helpful. There's a lot more to be
done to make the render graph actually usable by anyone but me, but just
making scene load configurable frees up a lot. I think there needs to be
renderer startup/shutdown configuration too, but this seems to be enough
for now.
2024-01-21 13:36:17 +09:00
Bill Currie
fea08de4cb [renderer] Switch fog to be simple exponential
I don't know why exp(-dist^2) was thought to be a good idea, it's not at
all correct, and I think exp(-dist) looks better.
2024-01-21 01:27:49 +09:00
Bill Currie
2d56d21a24 [vulkan] Correct the position of the crosshair
It's meant to be drawn at its center, not top-left corner.
2024-01-21 01:21:16 +09:00
Bill Currie
8138b69186 [vulkan] Parameterize a few more forward vs deferred
Just scene and config load to go.
2024-01-20 23:36:12 +09:00
Bill Currie
778ffadd54 [vulkan] Implement fog for the forward renderer
Other than decoupled lightmap support, I think that has the vulkan
forward renderer feature complete (though a little buggy with its
lightmap updates and fisheye gets validation errors).
2024-01-20 19:45:45 +09:00
Bill Currie
f7948701a2 [renderer] Clean up the fog code
I didn't feel like messing with all the renderers, so the old API is
still there, but the internals are much simpler thanks to vec4f_t.
2024-01-20 19:39:35 +09:00
Bill Currie
8bf688748c [vulkan] Implement very basic lighting for forward
Both alias and iqm (yay unified fragment shader). It's meh, but that's
1996 tech for you (hey, it was full-on 3d and we liked it!).
2024-01-20 14:42:21 +09:00
Bill Currie
b22f104163 [renderer] Merge light setup code from glsl and sw
I'll look into gl later, but this means I don't need yet another copy
for vulkan's forward renderer.
2024-01-20 14:35:02 +09:00
Bill Currie
13c6065f9f [vulkan] Get deferred renderer mostly working
It's just lightmap vs lighting (scene load and bsp rendering) and
compose (attachments or no) that need sorting out, and, of course, a way
to select between the two.
2024-01-20 09:44:29 +09:00
Bill Currie
fc5b1d5f6e [iqm] Load skins correctly for qskin
Missing any possibility for fullbrights or colors (only because no
attempt is made to load such), and more deferred breakage, but it acted
as a nice proof of concept for cleaner skin loading (taking advantage of
resources and QFV_PacketCopyImage).
2024-01-20 09:44:29 +09:00
Bill Currie
99445758a3 [vulkan] Allow for no barrier after image copy
QFV_PacketCopyImage is quite handy, but when used before
QFV_GenerateMipMaps, the final image barrier is not wanted as
QFV_GenerateMipMaps expects the image to be transfer_dst, so skip the
barrier if dstBarrier is null.
2024-01-20 09:44:29 +09:00
Bill Currie
93d860472d [vulkan] Use the same fragment shader for alias and iqm
In a quake context, I suspect iqm models should use the same skin
concepts as alias models. I'll probably be proven wrong, but it should
make things nicer for now, especially with forward lighting. However,
Mr Fixit is too bright because the skin isn't set up correctly.

Deferred is getting more and more smashed, but I'll fix that up when
I've got forward "done".
2024-01-20 09:44:29 +09:00
Bill Currie
58b42ed1b7 [vulkan] Implement forward translucent pipelines
This gets skies, liquids and particles working. I think it's only alias
and iqm lighting to go before forward is caught up to deferred.
2024-01-20 09:44:29 +09:00
Bill Currie
1e7cb8ee17 [vulkan] Implement lightmap updates for dlights
GL-Quake all over again, but the world is so much more alive with moving
lights, even if... rather stylized.

Closes #73.
2024-01-20 09:44:29 +09:00
Bill Currie
8c6bfe0984 [vulkan] Partially support dynamic lighting
Dynamic lighting via light styles now works, just actual dlights to go.
2024-01-19 15:45:04 +09:00
Bill Currie
63bec6d67f [scene] Add more entity component helper functions
Cleans up the code and removes more opportunities for UB.
2024-01-19 15:45:04 +09:00
Bill Currie
c512af4f21 [vulkan] Check output framebuffers exist before destroying
The output framebuffers array is dynamic, so trying to index it before
it has been created results in a segfault (which is rather inconvenient
during shutdown).
2024-01-19 15:45:04 +09:00