Commit Graph

97 Commits

Author SHA1 Message Date
Bill Currie 4d8ce22c17 [vulkan] Load the map's lights into an array
It's not used yet as work needs to be done to better support generic
entities, but this is the next step to real-time lighting (though, to be
honest, I expect it will be too slow to be usable).
2021-03-03 18:14:16 +09:00
Bill Currie 33575f93d5 [vulkan] Implement deferred lighting for dlights
Static lights are yet to come (so the screen is black most of the time),
but dynamic lights work very nicely (and look very good) despite the
falloff being incorrect.
2021-02-25 15:51:54 +09:00
Bill Currie 918c3af095 [vulkan] Add a position buffer to the g-buffer
While I could reconstruct the position from the screen coords and depth,
this is easier and good enough for now. Reconstruction is an
optimization thing.
2021-02-25 13:46:33 +09:00
Bill Currie 10a1b99a92 [vulkan] Implement lighting and compose passes
Lighting doesn't actually do lights yet, but it's producing pixels.
Translucent seems to be working (2d draw uses it), and compose seems to
be working.
2021-02-24 19:58:31 +09:00
Bill Currie 9229b67633 [vulkan] Clean up the new render pass and framebuffers 2021-02-24 16:27:56 +09:00
Bill Currie cbc8ad271a [vulkan] Convert bsp and draw to deferred
This has bsp and draw passing muster with the validation layers.
2021-02-19 11:14:54 +09:00
Bill Currie a94949c009 [vulkan] Start moving towards a deferred renderer
After getting lights even vaguely working for alias models, I realized
that it just wasn't going to be feasible to do nice lighting with
forward rendering. This gets the bulk of the work done for deferred
rendering, but still need to sort out the shaders before any real
testing can be done.
2021-02-14 11:35:06 +09:00
Bill Currie f633a846a1 [vulkan] Make the frames in flight configurable 2021-02-05 11:06:18 +09:00
Bill Currie 8179c44042 [vulkan] Rework pipeline parsing for better reuse
It's not entirely there yet, but the basics are working. Work is still
needed for avoiding duplication of objects (different threads will have
different contexts and thus different tables, so necessary per-thread
duplication should not become a problem) and general access to arbitrary
fields (mostly just parsing the strings)
2021-02-04 17:03:49 +09:00
Bill Currie d6b678ac78 [vulkan] Implement team colors
It's not quite as expected, but that may be due to one of msaa, the 0-15
range in the palette not being all the way to white, the color gradients
being not quite linear (haven't checked yet) or some combination of the
above. However, it's that what should be yellow is more green. At least
the zombies are no longer white and the ogres don't look like they're
wearing skeleton suits.
2021-02-02 19:53:36 +09:00
Bill Currie 8e63ab9f94 [vulkan] Use 4 layer arrays for alias skins
Doesn't seem to make much difference performance-wise, but speed does
seem to be fill-rate limited due to the 8x msaa. Still, it does mean
fewer bindings to worry about.
2021-02-02 00:11:47 +09:00
Bill Currie 0d4ca46923 [vulkan] Move mip map generation commands to image 2021-02-02 00:04:45 +09:00
Bill Currie ea72d0c60e [model] Clean up the globals for alias models 2021-02-01 21:11:45 +09:00
Bill Currie 34dc7cf2df [models] Move brush data into its own struct
This is a big step towards a cleaner api. The struct reference in
model_t really should be a pointer, but bsp submodel(?) loading messed
that up, though that's just a matter of taking more care in the loading
code. It seems sensible to make that a separate step.
2021-02-01 19:31:11 +09:00
Bill Currie bb6c6963d2 [model] Clean up the globals around model loading
Covers only the generic load code (alias etc to follow), but this should
take care of a lot of issues in the future.
2021-02-01 14:39:00 +09:00
Bill Currie c7eafd9254 [vulkan] Make the mip map generation public
I've decided that alias model skins should be in a single four-level
array texture rather than spread over four textures, but there's no way
I want to write that code again: getting it right was hard enough the
first time :P
2021-02-01 12:16:05 +09:00
Bill Currie eeda04e3c9 [vulkan] Name most resources
This makes debugging with renderdoc and validation messages much easier
(no more "what buffer is that?").
2021-01-31 19:58:55 +09:00
Bill Currie 9f64416846 [vulkan] Create the lights buffer
It's a tad bogus as it's the lights close to the camera, but it should
at least be a good start once things are working. There's currently
something very wrong with the state of things.
2021-01-27 16:16:28 +09:00
Bill Currie 748217b438 [vulkan] Start work on alias model rendering 2021-01-26 20:58:24 +09:00
Bill Currie 826e650c27 [models] Do full alias skin loading
This includes base, glow and two color maps (pants and shorts).
2021-01-26 20:33:51 +09:00
Bill Currie 57968249fe [vulkan] Start work on the alias pipeline 2021-01-26 10:20:50 +09:00
Bill Currie 3132aa91a8 [vulkan] Get sky sheets working
The sky texture is loaded with black's alpha set to 0. While this does
hit both layers, the screen is cleared to black so it shouldn't be a
problem (and will allow having a skybox behind the sheets).
2021-01-23 23:58:34 +09:00
Bill Currie 49408c695d [vulkan] Get sky sheets mostly working
They render (incorrectly because the images weren't translated
correctly), but aren't animated (haven't pushed the time constant)
2021-01-23 22:51:59 +09:00
Bill Currie 93e9f89bd3 [vulkan] Create some default textures
Black, white and magenta. This gets glow (full bright) maps working.
2021-01-23 15:40:31 +09:00
Bill Currie 68b7341429 [vulkan] Set main texture image view
Glow map and sky sheet and cube need to wait until I can get some
default textures going, but the world is rendering correctly otherwise
(though a tad dark: need to do a gamma setting).
2021-01-23 13:51:09 +09:00
Bill Currie c989c8a6b6 [vulkan] Rewrite staging buffer packet handling
It now uses the ring buffer code I wrote for qwaq (and forgot about,
oops) to handle the packets themselves, and the logic for allocating and
freeing space from the buffer is a bit simpler and seems to be more
reliable. The automated test is a bit of a joke now, though, but coming
up with good tests for it... However, nq now cycles through the demos
without obvious issue under the same conditions that caused the light
map update code to segfault.
2021-01-23 12:01:52 +09:00
Bill Currie 7e7b82086c [vulkan] Round up the staging buffer size
Vulkan validation (quite rightly) doesn't like it when the flush range
goes past the end of the buffer, but also doesn't like it when the flush
range isn't cache-line aligned, so align the size of the buffer, too.
2021-01-22 02:18:39 +09:00
Bill Currie f96d7109af [vulkan] Fix a pure warning
Need to do more testing with optimized builds, but...
2021-01-22 02:13:58 +09:00
Bill Currie dc79a8a935 [vulkan] Clear scrap image on creation
And fix the transitions in ScrapFlush.
2021-01-21 21:24:19 +09:00
Bill Currie 94b589567b [vulkan] Rename texture.c to scrap.c
I had originally planned on mixing the stage management with general
texture support code like I did in glsl, but I think that was a mistake
and I did keep looking for scrap.[ch] when I wanted to edit something to
do with the scrap...
2021-01-21 16:44:07 +09:00
Bill Currie 2c1a335715 [vulkan] Use vkCmdPushDescriptorSetKHR for bsp
This makes switching textures on the fly much easier.
2021-01-21 12:39:08 +09:00
Bill Currie 9e03096da6 [vulkan] Build brush model display lists
Not working particularly well yet, but no errors out of validation.
2021-01-21 02:13:40 +09:00
Bill Currie e0e6677bd3 [vulkan] Upload brush model textures
Things aren't quite right with them (sky texture is very wrong), but the
heavy lifting is done.
2021-01-21 00:40:22 +09:00
Bill Currie 1080c89a26 [vulkan] Bind the bsp main pipeline
No drawing commands are issued yet, but vulkan seems to be happy with
the state.
2021-01-20 16:51:35 +09:00
Bill Currie 9ebecf08bb [vulkan] Create a populate the vertex buffer
And create/map the index buffer.
2021-01-20 16:28:04 +09:00
Bill Currie 6f73a7388b [vulkan] Ensure staging buffer is idle before free
I never actually tested what would happen, but I suspect destroying a
staging buffer before it is finished its job would lead to unpleasant
issues.
2021-01-20 16:25:26 +09:00
Bill Currie 9eef805b7d [vulkan] Generate triangle fans for bsp models
They're not uploaded to the card yet, but the basics seem to be working.
2021-01-20 15:11:50 +09:00
Bill Currie d33f5b8d0d [vulkan] Make a lot of progress for brush models
Light maps are maybe updating, but as nothing is actually rendered yet,
it's hard to tell.
2021-01-20 01:28:54 +09:00
Bill Currie df82cb88ee [vulkan] Make some little cleanups 2021-01-20 01:23:24 +09:00
Bill Currie 0f81432090 [model] Load bsp textures into vulkan
The textures for an entire model are loaded into a single memory object
with shared between multiple images.
2021-01-20 00:37:37 +09:00
Bill Currie dacda50130 [renderer] Stub out all the vulkan functions
nq-x11 now gets through all three demos without crashing (but without
rendering anything useful, though).
2021-01-18 12:46:06 +09:00
Bill Currie abd3b90004 [vulkan] Implement basic quake texture loading
It optionally generates mipmaps, and supports the main texture types
(especially for texture packs), including palettes, but is otherwise
rather unsophisticated code. Needs a lot of work, but testing first.
2021-01-18 02:10:56 +09:00
Bill Currie 1e163fd2d7 [vulkan] Correct QFV_CreateImage samples type
Not sure why I though FlagBits was correct instead of Flags.
2021-01-18 02:08:55 +09:00
Bill Currie f3695ec3dd [vulkan] Use the previously existing tex_t formats
I'd forgotten we had these (though direct GL_* was used).
2021-01-16 15:39:36 +09:00
Bill Currie 92afe9f265 [vulkan] Convert stagebuf to a ring buffer
I should have known this would be necessary, but it fixes the corruption
when updating the scrap.
2021-01-15 22:50:04 +09:00
Bill Currie ad9c3193fa [vulkan] Use darray size to control cmd buffer count
This allows the array in which the command buffers are allocated to be
allocated on the stack using alloca and thus remove the need to
malloc/free of relatively small chunks.
2021-01-15 22:45:49 +09:00
Bill Currie a7ac188d1d [vulkan] Use a scrap texture for draw
The scrap texture did very good things for the glsl renderer and the
better control over data copying might help it do even better things for
vulkan, especially with lots of little icons.
2021-01-13 10:43:23 +09:00
Bill Currie bb4ca7683e [vulkan] Get the 2D pipeline up and running
First pixels! This was a nightmare of little issues that the validation
layers couldn't help with: incorrect input assembly, incorrect vertex
attribute specs. Though the layers did help with getting the queues
working. Still, lots of work to go but this is a major breakthrough as
I now have access to visual debugging for textures and the like.
2021-01-12 11:27:41 +09:00
Bill Currie 8f6f32981c [vulkan] Add some matrix buffers
It seems they could all be in the one buffer: there are indications that
uniform binding can be fairly fine-grained. I need to investigate that.
2021-01-12 11:26:20 +09:00
Bill Currie b584d6f403 [vulkan] Abandon image "preinitialized" layout
Turn's out it's not useful for transfers. I might bring it back when I
figure out how to use it.
2021-01-11 01:25:55 +09:00