Commit graph

4298 commits

Author SHA1 Message Date
Bill Currie
748217b438 [vulkan] Start work on alias model rendering 2021-01-26 20:58:24 +09:00
Bill Currie
12ec6c5c29 [util] Add eol to plist parse errors
I suspect it got lost when I made the error message a string item.
2021-01-26 20:45:07 +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
69a8b984a5 [vulkan] Sort out alias model load and unload 2021-01-26 13:59:15 +09:00
Bill Currie
56573d09e4 [vulkan] Get Vulkan_LoadTex working
Finally managed to actually use and thus sort out its issues.
2021-01-26 13:46:04 +09:00
Bill Currie
57968249fe [vulkan] Start work on the alias pipeline 2021-01-26 10:20:50 +09:00
Bill Currie
d8b81e8678 [models] Remove MAXALIASFRAMES
The dynamic array macros made this much easier than last time I looked
at it, especially when it came to figuring out the bad memory accesses
that I seem to remember from my last attempt 9 years ago.
2021-01-25 13:33:42 +09:00
Bill Currie
7a19be7265 [image] Change tex_t data from array to pointer
This makes tex_t more generally useable and probably more portable. The
goal was to be able to use tex_t with data that is in a separate chunk
of memory.
2021-01-25 00:54:41 +09:00
Bill Currie
af5415010a [vulkan] Clamp the conback lines to the texture height
Fixes the bad background (with deadbeef scrap)
2021-01-24 00:54:26 +09:00
Bill Currie
ada4f37b9d [vulkan] Fix the over-bright dynamic lights
I doubt they're anywhere near right, but they're much better. At least
they're not just solid blocks of white.
2021-01-24 00:26:38 +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
145e7478a7 [vid] Create a 32-bit version of the palette
The 32-bit palette includes the alpha channel, with color 255's alpha
set to 0.
2021-01-23 23:56:33 +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
77a8f90113 [vulkan] Fix array parsing size error
The size was not getting written if it was the first value in the
structure.
2021-01-23 20:40:11 +09:00
Bill Currie
4283d690ad [vulkan] Generate correct parse data for size_t
Fixes a segfault when parsing specialization map data.
2021-01-23 20:39:09 +09:00
Bill Currie
8224169394 [util] Make plist parse errors a little more useful
Particularly the "unexpected character" ones.
2021-01-23 18:56:15 +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
c016ad9f55 [vulkan] Ignore light map alpha
Needed to use an rgba format to use floats (and optimal layout), but
having to set the alpha to 1 even for full-dark luxels is not very
efficient. Better to just ignore the alpha in the shader. Fixes the
occasional transparent surface in shadowed areas.
2021-01-22 13:08:33 +09:00
Bill Currie
55badea1ae [vulkan] Reset model transform for world surfaces
Fixes the misplaced walls.
2021-01-22 02:42:58 +09:00
Bill Currie
c75568c1cf [vulkan] Get wall rendering partially working
Many surfaces are missing (I suspect it's due to transform stage
management in the index emitter), and currently only the light maps are
rendered (still not binding the correct textures), but the basics are
working.
2021-01-22 02:20:32 +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
2acdaa0252 [vulkan] Fix a pile of data upload issues
Copying data from the wrong buffer was the cause of the corrupted brush
model vertices, and then lots of little errors (mostly forgetting to
multiply by bpp) for textures.
2021-01-21 21:24:54 +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
eb9807576d [vulkan] Fix the bsp vertex index list creation
There's still a problem with the vertex data itself not getting sent to
the GPU properly, but vulkan is now happy with my tiny test map (which
required disabling skies entirely until I get null textures working).
2021-01-21 14:37:39 +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
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
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
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
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
Bill Currie
23db917ec4 [vulkan] Create a staging buffer struct
And move the barrier prefabs into a more convenient place.
2021-01-11 01:24:15 +09:00
Bill Currie
ba6450d0b4 [vulkan] Make a start on the 2D pipeline
Short wrappers for Draw functins are in vid_render_vulkan.c so the
vulkan context can be passed on to the actual functions. The 2D shaders
are set up similar to those in glsl, but with full 32-bit color (rgba)
support instead of paletted. However, the textures are not loaded yet,
nor is anything bound.
2021-01-10 15:56:17 +09:00
Bill Currie
fed7149508 [vulkan] Parse sampler definitions 2021-01-10 15:50:24 +09:00
Bill Currie
b40b3cff1c [vulkan] Use a size_t temp to parse uint32 values
Needed for swapbuffer frame count
2021-01-10 15:29:47 +09:00
Bill Currie
fd07169a80 [util] Support casts from int/uint to size_t
I don't want to do implicit down casts (size_t to uint) but I needed to
be able to reference swapchain array size.
2021-01-10 15:27:39 +09:00
Bill Currie
ef817a5cbf [vulkan] Allow images to be created initialized
Needed for loaded textures.
2021-01-10 15:26:09 +09:00
Bill Currie
e7106cce9e [plugin] Remove Draw_Init from draw funcs
It's never called outside the renderers.
2021-01-10 15:22:39 +09:00
Bill Currie
a35eec3877 [util] Fail gracefully when no symtab is present 2021-01-10 15:02:24 +09:00
Bill Currie
01b9c9bf78 [vulkan] Parse descriptor pools 2021-01-10 01:53:15 +09:00
Bill Currie
e281b608e1 [vulkan] Provide access to swapchain image count
This necessitated hand-writing qfv_swapchain_t's descriptors as I don't
feel like getting that complicated with vkgen at this stage and it's not
really appropriate anyway? qfv_swapchain_t is meant to be read-only and
not parsed from a plist.
2021-01-10 01:51:15 +09:00
Bill Currie
16334158bd [util] Support struct pointer accesses in cexpr 2021-01-10 01:51:07 +09:00
Bill Currie
0c1699fdbb Fix a pile of double semicolons 2021-01-09 20:42:23 +09:00
Bill Currie
5aa74df922 [renderer] Add a default 8x8 font
It is not compatible with the quake charset (it's the IBM charset). The
data is a simple bitmap but a converter to quake pic format is provided.
2021-01-08 14:37:52 +09:00
Bill Currie
b6d2c63059 [vulkan] Fix some formtatting
Both code and developer output.
2021-01-07 22:49:43 +09:00
Bill Currie
90428db3d5 [glsl] Remove stray return statement
I have no idea why that was in that patch and certainly does not seem to
be correct.
2021-01-07 22:47:58 +09:00
Bill Currie
3b06ca01af [vulkan] Destroy pipeline on shutdown 2021-01-05 23:54:22 +09:00
Bill Currie
5eb1afdcb3 [vulkan] Implement pipeline creation
The prototypes for handle parsers needed to be changes because it turned
out "single" was inappropriate for handles as "single" allocates memory
for the parsed object, but handles must be written directly.
2021-01-05 23:42:30 +09:00
Bill Currie
0da99bc59c [util] Add promotion from float to int to cexpr
I won't go the other way nor will I add double to float.
2021-01-05 23:41:13 +09:00
Bill Currie
b493e6ac32 [util] Expose plist type check support functions 2021-01-05 23:39:52 +09:00
Bill Currie
a45f8f98b6 [util] Make exprctx hashlinks double pointer
The way I wound up using the field meant that exprctx should not "own"
the hashlinks chain, but rather just point to it. This fixes the nasty
access errors I had.
2021-01-05 19:55:17 +09:00
Bill Currie
d8b389d2b6 [vulkan] Initialize sType in parsed structures
This fixes a lot of validation issues, but still some fun with
uninitialized memory and bad accesses.
2021-01-05 18:26:01 +09:00
Bill Currie
37b6d11c01 [ruamoko] Add binding for str_upper
I can't believe I didn't do that when I did str_lower.
2021-01-05 18:24:18 +09:00
Bill Currie
3cf8a336a8 [vulkan] Clear out the resource tables on shutdown
This would take care of undestroyed resources if there wasn't a problem
with invalid memory use. Not sure what's going on just yet.
2021-01-05 17:48:00 +09:00
Bill Currie
dc704a9384 [vulkan] Update the validation layer request
It's now Kronos as LunarG has been deprecated (explains why I got no
help with some of my debugging).
2021-01-05 17:46:03 +09:00
Bill Currie
d22be09ae3 [vulkan] Clean up pipeline def loading 2021-01-05 17:45:02 +09:00
Bill Currie
7c661e7cc5 [vulkan] Remove renderpass from generated code
The creation of a render pass seems to need special handling.
2021-01-05 17:43:26 +09:00
Bill Currie
e5708100bb [vulkan] Generate code for resource nodes
This makes it easy to add resource nodes defining contextually named
resources. It is already used for shaders, set layouts, and pipeline
layouts.
2021-01-05 14:15:35 +09:00
Bill Currie
d8261ade9e [vulkan] Generate code for vulkan handles
The handles can be created in place or in resource blocks and referred
to by name (resource block code gen next).
2021-01-05 08:38:35 +09:00
Bill Currie
ec7d974dc1 [gamecode] Move % handling to the flags state
% is effectively a format flag that cancels the format and outputs a
% single %. Fixes % not getting output for %%.
2021-01-05 00:07:58 +09:00
Bill Currie
1b8b7c04cb [gamecode] Disconnect held strings from return slot
Fixes an internal string error when a return string has been freed.
2021-01-04 23:42:10 +09:00
Bill Currie
7e726545b8 [vulkan] Fix some string retention issues
I really need to come up with a better solution for managing strings in
quakec.
2021-01-04 19:28:27 +09:00
Bill Currie
d919a85c8e [vulkan] Implement pipeline layout creation
It seems to work when parsing the layouts. They can be created in-line
(in theory) or in a "setLayouts" node and then referenced by name.
2021-01-04 17:36:11 +09:00
Bill Currie
e4f75791ce [vulkan] Clean up some tangled dependencies
Dependencies on vkparse.hinc were spreading through the code which I
didn't want as that removes a lot of the automation from the automake
files. This keeps all parser code internal to vkparse.c's scope, and any
accesses required for enum and struct (not yet) definitions can be
fetched by name.
2021-01-04 17:26:39 +09:00
Bill Currie
a6a3d4c6b5 [vulkan] Make array and single parsing smarter
Array and single type overrides now allow the parsing of the items
themselves to be customized. This makes it easy to handle arrays and
pointers to single items while also using custom specifications, rather
than relying entirely on the custom override.
2021-01-04 15:30:27 +09:00
Bill Currie
5b842da394 [util] Fix types for double and float constants 2021-01-04 00:23:48 +09:00
Bill Currie
55445a25f2 [util] Add some tests for the new cexpr work 2021-01-04 00:23:48 +09:00
Bill Currie
619fe15367 [util] Add vector swizzles to cexpr
That turned out to be a lot easier than expected: needed only 4 ifs per
vector "type" (xyzw vs rgba) instead of 340.
2021-01-04 00:23:48 +09:00
Bill Currie
4562e0b876 [util] Implement more of cexpr
This adds unary, vector and function expressions.
2021-01-04 00:23:48 +09:00
Bill Currie
81300f89f8 [util] Allow multiple types for pl fields
I want to be able to use name references, but that requires string
items, so anything that would normally be dictionary or array (or
binary, even) would also need to accept string. This seemed to be the
cleanest solution. Any custom parser would then need to check the type
and act appropriately, but any inappropriate types have already been
pre-filtered by the standard parsers.
2021-01-02 14:02:33 +09:00
Bill Currie
eb52d366c8 [util] Add q-v and v-q multiplication to cexpr 2021-01-02 12:10:58 +09:00
Bill Currie
015cee7b6f [util] Add vector-quaternion shortcut functions
Care needs to be taken to ensure the right function is used with the
right arguments, but with these, the need to use qconj(d|f) for a
one-off inverse rotation is removed.
2021-01-02 10:44:45 +09:00
Bill Currie
7bf90e5f4a [util] Sort out implementation issues for simd 2021-01-02 09:55:59 +09:00
Bill Currie
1fd02322f4 [util] Clean up some minor issues in cmem
I forgot to remove the noinline attribute and do a check with
optimization (to catch the "pure" recommendation).
2021-01-01 22:29:31 +09:00
Bill Currie
efdbd59909 [util] Fix handling of sline's list 'pointer'
I forgot to right-shift the value so offsets were becoming 0 or 8
instead of 0-15. This fixes the management of small objects. It turns
out that after this fix, qfvis's problems were caused by fragmentation
in the windings. Need to revisit line allocation and use POT-specialized
pools.
2020-12-30 18:20:11 +09:00
Bill Currie
9090c53519 [util] Add failing sub-line allocator tests
I think the sub-line allocator falling over is the final source of
qfvis's leaks. It certainly causes a mess of the sub-lines. But having
some tests to get working sure beats scratching my head over qfvis :)
2020-12-30 18:20:11 +09:00
Bill Currie
d12abc5132 [util] Relink grown free line block
This fixes one source of memory leaks, but it seems some are still
lurking as qfvis still leaks like a sieve.
2020-12-30 18:20:11 +09:00
Bill Currie
73544f0790 [util] Split cmem's free cache-line over size bins
They're binned by powers of two (with in between sizes going to the
smaller bin should I make cache-line allocations NPOT (which I think
might be worthwhile). However, there seems to still be a bug somewhere
causing a nasty leak as now my hacked qfvis consumes 40G in less than a
minute.
2020-12-30 18:20:11 +09:00
Bill Currie
4039075f41 [util] Use a linked list of free cache lines
The idea is to not search through blocks for an available allocation.
While the goal was to speed up allocation of cache lines of varying
cluster sizes, it's not enough due to fragmentation.
2020-12-30 18:20:11 +09:00
Bill Currie
3125009a7c [util] Add vector and quaternion types to cexpr
Although there's no distinction between the two at the C level, I think
it's probably best to separate them in a scripting language.
2020-12-30 18:20:11 +09:00
Bill Currie
1ddd57b09e [util] Add qconj, vtrunc, vceil and vfloor functions
I had forgotten these rather critical functions. Both double and float
versions are included.
2020-12-30 18:20:11 +09:00
Bill Currie
03fcb530c7 [util] Make quat test failure prints clearer 2020-12-30 18:20:11 +09:00
Bill Currie
09a10f80e1 [util] Add basic SIMD implemented vector functions
They take advantage of gcc's vector_size attribute and so only cross,
dot, qmul, qvmul and qrot (create rotation quaternion from two vectors)
are needed at this stage as basic (per-component) math is supported
natively by gcc.

