Commit graph

6344 commits

Author SHA1 Message Date
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
Bill Currie
52f012cc11 [console] Flush any pending draw data
This takes care of a 5s hang when the engine aborts before the first
frame is rendered (for vulkan).
2024-01-19 15:45:04 +09:00
Bill Currie
87357f98d3 [vulkan] Correct line vertex input spec (again)
This time for the forward renderer.
2024-01-19 15:45:04 +09:00
Bill Currie
5055860c1b [vulkan] Do lightmap flush after all lightmaps uploaded
This fixes the 5s hang on shutdown.
2024-01-19 15:45:04 +09:00
Bill Currie
4a99ef5723 [vulkan] Add a function to explicitly wait on a packet
It's not currently used, but it was very handy for finding where the
cause of the 5s hang was ***not***.
2024-01-19 15:45:04 +09:00
Bill Currie
bf0d1b4f6e [vulkan] Add tracy zones to most shutdown functions
This helped find the 5s hang on exit.
2024-01-19 15:45:04 +09:00
Bill Currie
3168550935 [vulkan] Upload lightmap data to the gpu and use it
The lightmaps aren't updated at all yet, so everything is static.
Figuring out how lightmap data gets to the gpu was a chore thanks to the
spaghetti in the bsp data, and then I'd forgotten that I was
pre-expanding the light data to rgb so wound up with weird lightmaps,
but without water or particles, demo1 is getting 5000fps at 800x450, and
it seems to be CPU limited.
2024-01-19 15:45:04 +09:00
Bill Currie
329c08b934 [vulkan] Use only a single subpass for forward main
Output is still a second pass for now.
2024-01-19 15:45:04 +09:00
Bill Currie
7ce94cde14 [vulkan] Fix some bitrot in the forward render graph
Many issues, but this fixes the validation errors.
2024-01-19 15:45:04 +09:00
Bill Currie
ec9e2c12b8 [vulkan] Implement skin support
Finally, quakeworld gets its *ahem* fancy skins. I'm not happy with how
skin loading is handled, but the whole model and skin support needs a
redesign.

Closes #74.
2024-01-15 19:07:33 +09:00
Bill Currie
fcd094ef04 [skin] Fix up dynamic library issues
And further clean up skin api.

It turns out that skin functions must all be in the render libs, and
this results in Skin_Set (was Skin_SetSkin) needs to be accessed via a
function pointer rather than directly :(
2024-01-15 15:26:09 +09:00
Bill Currie
d39630580e [skin] Get team colors working for model skins
This should actually get team colors working for all models, not just
player.mdl.
2024-01-15 14:59:11 +09:00
Bill Currie
baa11cd710 [image] Ensure tex fields are all initialized
Designated initializers for the win.
2024-01-15 14:59:11 +09:00
Bill Currie
346ed29f49 [skin] Implement top/bottom colors for gl
They don't work yet if the entity does not have an external skin.
2024-01-15 14:59:06 +09:00
Bill Currie
0539f07c1a [skin] Use an ECS registry to manage skins
This takes care of the double free and also cleans up a lot of the skin
api. However, the gl renderer lost top/bottom colors (for now). Vulkan
skins still don't work yet.
2024-01-15 14:56:37 +09:00
Bill Currie
739adad3d5 [skin] Clean up the API a little
Only the renderer-specific functions are in the plugin functions struct,
and only the client functions are global.
2024-01-13 13:42:03 +09:00
Bill Currie
e978234018 [qw] Fix a bunch of punchangle issues
punchangle wasn't getting decayed for two reasons: I had forgotten to
set the flag in qw, and the decayed value was not getting written to
viewstate.

Also, the rotation was misapplied (I had the two quaternions swapped) so
punchangle was being applied to world Y instead of local Y, thus the
seemingly random rolls.
2024-01-13 02:00:23 +09:00
Bill Currie
962438bddc [sound] Flush sfx hash table on gamedir change
Along with "releasing" all the sfx entries, need to flush the name
lookup so correct names don't get the wrong sounds. Fixes the ricochet
sound for rocket explosions (and shotgun sounds for nail guns) in
quakeworld.
2024-01-13 01:03:23 +09:00
Bill Currie
c01c4180f3 [glsl] Handle verts with no bones
Same issue as in vulkan (surprise surprise, considering the glsl code
came first).
2024-01-09 20:42:18 +09:00
Bill Currie
119e9766b9 [iqm] Use 32-bit indices for large models
That is, those with more than 65520 vertices. Not properly supported for
sw or gl, and glsl isn't rendering properly for some reason (renderdoc
does see the meshes, though, so maybe depth or winding issues).
2024-01-09 13:36:46 +09:00
Bill Currie
834587f102 [ui] Update mouse buttons only for button events
This seems to have fixed the sticky mouse. If nothing else, I've at
least established that the problem is in IMUI (it sees the events) and
not in QF's input system.
2024-01-09 09:58:03 +09:00
Bill Currie
3cd0703249 [ui] Implement scroll bars
There's a bit of nasty hard-coding around passages at the moment, but
the basics are working in a fairly generic way.
2024-01-09 09:12:29 +09:00
Bill Currie
c460d03371 [ui] Propagate passage view size to its container
This gets the container view sized properly such that the scroll box has
something to work with for determining how much the view can slide.
2024-01-08 11:18:21 +09:00
Bill Currie
97a83bf1ed [ui] Move passage paragraph placement into text handling
This allows the passage view to be sized properly during imui's layout
phase.
2024-01-08 10:27:17 +09:00