Commit graph

11761 commits

Author SHA1 Message Date
Bill Currie
0e7e88815c [qwaq] Fix up file headers 2021-12-24 06:45:13 +09:00
Bill Currie
97c3cbf719 [qwaq] Rename input.c
It's very specialized toward terminal input (ie, for qwaq-curses).
2021-12-24 06:45:13 +09:00
Bill Currie
7892382639 [qwaq] Remove obsolete file
I don't remember when it was last used, and deleting it saves me the
hassle of sorting out its header :P
2021-12-24 06:45:13 +09:00
Bill Currie
577959ec6b [build] Use AS_HELP_STRING on all the help strings
Cleans up the inconsistently wrapped lines.
2021-12-24 06:45:13 +09:00
Bill Currie
e0863ff067 [net_chan] Clean out unnecessary include
net_chan was still including client.h from qw when it no longer needed
it (I guess I forgot to clean that out when I resolved any last
dependencies).
2021-12-24 06:45:13 +09:00
Bill Currie
d70d72e6e4 [particles] Create a psystem object
This takes care of the global variables to a point (there is still the
global struct shared between the non-vulkan renderers), but it also
takes care of glsl's points-only rendering.
2021-12-24 06:45:13 +09:00
Bill Currie
372c89b479 [particles] Merge physics code
The particle physics is called by the renderer.
2021-12-24 06:45:13 +09:00
Bill Currie
8d2791752e [particles] Merge particle spawning into client
After yesterday's crazy marathon editing all the particles files, and
starting to do another big change to them today, I realized that I
really do need to merge them down. All the actual spawning is now in the
client library (though particle insertion will need to be moved). GLSL
particle rendering is semi-broken in that it now does only points (until
I come up with a way to select between points and quads (probably a
context object, which I need anyway for Vulkan)).
2021-12-24 06:45:13 +09:00
Bill Currie
81a5e076ac [vulkan] Move render pass array init
Having it in Vulkan_Init_Common means the array can be used in more
places than just Vulkan_CreateRenderPass (which probably needs a
rename).
2021-12-24 06:45:13 +09:00
Bill Currie
2be19046b6 [vulkan] Allow render passes to not have a render pass
This may seem a little contradictory, but it's due to the difference
between a high level (engine) render pass and a Vulkan render pass
object (and quite likely a poor choice in names for the high level
object). This is necessary for supporting compute shader dispatches as
they cannot be submitted inside a Vulkan render pass.
2021-12-24 06:45:13 +09:00
Bill Currie
43cdca330b [client] Add bindings for load and quickload in demos 2021-12-24 06:45:13 +09:00
Bill Currie
aacd2575d2 [sw,sw32] Ensure the particle system is initialized
This fixes the missing particles (because mtwist_rand was returning 0).
2021-12-24 06:45:13 +09:00
Bill Currie
ce4bb1d56c [renderer] Move particles over to simd
This has the advantage of getting entity_t out of the particle system,
and much easier to read math. Also, it served as a nice test for my
particle physics shaders (implemented the ideas in C). There's a lot of
code that needs merging down: all but the actual drawing can be merged.

