Commit Graph

12659 Commits

Author SHA1 Message Date
Bill Currie 71ae7aac4a [gamecode] Add macros for long and ulong 2022-04-29 16:59:15 +09:00
Bill Currie 6d62e91ce7 [gamecode] Clean up progs data access
pr_type_t now contains only the one "value" field, and all the access
macros now use their PACKED variant for base access, making access to
larger types more consistent with the smaller types.
2022-04-29 16:59:15 +09:00
Bill Currie 5c67f95edd [qwaq] Set the world model to an empty world
The goal is to have somewhere to put entities so they can be rendered. I
suspect I could have used a bsp tree to partition space for frustum
culling, but it's probably not worth it at this stage (but shouldn't
require any changes to the engine: just the model).
2022-04-26 07:34:53 +09:00
Bill Currie c4d56afd33 [vulkan] Cope with an empty world model
Vulkan doesn't appreciate the empty buffers that result from the model
not having any textures or surfaces that can be rendered (rightfully so,
for such a bare-metal api).
2022-04-26 07:26:32 +09:00
Bill Currie 5703df00fd [renderer] Don't try to draw a nonexistent view model
Doing so doesn't end well (segfault). This is a bit of a hack until I
come up with a design for configurable scene rendering.
2022-04-26 07:22:45 +09:00
Bill Currie a9b8241a74 [ruamoko] Fix some misnamed parameters
IN_GetButtonName and IN_GetButtonNumber mentioned axis instead of
button. A tad confusing.
2022-04-26 07:19:35 +09:00
Bill Currie 98cbacfe9d [renderer] Remove redundant calls to visit_leaf
I doubt the calls were ever actually made in a normal map due to the
node actually being a node when breaking out of the loop, but when I
experimented with an empty world model (no nodes, one infinite empty
leaf) I found that visit_leaf was getting called twice instead of once.
2022-04-26 07:14:03 +09:00
Bill Currie fddff1c24d Merge branch 'master' into wip-rua_scene 2022-04-25 08:13:35 +09:00
Bill Currie 7ef9aab7f3 [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-25 07:49:30 +09:00
Bill Currie 0b912795d0 [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-25 07:49:30 +09:00
Bill Currie f6baa16084 [cvar] Remove the cvar lists
They're really redundant, and removing the next pointer makes for a
slightly smaller cvar struct. Cvar_Select was added to allow finding
lists of matching cvars.

The tab-completion and config saving code was reworked to use the hash
table DO functions. Comments removed since the code was completely
rewritten, but still many thanks to EvilTypeGuy and Fett.
2022-04-25 00:26:45 +09:00
Bill Currie 8bd626a3e4 [hash] Add a couple of data-oriented functions
Hash_Select returns a list of elements that match a given criterion
(select callback returning non-0).

Hash_ForEach simply calls a function for every element.
2022-04-25 00:18:22 +09:00
Bill Currie df4116a55d [qw] Add a FIXE for rcon_password 2022-04-24 21:13:46 +09:00
Bill Currie bafe54b010 [view] Add a cexpr enum for grav_t
And use it for hud_scoreboard_gravity. Putting the enum def in view made
the most sense as view does own the base type and the enum is likely to
be by useful for other settings.
2022-04-24 21:09:58 +09:00
Bill Currie bdb1192c13 [console] Fix missed changes to console line exec control
I think I'd gotten distracted while making the changes to the server,
then simply copied the partial changes to the client. It didn't blow up
thanks to the backing store bing char * and the type sized for int, so
safe on any platform, but useless as it wasn't connected properly.

It's actually pretty neat being able to directly, but safely, control a
function pointer via a cvar :)
2022-04-24 20:46:06 +09:00
Bill Currie bff0847761 [cvar] Clean up most misinterpreted cvar types
The misinterpretations were due to either the cvar not being accessed
directly by the engine, but via only the callback, or the cvars were
accesssed only by progs (in which case, they should be float). The
remainder are a potential enum (hud gravity) and a "too hard basket"
(rcon password: need to figure out how I want to handle secret strings).
2022-04-24 20:04:06 +09:00
Bill Currie 90447a5d3b [quakefs] Ensure fs_sharepath and fs_userpath are never empty
Other parts of quakefs treat an empty path as an error, so fs_sharepath
and fs_userpath must never be empty or they will effectively be
rejected. While the user explicitly setting them to empty strings is one
way for them to become empty, another is QFS_CompressPath compressing
'.' to an empty path, which makes it rather difficult to set up the
traditional quake directory tree (ie, operate from the current
directory).
2022-04-24 19:15:22 +09:00
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