Commit Graph

13711 Commits

Author SHA1 Message Date
Bill Currie dfb7862419 [qfcc] Use the progs VM to help with constant folding
Due to joys of pointers and the like, it's a bit of a bolt-on for now,
but it works nicely for basic math ops which is what I wanted, and the
code is generated from the expression.
2023-08-21 17:47:55 +09:00
Bill Currie 27ccad40c9 [qfcc] Split out the conversion evaluation code
This takes care of the FIXME regarding breaking it out for more general
use (the time has come to redo constant folding).
2023-08-21 17:47:55 +09:00
Bill Currie b4afaab03c [gamecode] Support wide types in type views
Now the new vector types print properly :)

    0003 scale.F{4,1,4} ([1, 0, 0, 0]), (3), p1
2023-08-21 17:47:55 +09:00
Bill Currie a64895b98f [qfcc] Include C function in diagnostic messages
It's kind of redundant with the line number, but it's helpful for seeing
the context at a glance.
2023-08-21 17:47:55 +09:00
Bill Currie b9fd7a46af [qfcc] Implement auto as per c23
That was surprisingly easy, which makes me worried I missed something.
2023-08-21 17:47:55 +09:00
Bill Currie cb4b073e47 [qfcc] Support some unicode ops and GA ops
Only · (dot product) and × (cross product for vector, commutator product
for geometric algebra) have been tested so far, but that involved
fighting with cpp to get it to not convert the · to \U000000b7, which
was rather annoying.
2023-08-21 17:47:55 +09:00
Bill Currie a0ddc2b2bd [qfcc] Support explicit dot product in v6p code
The dot product in v6p code returns a float rather than a vector.
2023-08-21 17:47:55 +09:00
Bill Currie 74405ee31b [gamecode] Switch dstatement ops to signed
I realized recently that I had made a huge mistake making Ruamoko's
based addressing use unsigned offsets as it makes stack-relative
addressing more awkward when it comes to runtime-determined stack frames
(eg, using alloca). This does put a bit of an extra limit on directly
addressable globals, but that's what the based addressing is meant to
help with anyway.
2023-08-21 17:47:55 +09:00
Bill Currie a238eac75b [vulkan] Ensure the barriers array is initialized
I'm not sure what's up, but arm gcc thinks the array isn't properly
initialized even though x86_64 gcc does. Maybe something with padding.
At least c23 makes it easy to 0-initialize VLAs.
2023-08-17 12:54:28 +09:00
Bill Currie ab5f28f743 [vulkan] Allocate map spaces for dynamic lights
I'm actually surprised anything worked, though I guess it was just the
one entry getting corrupted (and not 32, but I figured allocate slots
for all of the dynamic lights just in case). Or none, really, since
larger scenes (ie, those with multiple lights that fit in the same image
size) would result in not all the maps getting used and thus one spare
for dynamic lights.
2023-08-16 10:54:42 +09:00
Bill Currie 4028590240 [qfbsp] Add an option to extract models to C
Probably not a good idea for large maps, but handy for generating C
structs for small test maps. Does not include vertices or surfaces, just
the bsp tree itself for now.
2023-08-15 17:20:45 +09:00
Bill Currie c46e15af9b [vulkan] Up max lights to 2048 and quantize sizes
This seems excessive, but gmsp3v2 map has 1399 lights. Worse, it has a
lot of different light sizes that go up by small increments (generally
around 10) resulting in 33 shadow map images (1 too many). Quantizing
the sizes to 32 drops this nicely to 20, and reduces memory consumption
slightly too (image buffer overhead, I guess).
2023-08-15 14:44:38 +09:00
Bill Currie efea07f488 [gl,glsl,sw] Skip onlyshadows alias models
While the gl renderer does (or did) have it's attempt at shadows, the
others don't even try, thus the onlyshadows-marked player model doesn't
work so well (looks rather goofy seeing the arms like that).
2023-08-14 14:53:43 +09:00
Bill Currie ff271c7724 [build] Check for -sdd=gnu23
It's not available yet, but apparently clang got it just a few days ago
(for clang-18), so head that off at the pass.
2023-08-14 09:16:23 +09:00
Bill Currie 70b60456a8 [vulkan] Implement direction shadow lighting
Finally, even suns cast shadows :)
2023-08-14 02:41:38 +09:00
Bill Currie 5abe467f7d [gamecode] Specify underlying type for opcode enums
And remove the bitfield from dstatement_t. I have wanted this for over
twenty years :)
2023-08-13 23:51:53 +09:00
Bill Currie 77842bdeb4 [build] Require C23 (gnu2x)
Now that gcc-13 is default on Debian sid, I'm happy to switch to
requiring it for building QF. As a celebration, I removed the bool and
auto hacks.
2023-08-13 23:51:53 +09:00
Bill Currie a3e99435df [vulkan] Clean up lighting shaders a little
Having more than one copy of ShadowMatrices went against my plans, and I
had trouble finding the attachments set (light_attach.h wasn't such a
good idea).
2023-08-13 18:06:28 +09:00
Bill Currie 618740663b [vulkan] Implement CSM rendering
This covers only the rendering of the shadow maps (actual use still
needs to be implemented). Working with orthographic projection matrices
is surprisingly difficult, partly because creating one includes the
translations needed to get the scene into the view (and depth range),
which means care needs to be taken with the view (camera) matrix in
order to avoid double-translating depending on just how the orthographic
matrix is set up (if it's set up to focus on the origin, then the camera
matrix will need translation, otherwise the camera matrix needs to avoid
translation).
2023-08-13 17:36:32 +09:00
Bill Currie e00a871824 [util] Clarify the comment for AngleVectors
I found it rather confusing that the matrices were all backwards, and
the existing comments about being "horizontal" didn't really help all
that much. After spending some time with maxima, I was able to verify
that the comments were indeed correct, just transposed (horizontal),
with the final composition reversed to reflect that transposition.
2023-08-13 17:33:46 +09:00
Bill Currie f3ca2f158b [vulkan] Add a scatter buffer copy function
Updating directional light CSM matrices made me realize I needed to be
able to send the contents of a packet to multiple locations in a buffer
(I may need to extend it to multiple buffers). Seems to work, but I have
only the one directional light with which to test.
2023-08-13 17:30:59 +09:00
Bill Currie 558e11e9b7 [vulkan] Make near and far clip explicit parameters
This improves the projection API in that near clip is a parameter rather
than being taken directly from the cvar, and a far clip (ie, finite far
plane) version is available (necessary for cascaded shadow maps as it's
rather hard to fit a box to an infinite frustum).

