Commit Graph

12542 Commits

Author SHA1 Message Date
Bill Currie 9f876390f0 [input] Fix up some mistranslated cvars
My script didn't know what type to make the cvars since they're not used
directly by the code, so they got treated as strings instead of ints or
floats.
2022-04-24 19:15:22 +09:00
Bill Currie 12c84046f3 [cvar] Make cvars properly typed
This is an extremely extensive patch as it hits every cvar, and every
usage of the cvars. Cvars no longer store the value they control,
instead, they use a cexpr value object to reference the value and
specify the value's type (currently, a null type is used for strings).
Non-string cvars are passed through cexpr, allowing expressions in the
cvars' settings. Also, cvars have returned to an enhanced version of the
original (id quake) registration scheme.

As a minor benefit, relevant code having direct access to the
cvar-controlled variables is probably a slight optimization as it
removed a pointer dereference, and the variables can be located for data
locality.

The static cvar descriptors are made private as an additional safety
layer, though there's nothing stopping external modification via
Cvar_FindVar (which is needed for adding listeners).

While not used yet (partly due to working out the design), cvars can
have a validation function.

Registering a cvar allows a primary listener (and its data) to be
specified: it will always be called first when the cvar is modified. The
combination of proper listeners and direct access to the controlled
variable greatly simplifies the more complex cvar interactions as much
less null checking is required, and there's no need for one cvar's
callback to call another's.