The provided functions work on horizontal (array-of-structs) data, ie a
vec4d_t or vec4f_t represents a single vector, or traditional vector
layout. Vertical layout (struct-of-arrays) does not need any special
functions as the regular math can be used to operate on four vectors at
a time.

Functions are provided for loading a vec4 from a vec3 (4th element set
to 0) and storing a vec4 into a vec3 (discarding the 4th element).

With this, QF will require AVX2 support (needed for vec4d_t). Without
support for doubles, SSE is possible, but may not be worthwhile for
horizontal data.

Fused-multiply-add is NOT used because it alters the results between
unoptimized and optimized code, resulting in -mfma really meaning
-mfast-math-anyway. I really do not want to have to debug issues that
occur only in optimized code.
2020-12-30 18:20:11 +09:00
Bill Currie
d824db68a5 [util] Zero plist symtabl object memory 2020-12-25 00:28:26 +09:00
Bill Currie
c0c728b188 [vulkan] Fix a few code generation issues
QC's int type is named "integer" (didn't feel like changing that right
now), so special case it to be "int".

Output the parse func name (instead of "fix me").

Output a parse func for enums (needed for arrays of enums
(VkDynamicState)).
2020-12-25 00:17:20 +09:00
Bill Currie
9db80259d1 [gl,glsl] Copy fog color rather than return pointer
The static variable meant that Fog_GetColor was not thread-safe (though
multiple calls in the one thread look to be ok for now). However, this
change takes it one step closer to being more generally usable.