There's some weirdness with color ramps, but I'll look into that later.
2021-12-24 06:45:13 +09:00
Bill Currie
4d1e8b2375 [vulkan] Update the number of drawn quads correctly
They should increment by one for each pic, not 4 (I think some fluff
remaining from copying glsl's draw code).

I noticed the problem when I saw large gaps of 0s in the vertex data in
renderdoc.
2021-12-24 06:45:13 +09:00
Bill Currie
be7216e660 [vulkan] Implement crosshair rendering
That makes quite the difference to playability.
2021-12-24 06:45:13 +09:00
Bill Currie
6b84ae5554 [renderer] Update crosshair color on palette changes
This gets the crosshair working in Vulkan (next commit) and fixes issues
with changing the palette (though I've never seen a different palette
for quate, there's still the change from "all black" to an actual
palette).
2021-12-24 06:45:13 +09:00
Bill Currie
83ec2be2a6 [vid] Add a listener set for palette changes
This was needed to get crosshaircolor working correctly, but is likely
another step towards resizable windows (the listener set types are
generic for any viddef event, not just palette changes).
2021-12-24 06:45:13 +09:00
Bill Currie
5128029368 [nq,qw] Clear render state when leaving active state
This fixes a segfault caused by b0517e89293 that I had missed due to not
actually playing: ie, demo map changes were ok, but not in-game map
changes.
2021-12-24 06:45:13 +09:00
Bill Currie
cd641e2b1c [vulkan] Clean up alias push-constants 2021-12-24 06:45:13 +09:00
Bill Currie
8b1eec08cf [scene] Provide direct access to the world matrix
Holding onto the pointer is not a good idea, and it is read-only as
direct manipulation of the world matrix is not supported. However, this
is useful for passing the matrix to the GPU.
2021-12-24 06:45:13 +09:00
Bill Currie
869cc4050c [vulkan] Flush bsp vertex indices after all drawing 2021-12-24 06:45:13 +09:00
Bill Currie
36e98f013e [vulkan] Clean up bsp push-constants. 2021-12-24 06:45:13 +09:00
Bill Currie
081c46da7a Clean up some white space 2021-12-24 06:45:13 +09:00
Bill Currie
b9bc3fa132 [vulkan] Split out the push constants helper
It proved to work well in the sprite pipeline, and should be useful for
cleaning up the magic numbers in bsp and alias.
2021-12-24 06:45:13 +09:00
Bill Currie
0b99ff104d [vulkan] Clear the color attachments
This means color, emission, and translucent. Fixes the HOM issues on my
VersaPro (but halves the frame-rate... definitely need to bring back the
forward renderer as an option).
2021-12-24 06:45:13 +09:00
Bill Currie
db6c76d583 [vulkan] Abandon bindless rendering
At least for now, it is more trouble than it is worth as it (or my
implementation of it) breaks lavapipe and renderdoc.
2021-12-24 06:45:13 +09:00
Bill Currie
8228146ac0 [vulkan] Use the particle system buffer for indirect draws
I realized I'd need to get the particle counts out to the draw commands
somehow, and this seemed to be the most natural way.
2021-12-24 06:45:13 +09:00
Bill Currie
6aaf5c3722 [vulkan] Start work on particles for Vulkan
This gets the pipelines loaded (and unloaded on shutdown). Probably the
easy part :P. Still need to sort out the command buffers,
synchronization, and particle generation (and probably a bunch else
that's not coming to mind).
2021-12-24 06:45:13 +09:00
Bill Currie
9dcaa98205 [vulkan] Clean up a pile of C&P fluff 2021-12-24 06:45:13 +09:00
Bill Currie
e0af6541e6 [vulkan] And a bunch of buffer barrier transitions
These seem to be the most likely ones for compute shaders (some based on
my ideas for particles).
2021-12-24 06:45:13 +09:00
Bill Currie
7901f87960 [vulkan] Add support for compute shaders
This needed changing Vulkan_CreatePipeline to
Vulkan_CreateGraphicsPipeline for consistency (and parsing the
difference from a plist seemed... not worth thinking about).
2021-12-24 06:45:13 +09:00
Bill Currie
93f806ccfb [vulkan] Make device.h more include-order independent 2021-12-24 06:45:13 +09:00
Bill Currie
0d4ece875d [vulkan] Use indexed initializers for barriers
This will make maintaining the arrays much easier: no worries about
getting things out of sync.
2021-12-24 06:45:13 +09:00
Bill Currie
6a7f78485a [zone] Use memccpy instead of strncpy
Probably the best way to tell gcc I know what I'm doing.
2021-12-24 06:45:13 +09:00
Bill Currie
f7c14a9b39 [sw32] Use the shared R_GetSpriteFrame
One less copy of near-identical code.
2021-12-24 06:45:13 +09:00
Bill Currie
5223752f9e [vulkan] Fix lighting size calculation
It turns out the required memory size is not guaranteed to be aligned.
2021-12-24 06:45:13 +09:00
Bill Currie
c366b1b7bb [vulkan] Implement the sprite render passes
It turned out the bindless approach wouldn't work too well for my design
of the sprite objects, but I don't think that's a big issue at this
stage (and it seems bindless is causing problems for brush/alias
rendering via renderdoc and on my versa pro). However, I have figured
out how to make effective use of descriptor sets (finally :P).

The actual normal still needs checking, but the sprites are currently
unlit so not an issue at this stage.
2021-12-24 06:45:13 +09:00
Bill Currie
dafe591446 [renderer] Start merging sprite frame calculation
This covers gl and sw. sw32 should be trivial (just haven't done it),
but glsl will take a little. Vulkan will use it.
2021-12-24 06:45:13 +09:00
Bill Currie
743a732bd7 [vulkan] Correct the semantics of QFV_NextOffset
I'm not at all sure what I was thinking when I designed it, but I
certainly designed it wrong (to the point of being fairly useless). It
turns out memory requirements are already aligned in size (so just
multiplying is fine), and what I really wanted was to get the next
offset aligned to the given requirements.
2021-12-24 06:45:13 +09:00
Bill Currie
36e0d857a2 [vulkan] Create the non-C side of the sprite pipeline
This adds the shaders and the pipeline specs. I'm not sure that the
deferred rendering side of the render pass is appropriate, but I thought
I'd give it a go, since quake sprites are really cutoff rather than
translucent.
2021-12-24 06:45:13 +09:00
Bill Currie
2db8d11dd0 [vulkan] Clean up some excessive descriptor sets
With the switch to multi-layer textures for brush models, the bsp and
alias texture descriptor sets became identical and thus the definitions
shareable. However, due to complications I don't want to address yet,
they're still separately identified, but I should be able to use the
texture set for most, if not all, pipelines.
2021-12-24 06:45:13 +09:00
Bill Currie
0eb556b8f9 [vulkan] Load sprite model data
The vertices and frame images are loaded into the one memory object,
with the vertices first followed by the images.

The vertices are 2D xy+uv sets meant to be applied to the model
transform frame, and are pre-computed for the sprite size (this part
does support sprites with varying frame image sizes).

The frame images are loaded into one image with each frame on its own
layer. This will cause some problems if any sprites with varying frame
image sizes are found, but the three sprites in quake are all uniform
size.
2021-12-24 06:45:13 +09:00
Bill Currie
c5cfcc7bfd [sprite] Separate model and texture loading
As much as it can be since the texture data is interleaved with the
model data in the files (I guess not that bad a design for 25 years ago
with the tight memory constraints), but this paves the way for
supporting sprites in Vulkan.
2021-12-24 06:45:13 +09:00
Bill Currie
6eed89151c [vulkan] Fix a function doc typo 2021-12-24 06:45:13 +09:00
Bill Currie
ad5415a860 [zone] Make zone.h stand-alone
ie, including just it from QF will compile.
2021-12-24 06:45:13 +09:00
Bill Currie
e7e6dd87e8 [glsl] Fix some const-correct issues for textures 2021-12-24 06:45:13 +09:00
Bill Currie
2b332cfe4a [zone] Clean up some magic numbers 2021-12-24 06:45:13 +09:00
Bill Currie
854c92d10e [simd] Indicate when the circumsphere is degenerate
CircumSphere_vf sets the sphere radius to -1 when the points are
degenerate (co-linear for three points, co-planar for four points).
2021-12-24 06:45:13 +09:00
Bill Currie
eee25d21ba [zone] Clean out unnecessary memsets
As the cache blocks are always filled in with a memcpy, there's no need
to zero out the whole allocation, and the header is initialized anyway.
2021-12-24 06:45:13 +09:00
Bill Currie
ff40563fc0 [zone] Squeeze cache_system_t to fit into 64 bytes
The cache system pointers are now indices into an array of
cache_system_t blocks, allowing them to be 32 bits instead of 64, thus
allowing cache_system_t to fit into a single CPU cache line. This still
gives and effective 38 bits (256GB) of addressing for cache/hunk. This
does mean that the cache functions cannot work with more than 256GB, but
should that become a problem, cache and working hunking hunk can be
separate, and it should be possible to have multiple cache systems.
2021-12-24 06:45:13 +09:00