Also, the orthographic projection matrix is now reversed as per the
perspective matrix (and the code tidied up a little), and a version that
takes min and max vectors is available.
2023-08-13 17:30:24 +09:00
Bill Currie 2b879af3e1 Fix most of the hacks for clang
gcc didn't like a couple of the changes (rightly so: one was actually
incorrect), and the fix for qfcc I didn't think to suggest while working
with Emily.

The general CFLAGS etc fixes mostly required just getting the order of
operations right: check for attributes after setting the warnings flags,
though those needed some care for gcc as it began warning about main
wanting the const attribute.

Fixing the imui link errors required moving the ui functions and setup
to vulkan_lighting.c, which is really the only place they're used.
2023-08-11 18:29:30 +09:00
Th3T3chn0G1t 3098b5d3f7 Implement clang support
Fixing a load of issues related to autoconf and some small source-level issues to re-add clang support.
autoconf feature detection probably needs some addressing - partially as -Werror is applied late.
2023-08-11 14:25:01 +09:00
Bill Currie f21e1275b9 [nq] Fix a missing void params
Thanks to Emily for finding it.
2023-08-10 22:30:34 +09:00
Bill Currie 079e2c055a [vulkan] Add more light debug info
Lines are drawn for a light's leaf, the leafs visible to it, or those in
its efrags chain. Still no idea why lights are drawing when they
shouldn't. Deek suggest holes in the map, but I think if that was the
case, there'd be something visible. My suspicion is I'm doing something
wrong in with efrags.
2023-08-10 09:38:42 +09:00
Bill Currie 0bcfa961b3 [vulkan] Up the size of the bsp index buffers
With three independent passes, it's possible to use up to 3 times the
indices.
2023-08-10 09:37:07 +09:00
Bill Currie 481c12468e [vulkan] Show surfaces for selected light leaf
This has resulted in some rather interesting information: it seems the
surfaces (and thus, presumably bounding boxes) for leafs have little to
do with the actual leaf node's volume.
2023-08-09 02:01:47 +09:00
Bill Currie 5bc1924a25 [vulkan] Clean up some bsp pass name confusion
I had gotten stage and pass confused at some stage. Also, name the
passes in C (enum).
2023-08-08 19:23:30 +09:00
Bill Currie a5fcc41d08 [vulkan] Rename bsp aux pass to shadow
Much better name.
2023-08-08 18:04:58 +09:00
Bill Currie 1319ed0e94 [scene] Implement simple UI functions for lights
Both dynamic lights and "static" lights display their values, but
currently no interaction.
2023-08-08 17:25:53 +09:00
Bill Currie d9c6db8865 [vulkan] Create a window for selected entities
Now the mouse-picking is starting to get useful. The window for an
entity shows its attached components (and their data if a function is
available).
2023-08-08 17:12:39 +09:00
Bill Currie 102a0d591b [ecs] Add a ui function pointer to components
This allows components to display themselves in the UI. Because the
component meta-data is copied into the registry, the function pointer
can be updated by systems (eg, the renderers) to display system-specific
interpretations of the component.
2023-08-08 17:02:53 +09:00
Bill Currie 44c1ef5968 [vulkan] Correct the size of cone splats
I really don't know what I was thinking when I wrote that code. Maybe I
was trying for a half angle. Now the rendered "cone" matches up with a
hard-clipped cone light (soft edges stick out a bit).
2023-08-08 16:00:24 +09:00
Bill Currie c99a49a958 [vulkan] Save the current scene in the scene context
Now this I really don't know why I didn't do when I first created the
context.
2023-08-08 12:00:03 +09:00
Bill Currie ff5d4d8de1 [vulkan] Move Vulkan_NewScene into vulkan_scene
It probably should have been there all along, and with this
vulkan_main/qf_main goes away.
2023-08-08 11:52:31 +09:00
Bill Currie 9ede227da4 [ui] Edge detect all mouse buttons
And return mouse button info in the io struct.
2023-08-07 22:20:34 +09:00
Bill Currie 1745d3bccc [vulkan] Implement mouse-picking for light entities
Currently, only light entities get drawn to the entid buffer, and the
ids are simply displayed in a window for now (not very useful yet).
2023-08-07 17:47:49 +09:00
Bill Currie 95b660d7fd [ui] Add a function to get current mouse position
And hot/active ids.
2023-08-07 17:42:59 +09:00
Bill Currie 35e2ffb4ab [console] Release the mouse when showing the mouse
This makes mouse grabbing much less painful.
2023-08-06 12:57:22 +09:00
Bill Currie be5ab7b864 [renderer] Add a comment about the start map issue
I spent way too long tracking down the easy teleporter disappearing only
to realize it might be the watervised map. After moving it out of the
way and using id's maps, it works just fine.
2023-08-06 02:32:11 +09:00
Bill Currie 42ce1f1a86 [renderer] Fix a silly double set test
No wonder the final changes didn't make as much difference as I
expected.
2023-08-06 00:21:54 +09:00
Bill Currie bf951c3ba2 [vulkan] Get debug light objects working again
And also get them working for infinite radius lights.
2023-08-06 00:20:25 +09:00
Bill Currie 452459297d [vulkan] Remove hard-coded shadow bias
It didn't really work all that well and isn't necessary with the
front-face culling. One less op per pixel.
2023-08-05 19:59:53 +09:00
Bill Currie 5a6d3ec3c9 [nq] Add a cvar to control player shadows
cl_player_shadows defaults to 1 thus giving a nice (for the resolution)
shadow of the player (and disables the weapon shadow).
2023-08-05 19:58:37 +09:00
Bill Currie 6892dc1422 [scene] Add flags for finer rendering control
This takes care of rockets and lava balls casting shadows when they
shouldn't (rockets more because the shadow doesn't look that nice, lava
balls because they glow and thus shouldn't cast shadows). Same for
flames, though the small torches lost their cool sconce shadows (need to
split up the model into flame and sconce parts and mark each
separately).
2023-08-05 18:09:20 +09:00
Bill Currie 1cc65179b5 [nq] Pass correct time to Light_DecayLights
The old R_DecayLights used r_data->realtime, which came from cl.time,
not realtime like I thought, thus causing dynamic lights to not decay
properly during a timedemo as realtime in the client is just that:
realtime.
2023-08-05 17:19:11 +09:00
Bill Currie f436806006 [scene] Remove full_transform from renderer_t
I've wanted to do this for a long while, but I finally got the
motivation to clean up the two uses in gl and glsl. Removes 64 bytes
from the struct.
2023-08-05 15:56:01 +09:00
Bill Currie f77ad8a676 [vulkan] Use front-face culling for shadow passes
This clears up the shadow acne, but does cause problems with lights
inside models. However, this can be fixed by setting the models to not
cast shadows.
2023-08-05 13:22:29 +09:00
Bill Currie 15d7222ebb [model] Remove Mod_LeafPVS in favor of mix/set
The use of a static set makes Mod_LeafPVS not thread safe and also means
that the set is not usable with the set iterators after going to a
smaller map from a larger map.
2023-08-05 11:51:01 +09:00