Patch found in an old stash.
2020-12-24 16:43:28 +09:00
Bill Currie
fefb32bf13 [util] Add a PL dictionary to hash table parser 2020-12-24 16:06:34 +09:00
Bill Currie
cb2bdb0224 [util] Rename PL_ParseDictionary to PL_ParseStruct
Struct is far more appropriate for its function, and I need to parse a
dictionary into a hash table.
2020-12-24 13:33:37 +09:00
Bill Currie
5c0ce2c414 [vulkan] Correct the usage of custom field offsets
I had missed the array declaration and thus initialized the pointer to
the offset array incorrectly. Didn't show up until I tried using
multiple offsets.
2020-12-24 11:50:52 +09:00
Bill Currie
2430f44d7b [vulkan] Support parsing numeric types 2020-12-24 09:58:27 +09:00
Bill Currie
5b0da2b14c [util] Add an int to uint cast for cexpr 2020-12-24 09:57:24 +09:00
Bill Currie
25ade4c0f3 [vulkan] Add support for custom parsers
And provisionally parse shader stage defs.
2020-12-24 01:36:17 +09:00
Bill Currie
017d2c1f44 [vulkan] Refactor vkgen struct generation
The addition of data an then string support made keeping track of things
in struct's writeTable a nightmare.
2020-12-23 22:13:50 +09:00
Bill Currie
e1e2a0e712 [ruamoko] Add a wrapper for PL_Line
Makes error reporting in rua code easier.
2020-12-23 21:52:42 +09:00
Bill Currie
7fb335a215 [vulkan] Add support for building and loading shaders
Shaders can be built as spv files and installed into
$libdir/quakeforge/shaders or as spvc files and compiled into the
engine. Loading supports $builtin/name to access builtin shaders,
$shader/path to access external standard shaders and quake filesystem
access for all other paths.
2020-12-23 14:32:29 +09:00
Bill Currie
f1848bb5b7 [vulkan] Add support for parsing binary data 2020-12-23 14:08:53 +09:00
Bill Currie
5864b553ef [util] Add accessors for binary plist objects 2020-12-23 14:07:30 +09:00
Bill Currie
91c5baa708 [util] Add size_t support to cexpr 2020-12-23 14:06:20 +09:00
Bill Currie
80aec45e35 [vulkan] Ensure msaa settings are consistent
I had forgotten that msaa samples was governed by the driver (as a max)
and the renderpass setup code simply took the max. Thus why 1 vs 8
caused the display to render incorrectly.
2020-12-21 20:17:27 +09:00
Bill Currie
79f22ffebf [util] Propagate cexpr errors back to the caller
Not much point in error detection when it's ignored.
2020-12-21 20:15:43 +09:00
Bill Currie
ac8206555e [vulkan] Get the parsed pipeline working
It turned out the msaa setting defaulting to 1 instead of 8 was the
problem no idea why at this stage (need to read up on just how that
setting works). Once I understand just how it works, I'll rework the
msaa handling.
2020-12-21 19:30:00 +09:00
Bill Currie
96df447c45 [vulkan] Hook up the expression parser
The pipeline parser still isn't hooked up yet as something isn't quite
right, but it seems all the parsing works.
2020-12-21 18:38:31 +09:00