nq-x11 is known to work at least well enough for the demos. More testing
will come.
2022-04-24 19:15:22 +09:00
Bill Currie 87b3c64801 [vulkan] Parse VkPresentModeKHR
And strip the KHR for short names.
2022-04-24 19:15:22 +09:00
Bill Currie a52704e8ca [cexpr] Allow assignment of double to float
I didn't really want this, but it's needed for cvar support.
2022-04-24 19:15:22 +09:00
Bill Currie aad4546c01 [cexpr] Expose cexpr assignment
This makes it much easier for other systems (in particular, cvar) to
copy values safely.
2022-04-24 19:15:22 +09:00
Bill Currie 021ec4962b [cexpr] Add optional error message prefix string
The prefix gives more context to the error messages, making the system a
lot easier to use (it was especially helpful when getting my cvar revamp
into shape).
2022-04-24 19:15:22 +09:00
Bill Currie d68db74049 [cexpr] Add a flags type
Based on the flags type used in vkparse (difference is the lack of
support for plists). Having this will make supporting named flags in
cvars much easier (though setting up the enum type is a bit of a chore).
2022-04-24 19:15:22 +09:00
Bill Currie 392e032ce2 [cexpr] Add a get_string function to exprtype_t
This allows for easy (and safe) printing of cexpr values where the type
supports it. Types that don't support printing would be due to being too
complex or possibly write-only (eg, password strings, when strings are
supported directly).
2022-04-24 19:13:54 +09:00
Bill Currie db5b77c838 [cexpr] Require designated initializers for exprtype_t
This will make expanding it much safer in the future.
2022-04-24 17:31:17 +09:00
Bill Currie 8a411dc120 [joy] Clean up some redundant cvar flags
No need to or CVAR_NONE with other flags.
2022-04-24 17:23:46 +09:00
Bill Currie 001b3eb908 Fix some inconsistent cvar uses
Surprisingly, only two, but they were caught by the different value
fields being used, thus the cvar was checked in multiple places. I
imagine that's not really all that common, so there may be some
inconsistencies between default value and use.
2022-04-24 17:23:46 +09:00
Bill Currie 55f7886607 Remove some long dead cvars
The declarations were still around, but the creation and code using them
was removed long ago.
2022-04-24 17:23:46 +09:00
Bill Currie d987cef32e [qw] Fix an extern in a C file
Rather worrying finding one. I guess I didn't feel like finding a header
for the declaration at time time.
2022-04-24 17:23:46 +09:00
Bill Currie ef574e67d0 [net] Remove client references from net_main
This is progress towards #23. There are still some references to
host_time and host_client (via nq's server.h), and a lot of references
to sv and svs, but this is definitely a step in the right direction.
2022-04-24 17:21:58 +09:00
Bill Currie b2d4fa0ccf [vulkan] Break render pass parsing away from swapchain
This allows a single render pass description to be used for both
on-screen and off-screen targets. While Vulkan does allow a VkRenderPass
to be used with any compatible frame buffer, and vkparse caches a
VkRenderPass created from the same description, this allows the same
description to be used for a compatible off-screen target without any
dependence on the swapchain. However, there is a problem in the caching
when it comes to targeting outputs with different formats.
2022-04-24 17:04:10 +09:00
Bill Currie bc1fe6aa01 [renderer] Remove some redundant comments
No need for comments when the code says it all.
2022-04-23 10:56:56 +09:00
Bill Currie f15abcea53 [vulkan] Add a FIXME for the flashing Q icon
As I had suspected, it's due to a synchronization problem between the
scrap and drawing. There's actually a double problem in that data
uploaded to the scrap isn't flushed until the first frame is rendered
causing a quick init-shutdown sequence to take at least five seconds due
to the staging buffer waiting (and timing out) on a stuck fence.
Rendering just one frame "fixes" the problem (draw was one of the
earliest subsystems to get going in vulkan).
2022-04-23 10:46:55 +09:00
Bill Currie b649638400 [joy] Clean up some redundant cvar flags
No need to or CVAR_NONE with other flags.
2022-04-13 14:17:58 +09:00
Bill Currie 32a395a8d5 [dox] Fix up some doxygen issues
I found a few doxygen related patches in my git stash and while testing
them, found a few doc issues.
2022-04-13 14:17:58 +09:00
Bill Currie 063c0797d6 Fix some inconsistent cvar uses
Surprisingly, only two, but they were caught by the different value
fields being used, thus the cvar was checked in multiple places. I
imagine that's not really all that common, so there may be some
inconsistencies between default value and use.
2022-04-13 14:17:58 +09:00
Bill Currie e97b96b536 Remove some long dead cvars
The declarations were still around, but the creation and code using them
was removed long ago.
2022-04-13 14:17:58 +09:00
Bill Currie 4d443d3114 [vid] Fix non-utf8 circle-c in fbset
Python didn't like reading the files.
2022-04-13 10:35:40 +09:00
Bill Currie dcd13e4230 [qw] Fix an extern in a C file
Rather worrying finding one. I guess I didn't feel like finding a header
for the declaration at time time.
2022-04-08 20:07:45 +09:00
Bill Currie bffd0605b7 [nq] Show sub-millisecond times for serverprofile
Integer milliseconds are a little too coarse when the range is 1-3ms.
2022-04-08 18:29:04 +09:00
Bill Currie 8d725a1d0a [nq] Clean up Host_Frame_ a little
This simplifies the logic around dedicated servers and clients
connecting to remote servers.
2022-04-08 18:27:53 +09:00
Bill Currie 6b81a4b882 [renderer] Don't try to animate lightstyles that aren't there
Prevents a segfault when running the renderer via qwaq-x11.
2022-04-07 22:30:19 +09:00
Bill Currie f6541dbe3f [net] Remove client references from net_main
This is progress towards #23. There are still some references to
host_time and host_client (via nq's server.h), and a lot of references
to sv and svs, but this is definitely a step in the right direction.
2022-04-06 19:32:55 +09:00
Bill Currie 8f56f28ad7 [net] Use designated initializers for drivers
Not that I expect anything to change any time soon, but nice to have
the initializers explicitly named.
2022-04-06 18:46:28 +09:00
Bill Currie 3f575ab025 [win] Update for moved vulkan viewport
I forgot to do a windows test build.
2022-04-06 18:36:07 +09:00
Bill Currie 2798b5fd58 [vulkan] Use cached memory for the bsp index buffer
Since it is updated every frame, it needs to be as fast as possible for
the cpu code. This seems to make a difference of about 10us (~130 ->
~120) when testing in marcher. Not a huge change, but the timing
calculation was wrapped around the entire base world pass, so there was
a fair bit of overhead from bsp traversal etc.
2022-04-06 14:40:40 +09:00
Bill Currie b011f91018 [model] Clean up alias skin loading a little
The improved allocation overheads have been implemented for gl and sw,
and glsl no longer uses malloc. Using array textures will have to wait
as the current texture loading code doesn't support them.
2022-04-04 17:47:21 +09:00
Bill Currie e40f3f4f93 [model] Make alias skin loading a batch operation
Really, this won't make all that much difference because alias models
with more than one skin are quite rare, and those with animated skin
groups are even rarer. However, for those models that do have more than
one skin, it will allow for reduced allocation overheads, and when
supported (glsl, vulkan, maybe gl), loading all the skins into an array
texture (since all skins are the same size, though external skins may
vary), but that's not implemented yet, this just wraps the old one skin
at a time code.
2022-04-04 15:38:27 +09:00
Bill Currie f66df59c43 [vulkan] Use a template for the attachment desciptions 2022-04-03 13:15:30 +09:00
Bill Currie c8e299ca58 [vulkan] Use a template for the deferred attachment images
It's certainly much easier to read and see what's different between the
attachment.
2022-04-03 12:25:04 +09:00
Bill Currie d3d081ea0a [vulkan] Switch deferred opaque attachment to f16 rgb
While looking at the deferred attachment images with using a template in
mind, I noticed that the opaque attachment was using 8-bit color. The
problem is, it's meant to be HDRI with the compose pass crunching it
down to LDRI. Switching to 16-bit float does seem to have made a subtle
difference (hey, it's still quake data, not much HDRI in there).
2022-04-03 12:02:13 +09:00
Bill Currie 39e7c4a9b2 [vulkan] Use a template for the deferred image views
That certainly makes it nicer to work with large sets, and shows one way
to be careful with allocated resources: don't allocate them in the
inherited data and use a template that needs a few things filled in to
be valid. Also, it seems that overriding values in sub-structures "just
works" :)
2022-04-03 11:47:53 +09:00
Bill Currie eb4d566801 [vkparse] Add support for inheriting objects
It simply parses the referenced plist dictionary (via @inherit =
plist.path;) into the current data block, then allows the data to be
overwritten by the current plist dictionary. This may be a bit iffy for
any allocated resources, so some care must be taken, but it seems to
work nicely.
2022-04-03 11:11:28 +09:00
Bill Currie bbbdc41af3 [vulkan] Break render pass parsing away from swapchain
This allows a single render pass description to be used for both
on-screen and off-screen targets. While Vulkan does allow a VkRenderPass
to be used with any compatible frame buffer, and vkparse caches a
VkRenderPass created from the same description, this allows the same
description to be used for a compatible off-screen target without any
dependence on the swapchain. However, there is a problem in the caching
when it comes to targeting outputs with different formats.
2022-04-02 11:42:36 +09:00
Bill Currie 9b11992de4 [plist] Fix some typos and improve plfield_t's docs 2022-04-02 10:53:23 +09:00
Bill Currie 9892e571ce [vulkan] Move viewport and scissor into qfv_renderpass_t
This makes much more sense as they are intimately tied to the frame
buffer on which a render pass is working. Now, just the window width
and height are stored in vulkan_ctx_t. As a side benefit,
QFV_CreateSwapchain no long references viddef (now just palette and
conview in vulkan_draw.c to go).
2022-04-01 20:34:41 +09:00
Bill Currie 11e30583cf [vulkan] Switch to full screen triangle instead of quad
While I have trouble imagining it making that much performance
difference going from 4 verts to 3 for a whopping 2 polygons, or even
from 2 triangles to 1 for each poly, using only indices for the vertices
does remove a lot of code, and better yet, some memory and buffer
allocations... always a good thing.

That said, I guess freeing up a GPU thread for something else could make
a difference.
2022-04-01 19:50:41 +09:00
Bill Currie 88343d73ea [vulkan] Safely ignore fisheye and water warp
I didn't like the abort (especially having pushed it to master). This
takes care of things until I can get them implemented properly
(hopefully soon).
2022-04-01 16:51:25 +09:00
Bill Currie 03c403610d [vulkan] Safely ignore fisheye and water warp
I didn't like the abort (especially having pushed it to master). This
takes care of things until I can get them implemented properly
(hopefully soon).
2022-04-01 16:49:39 +09:00
Bill Currie 6bbbe4997b [vulkan] Invalidate mapped capture image memory
I think I had gotten lucky with captures not being corrupt due to them
being much bigger than all but the L3 cache (and then they're over 1/2
the size), so the memory was being automatically invalidated by other
activity. Don't want to trust such luck, though.
2022-04-01 16:19:10 +09:00
Bill Currie 42a03758c5 [vulkan] Remove redundant entity queue creation
I'd missed this when cleaning up entity queue creation for the other
renderers.
2022-04-01 15:26:51 +09:00
Bill Currie 6d0abd42bb [vulkan] Use host-cached memory for staging buffers
It makes a significant difference to level load times (approximately
halves them for demo1 and demo2). Nicely, it turns out I had implemented
the rest of the staging buffer code (in particular, flushing) correctly
in that it seems there's no corruption any of the data.
2022-04-01 15:14:56 +09:00
Bill Currie 56715e6796 Fix a typo 2022-04-01 10:40:26 +09:00
Bill Currie c2119f0e24 Fix a typo 2022-04-01 02:35:03 +09:00
Bill Currie 849558903d Merge branch 'wip-rua_scene'
rua_scene is still in progress, but I felt it time to merge the work
that has been done as it is an improvement on what was there.
2022-04-01 02:17:24 +09:00
Bill Currie 78119aeb7a [gamecode] Clean up generated swizzle code 2022-04-01 02:14:05 +09:00