Commit Graph

1918 Commits

Author SHA1 Message Date
Bill Currie a3c1b2e992 [util] Rename qfplist.[ch]
The name is a hold-over from before the current quakeforge tree and the
QF include directory.
2021-03-21 16:13:03 +09:00
Bill Currie bab3e0720f [vulkan] Implement real-time lighting
Light styles and shadows aren't implemented yet.

The map's entities are used to create the lights, and the PVS used to
determine which lights might be visible (ie, the surfaces they light).
That could do with some more improvements (eg, checking if a leaf is
outside a spotlight's cone), but the concept seems to work.
2021-03-20 16:08:44 +09:00
Bill Currie e0eacf4014 [model] Make set and mix versions of Mod_LeafPVS
The re-entrant version was a good start, but being able to mix while
decompressing saves having to have a temporary buffer somewhere.
2021-03-20 16:06:15 +09:00
Bill Currie e3444b726f [model] Add a re-entrant Mod_LeafPVS
Double benefit, actually: faster when building a fat PVS (don't need to
copy as much) and can be used in multiple threads. Also, default visiblity
can be set, and the buffer size has its own macro.
2021-03-20 12:13:58 +09:00
Bill Currie 0ace799b27 [util] Support commands with a data parameter
Useful for avoiding a pile of wrapper functions that merely pass on
command-specific data to the actual implementation. Used to clean up the
wrappers in nq and qw cl_input.c
2021-03-20 03:56:16 +09:00
Bill Currie 5cf1da7c25 [client] Finish moving onground to viewstate
Missed this in the entity cleanup (really, should have been separate
commits, but oh well).
2021-03-20 00:58:37 +09:00
Bill Currie 5bf21931c7 [renderer] Remove more old fields from entity_t
The only transform related field remaining is old_origin. This also
brings the renderer closer to using simd (lots of stuff to fix still,
though).
2021-03-20 00:08:21 +09:00
Bill Currie 5158cc5527 [util] Add normal and magnitude float vector functions 2021-03-19 11:09:57 +09:00
Bill Currie 2015474468 Move and clean up clview.h
Redundant or dead prototypes deleted, and the client/view.h seems a good
place for the file.
2021-03-12 11:48:53 +09:00
Bill Currie 8466de2325 [client] Use vec4_t in entity_state_t
And clean up the mess (sort of:P)
2021-03-11 16:19:49 +09:00
Bill Currie 36761192a6 [qw] Partially clean up muzzle flash handling
It needs some more work (see FIXME in the code).
2021-03-11 15:23:35 +09:00
Bill Currie ca38f9b616 [qw] Use entity_state_t as a base for player_state_t
This will, in the long run, help clean up a lot of the differences in
the handling of entities in the clients.
2021-03-11 14:27:36 +09:00
Bill Currie abaccbec53 [client] Move qw's loc code into client
This makes the location code available to nq (not used yet) but more
importantly moves some definitely client-side code into the right place.
2021-03-11 11:53:38 +09:00
Bill Currie b8267f2edd [client] Merge nq/qw entity effects code 2021-03-11 11:25:04 +09:00
Bill Currie 51e8694195 [qw] Use a dynamic array to track static entities
This takes care of another fixme in the cleanup of entity_t.
2021-03-11 09:11:08 +09:00
Bill Currie 5949753579 Make m3vmulf return v[3] unchanged 2021-03-10 19:40:19 +09:00
Bill Currie 098ceed5ff [client] Merge nq and qw temp entity handling
This finally gets cl_tent merged away.
2021-03-10 18:04:18 +09:00
Bill Currie fbc1bd9f6e [renderer] Clean up entity_t to a certain extent
This is the first step towards component-based entities.

There's still some transform-related stuff in the struct that needs to
be moved, but it's all entirely client related (rather than renderer)
and will probably go into a "client" component. Also, the current
components are directly included structs rather than references as I
didn't want to deal with the object management at this stage.

As part of the process (because transforms use simd) this also starts
the process of moving QF to using simd for vectors and matrices. There's
now a mess of simd and sisd code mixed together, but it works
surprisingly well together.
2021-03-10 00:01:41 +09:00
Bill Currie 09e1a63470 [util] Add a simd mat4 transpose function 2021-03-09 23:50:32 +09:00
Bill Currie 3230270ae3 [entity] Start work on a new entity library
The plan is to have a fully component based entity system. This adds
hierarchical transforms. Not particularly useful for quake itself at
this stage, but it will allow for much more flexibility later on,
especially when QuakeForge becomes more general-purpose.
2021-03-09 11:39:41 +09:00
Bill Currie 941a1267bc [util] Fix a count error when resizing darrays
Turns out I had never fully tested inserts.
2021-03-09 11:35:18 +09:00
Bill Currie 4a97bc3ba5 [util] Create simd quaternion to matrix function
This seems to be pretty close to as fast as it gets (might be able to do
better with some shuffles of the negation constants instead of loading
separate constants).
2021-03-04 17:45:10 +09:00
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 0da3b35ef5 [util] Add macro for using vectors with scanf 2021-03-03 18:11:59 +09:00
Bill Currie 2cc30f9dfd [headers] Fix a doxygen warning 2021-03-03 18:10:58 +09:00
Bill Currie e3762d8f38 [util] Make plist mostly null-safe
The main purpose is to allow fluent-style:
    const char *targetname = PL_String (PL_ObjectForKey (entity, "targetname"));
    if (targetname && !PL_ObjectForKey (targets, targetname)) {
        PL_D_AddObject (targets, targetname, entity);
    }

[note: the above is iffy due to ownership of entity, but the code from
which the above comes works around the issue]
2021-03-03 18:01:35 +09:00
Bill Currie 60348ab458 [headers] Fix some inconsistent include guards 2021-03-03 16:41:05 +09:00
Bill Currie 45c0255643 [util] Add simd 4x4 matrix functions
Currently just add, subtract, multiply (m m and m v).
2021-03-03 16:34: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 4eb07220cd [util] Make plists more const-correct 2021-02-25 11:55:25 +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 82eabb5ca2 [vulkan] Parse clear values
And get the render pass working in general. Note that this is only the
render pass and frame buffers: actual commands still have problems.
2021-02-23 14:37:48 +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 5535d1f8e6 [util] Keep track of plist dictionary key order
The order in which keys are added to the dictionary object is
maintained. Adding a key after removing an old key adds the new key to
the end of the list rather than reusing the old key's spot.
2021-02-09 17:03:33 +09:00
Bill Currie 0dcd946063 [util] Add plist parser for dictionary -> array
PL_ParseLabeledArray works the same way as PL_ParseArray, but instead
takes a dictionary object. The keys of the items are ignored, and the
order is not preserved (at this stage), but this is a cleaner solution
to getting an array of objects when the definitions of those objects
need to be accessible by name as well.
2021-02-09 15:24:28 +09:00
Bill Currie 14e4fd9f6a [util] Pass context to the plist array/symtab parser allocator 2021-02-09 15:01:55 +09:00
Bill Currie a408fd40da [util] Make plist more const-correct 2021-02-09 14:56:48 +09:00
Bill Currie c8afbdf0f5 [util] Add an object-based fixed array allocator 2021-02-09 14:56:11 +09:00
Bill Currie fdba822809 [util] Fix a code-comment disagreement
And the comment was correct :P
2021-02-09 14:43:45 +09:00
Bill Currie dfa7af03c6 [util] Plug a thread-safety hole in plists 2021-02-09 09:57:07 +09:00
Bill Currie f633a846a1 [vulkan] Make the frames in flight configurable 2021-02-05 11:06:18 +09:00
Bill Currie 1275067655 [vulkan] Rename vulkan_framebuffer_t
It turns out I had conflated frame buffers with frames and wound up
making a minor mess when separating the number of frames the renderer
could have in flight from the number of swap-chain images. This is the
first step towards correcting that mistake.
2021-02-05 10:22:32 +09:00
Bill Currie e929dca300 [util] Auto-cast plist string items
The casting uses a recursive call to the expression parser, so the
expressions are type-checked automatically.
2021-02-04 22:37:20 +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 d2536e584f [util] Add plist support to cexpr
This allows plist objects to be accessed directly from cexpr expressions
using struct.field syntax for dictionary objects and array[index] syntax
for array objects.
2021-02-04 16:58:13 +09:00
Bill Currie 5d1d85f72e [util] Resurrect Hunk_Print and fix some errors
It turned out that Hunk_HighAlloc was not creating a hunk header
(ancient bug by me), and I cleaned up a bunch of name-size issues, along
the way.
2021-02-03 13:21:08 +09:00
Bill Currie 0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +09:00
Bill Currie bc7858bb87 [model] Move parent pointer out of leaf/node struct
The node struct was 72 bytes thus two cache line. Moving the pointer
into the brush model data block allows nodes to fit in a single cache
line (not that they're aligned yet, but that's next). It doesn't seem to
have made any difference to performance (at least in the vulkan
renderer), but it hasn't hurt, either, as the only place that needed the
parent pointer was R_MarkLeaves.
2021-02-03 11:41:38 +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 7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +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 3bbe33844a [util] Add component-wise vector mult-add/sub macros 2021-01-26 00:39:34 +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 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 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 328a529a94 Create RB_ACQUIRE and RB_RELEASE
RB_RELEASE is actually RB_DROP_DATA renamed, but RB_ACQUIRE and
RB_RELEASE work well when working with more structured ring buffer
contents.
2021-01-23 11:56:45 +09:00
Bill Currie e6704b85e1 Make RB_PEEK_DATA return the address of the data
This makes it a little more generally useful.
2021-01-22 18:29:35 +09:00
Bill Currie 07b869d1bf Fix some doxygen warnings 2021-01-22 15:23:04 +09:00
Bill Currie baf25f0891 Document the ring buffer macros 2021-01-22 15:22:04 +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 2de1c02f61 [image] Add support for float rgba for vulkan 2021-01-20 01:18:47 +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 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 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 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 fa6ff04c5a [image] Use an enum for tex_t formats 2021-01-16 15:39:16 +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 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 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 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 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 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 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 01b9c9bf78 [vulkan] Parse descriptor pools 2021-01-10 01:53:15 +09:00
Bill Currie 16334158bd [util] Support struct pointer accesses in cexpr 2021-01-10 01:51:07 +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 d4277ef130 [util] Mark PL_CheckType as const
I keep forgetting to do optimized builds :(
2021-01-07 01:10:25 +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 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 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 518befdaed [util] FIx an "only" in a comment 2021-01-05 17:40:07 +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 9039c6975a [util] Clean up some missed vsqrt changes 2021-01-05 08:35:53 +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 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 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 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 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 4f8a06ddd3 [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-28 18:58:51 +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 25ade4c0f3 [vulkan] Add support for custom parsers
And provisionally parse shader stage defs.
2020-12-24 01:36:17 +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 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