Commit graph

10960 commits

Author SHA1 Message Date
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
7d9ef9a47e [model] Mark all cleared models as cleared
This fixes a nine year old bug that I discovered only today thanks to
the vulkan renderer. The problem was that when a model had a clear
callback, it was not getting marked as needing to be reloaded, and thus
the model would be "reused" after being trampled on by another model
loading over it.

Also, plug a potential string buffer overflow (strcpy just will not
die!).
2021-01-20 13:55: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
0622a24380 [util] Support size_t constants
Much like 1u and 1l, 1z is for size_t.
2021-01-20 01:24:32 +09:00
Bill Currie
df82cb88ee [vulkan] Make some little cleanups 2021-01-20 01:23:24 +09:00
Bill Currie
2de1c02f61 [image] Add support for float rgba for vulkan 2021-01-20 01:18:47 +09:00
Bill Currie
82889a2c52 [model] Create and destroy the bsp image views 2021-01-20 00:37:37 +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
ba5e86d927 [model] Move Mod_CalcFullbright to its own file
This allows it to be shared between renderers.
2021-01-19 14:54:39 +09:00
Bill Currie
7a353d5aee [model] Build vulkan model libs
The contents are currently empty (required .c files), but this gets the
build system updated.
2021-01-19 14:12:49 +09:00
Bill Currie
6e0cb7b917 [model] Isolate renderer specific texture data
This cleans up texture_t and possibly even improves locality of
reference when running through texture chains (not profiled, and not
actually the goal).
2021-01-19 13:07:31 +09:00
Bill Currie
40fc9f0000 [model] Make Mod_LoadExternalTextures private
It never really needed to be externally accessible as it has always been
gl-specific and can be called by Mod_ProcessTexture anyway.
2021-01-19 12:56:05 +09:00
Bill Currie
e50430e00c [image] Add parameter to load only the header
I want to be able to calculate texture sizes without actually loading
the images.
2021-01-19 10:15:57 +09:00
Bill Currie
9b53d7d4e2 [model] Remove empty brush model functions
It seems better to check for a null pointer and just not call.
2021-01-19 08:26:53 +09:00
Bill Currie
c7b2843c0e [vulkan] Create shanders for brush models
The fragment shader is a bit of a mini mega-shader, but I do want to try
out specializations.
2021-01-18 17:13:52 +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
aa7ff9d618 [vulkan] Implement console background drawing
That went better than expected after deciding to put the conback in the
scrap.
2021-01-18 02:10:10 +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
debaffcb97 [vulkan] Retain handle_keys item
Ugh, need to come up with valgrind for ruamoko :P
2021-01-17 22:26:48 +09:00
Bill Currie
8078e10ea1 [vulkan] Make frame-buffers independent of swapchain
This is more correct as the environment (X11 etc) might provide more
swapchain images than we want: 3 frames in flight is generally
considered a good balance between saturating the hardware and latency.
2021-01-16 21:24:42 +09:00
Bill Currie
fd8521da76 [vulkan] Make frame-buffer count available to
It turns out I made a bit of a mistake in tying the frame-buffer count
to the number of swapchain images. This is the first step in sorting
that out.
2021-01-16 21:03:36 +09:00
Bill Currie
7282d2adde [vulkan] Make renderpass dependencies more explicit
Doesn't seem to adversely affect anything and is more correct from what
I can tell reading some other documentation.
2021-01-16 20:28:32 +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
fa6ff04c5a [image] Use an enum for tex_t formats 2021-01-16 15:39:16 +09:00
Bill Currie
0150fc0487 [vulkan] Use pipeline barriers for index buffer
And set the usage correctly.
2021-01-16 15:09:39 +09:00
Bill Currie
5186d3ae49 [vulkan] Rework draw to use a context struct
Cleans up global space and makes it usable in multiple contexts. Also,
max quads dropped to 32k as each frame now has its own vertex buffer to
avoid issues with vertex overwrites (which I have seen). However, all
vertex buffers are in the one memory/buffer object (using offsets) and
the index buffer has been moved into a device-local memory object.
2021-01-16 14:42:25 +09:00
Bill Currie
904a91c0b7 [vulkan] Use only one global staging buffer
I think I did two as a bit of a ring buffer, but the new ring buffer
system used inside a staging buffer makes it less necessary. Also, the
staging buffer is now a fair bit bigger (4M is probably not really
enough)
2021-01-16 14:37:16 +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
cef81741eb [vulkan] Implement most of the 2D renderer
The console background is missing, and scaled vs unscaled (currently
always scaled) 2d, but otherwise everything seems to work. Lots of
places to clean up, though.
2021-01-14 00:44:34 +09:00
Bill Currie
c7da999b6a [qfcc] Use local_expr only for local variables
ie, not function-scope static variables.
2021-01-13 18:08:30 +09:00
Bill Currie
1205c935d0 [qfcc] Add failing test for static init
The function local static init is being treated as a non-static init
(ie, initialized each call).
2021-01-13 16:47:49 +09:00
Bill Currie
41b3661869 [vulkan] Use the scrap for draw
Draw now has its own staging buffer to use with its scrap. Also, a few
fixes were needed for the staging buffer and scrap flush routines.

Other than some synchronization issues with draw scrap flushing
(currently worked around with a fence-wait) things seem to be working
nicely.
2021-01-13 15:28:56 +09:00
Bill Currie
eebf3158fa [ruamoko] Check for null when allocating objects
It's difficult for progs to check for errors when the engine crashes out
from underneath them :P
2021-01-13 15:24:50 +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
b6bc8ed553 [renderer] Move core of scrap into shared code
The actual 2d area management code is now shared, with the actual
definition for scrap_t being left to the renderer specific
implementation.
2021-01-13 02:47:07 +09:00
Bill Currie
bfbfd7af61 [glsl] Remove subpic_t's tnum
It's never actually used (the texture can be fetched using
GLSL_ScrapTexture) and gets in the way of sharing the scrap system with
the vulkan renderer.
2021-01-12 18:45:44 +09:00
Bill Currie
db14025935 [gamecode] Put strings and debug back in load funcs
It turns out they're required to be initialized before most of the rest
of the system.
2021-01-12 17:34:57 +09:00
Bill Currie
858ac19327 [renderer] Move r_screen and r_cvar into main bin
r_screen because of SCR_UpdateScreen, and r_cvar because the cvars
really should never have been in a plugin in the first place (and
r_screen needed access).
2021-01-12 16:14:46 +09:00
Bill Currie
93aa038d9e [vulkan] Generate handle get functions
Cleans up (hides) the casting when fetching a handle.
2021-01-12 14:56:02 +09:00
Bill Currie
8a85b5c610 [vulkan] Switch to float/normalized for pics
It gives better results when pics are squished or expanded.
2021-01-12 13:51:41 +09:00
Bill Currie
03f614ccb9 [vulkan] Parse VkBool32 correctly as bool type
This makes it much clearer whether something is just a flag or an index
of some sort.
2021-01-12 13:07:51 +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
bf4613acd5 [vulkan] Remove missed preinitialized stages 2021-01-12 10:43:05 +09:00
Bill Currie
6e636a27d0 [renderer] Continue the job of merging SCR_UpdateScreen
I think this is probably as merged as it will get (though the update
callbacks can probably do with some merging).
2021-01-11 16:57:31 +09:00
Bill Currie
88d48944cb [vulkan] Upload the default character set
Nothing's shown yet, and the code is a tad messy, but it's serving as a
proof of concept for now.
2021-01-11 01:27:40 +09:00