Commit Graph

1889 Commits

Author SHA1 Message Date
Bill Currie 5ca792c40e [ruamoko] Add some stdlib function wrappers
For now, just bsearch (normal and fuzzy), qsort, and prefixsum (not in
C's stdlib that I know of, but I think having native implementations of
float and int prefix sums will be useful.
2021-06-01 18:53:53 +09:00
Bill Currie bcc5686606 [util] Add fuzzy and reentrant bsearch
Fuzzy bsearch is useful for finding an entry in a prefix sum array
(value is >= ele[0], < ele[1]), and the reentrant version is good when
data needs to be passed to the compare function. Adapted from the code
used in pr_resolve.
2021-06-01 18:53:53 +09:00
Bill Currie 778c07e91f [util] Get vectors working for non-SSE archs
GCC does a fairly nice job of producing code for vector types when the
hardware doesn't support SIMD, but it seems to break certain math
optimization rules due to excess precision (?). Still, it works well
enough for the core engine, but may not be well suited to the tools.
However, so far, only qfvis uses vector types (and it's not tested yet),
and tools should probably be used on suitable machines anyway (not
forces, of course).
2021-06-01 18:53:53 +09:00
Bill Currie a461c09586 [util] Make cmem consistent on 32 and 64 bit systems
I don't know that the cache line size is 64 bytes on 32 bit systems, but
it should be ok to assume that 64-byte alignment behaves well on systems
with smaller cache lines so long as they are powers of two. This does
mean there is some waste on 32-bit systems, but it should be fairly
minimal (32 bytes per memblock, which manages page sized regions).
2021-06-01 18:53:52 +09:00
Bill Currie 1cf40be484 [vulkan] Create shadow maps and basic data
I will definitely need to look into sparse images later (2.3GB for
marcher) but the shadow map images, views and matrices are created.
2021-04-29 20:54:38 +09:00
Bill Currie 562f3c2fe2 [vulkan] Add tan and cos perspective projection
The tan and cos versions allow specifying the fov directly from the tan
or cos of the half angle, useful for dealing with lights.
2021-04-29 19:27:01 +09:00
Bill Currie cb7d2671d8 [simd] Make mmulf safe for src=dst
I guess I'd forgotten that the parameters are actually pointers.
2021-04-29 19:25:31 +09:00
Bill Currie c86f0c9449 [vulkan] Move projection matrix code to its own file
And move more stuff over to simd.
2021-04-25 15:48:21 +09:00
Bill Currie 8b6136e6f5 [mathlib] Add Blend macro
The Blend macro supports any non-integral type supporting * and +
(float, double, vec4f_t, etc), so it is essentially a scalar VectorBlend
or QuatBlend.
2021-04-25 15:02:30 +09:00
Bill Currie e6bc5e3e11 [simd] Add qexpf function 2021-04-25 15:02:08 +09:00
Bill Currie 590f0f18bc [vulkan] Check leaf sky visibility for suns
And fix some out-by-one errors for leaf visibility (pvs index 0 is
actually leaf index 1)
2021-04-25 12:27:07 +09:00
Bill Currie ae231319ea [vulkan] Implement all the extended light models
Standard quake has just linear, but the modding community added inverse,
inverse-square (raw and offset (1/(r^2+1)), infinite (sun), and
ambient (minlight). Other than the lack of shadows, marcher now looks
really good.
2021-04-25 12:27:07 +09:00
Bill Currie 40aa629ef8 [image] Add function to get image memory size 2021-04-25 08:38:13 +09:00
Bill Currie 785be9d340 [vulkan] Clean up buffer barriers a bit
This even fixes a couple of minor issues that snuck past validation.
2021-04-24 15:47:31 +09:00
Bill Currie dc9b64fadd [vulkan] Clean up image barriers a bit
Mostly, this gets the stage flags in with the barrier, but also adds a
couple more barrier templates. It should make for slightly less verbose
code, and one less opportunity for error (mismatched barrier/stages).
2021-04-24 12:42:29 +09:00
Bill Currie 8c03ed8be5 [vulkan] Start work on shadows
This gets the shaders needed for creating shadow maps, and the changes
to the lighting pipeline for binding the shadow maps, but no generation
or reading is done yet. It feels like parts of various systems are
getting a little big for their britches and I need to do an audit of
various things.
2021-04-24 10:40:39 +09:00
Bill Currie 1e9329ccf6 [nq,qw] Stop wring to config.cfg
QF now uses its own configuration file (quakeforge.cfg for now) rather
than overwriting config.cfg so that people trying out QF in their normal
quake installs don't trash their config.cfg for other quake clients. If
quakeforge.cfg is present, all other config files are ignored except
that quake.rc is scanned for a startdemos command and that is executed.
2021-04-12 22:09:09 +09:00
Bill Currie 9fb337fac4 [net] Move found host caching into net_main
This unifies all the checks and plugs a set of potential buffer
overflows.
2021-04-04 18:38:14 +09:00
Bill Currie f596eacf0c [util] Add message short and long poke functions
Both big and little endian.
2021-04-04 15:56:14 +09:00
Bill Currie 972b0f8a70 [util] Make sizebuf and msg sizes unisgned
And clean up the mess.
2021-04-04 15:53:53 +09:00
Bill Currie 9a2f82bbc6 [util] Add big-endian short msg read/write
And improve the generated code for MSG_ReadShort

I suspect gcc didn't like all the excess pointer dereferences and so
couldn't assume that the bytes were being read sequentially.
2021-04-04 15:19:38 +09:00
Bill Currie afd7b38551 [util] Add big-endian long msg read/write
And improve the generated code as well (ie, use a code sequence that gcc
recognizes and optimizes to a single 32-bit read and a byte-swap).

nq uses big-endian for its packet headers (arg, though it is consistent
with IP, it's not with the rest of quake).
2021-04-04 15:11:09 +09:00
Bill Currie 7864bb0ba6 [util] Use a clearer parameter name for SZ_Alloc 2021-04-04 14:09:02 +09:00
Bill Currie 9ac4cdc6bd [simd] Fix more portability issues
I had missed vec4d.h because it's mostly unused at this stage.
2021-04-02 23:25:14 +09:00
Bill Currie 39103cc8a3 [sw] Fix some 32-bit assembly issues
I'm not sure that the mismatch between refdef_t and the assembly defines
was a problem (many fields unused), but the main problem was due to
execute permission on the pages: one chunk of asm was in the data
section, and the patched code was not marked as being executable (due to
such a thing not existing when quake was written).
2021-04-02 22:17:32 +09:00
Bill Currie e50a079f72 [vulkan] Fix some 32-bit compatibility issues
mostly dealing with vulkan's handles always being 64-bit, but pointers
being either 32 or 64.
2021-04-02 08:48:11 +09:00
Bill Currie c9f9c1e36b [util] Make cmem.h more portable
32-bit size_t doesn't like 64-bit bit-fields. More testing needed to see
if cmem works properly (mostly alignment) on 32-bit system.
2021-04-02 08:47:36 +09:00
Bill Currie 2d67bcacd7 [vulkan] Use cleaner bsp glow texture handling
It was always a bit of a hack, and it didn't work for 32-bit builds.
2021-04-02 08:46:22 +09:00
Bill Currie 37d35811e3 [vid,render] Clean up fov and aspect
vid.aspect is removed (for now) as it was not really the right idea (I
really didn't know what I was doing at the time). Nicely, this *almost*
fixes the fov bug on fresh installs: the view is now properly
upside-down rather than just flipped vertically (ie, it's now rotated
180 degrees).
2021-04-01 19:17:19 +09:00
Bill Currie 9ded490806 [util] Add Sys_PageSize
Eliminate that particular problem once and for all.
2021-04-01 18:20:56 +09:00
Bill Currie f13af65b32 [vulkan] Move viewport and scissor into vulkan_ctx
Not only does it makes sense to centralize the setting of viewport and
scissor, but it's actually necessary in order to fix the upside-down
rendering on windows.
2021-04-01 11:44:30 +09:00
Bill Currie 6f56f98714 [vid] Make windows vid init conform to QF's method
Ie, respecting cvars.
2021-03-31 15:50:10 +09:00
Bill Currie 3eb28000de [vid] Clean up windows video code a bit
It turns out the dd and dib "driver" code is very specific to the
software renderer. This does not fix the segfault on changing video
mode, but I do know where the problem lies: the window is being
destroyed and recreated without recreating the buffers. I suspect a
clean solution to this will allow for window resizing in X as well.
2021-03-31 15:10:35 +09:00
Bill Currie 8ec781a434 [vid] Fix some naming inconsistencies 2021-03-31 13:05:50 +09:00
Bill Currie 81a837da0f [win] Clean up a pile of messy externs 2021-03-31 10:36:30 +09:00
Bill Currie dac9166339 [nq] Sort out some of the issues with keydest
Switches to "game" properly when starting a new game after playing
menus. Of course, basic bindings are still broken in "demo".
2021-03-29 22:39:43 +09:00
Bill Currie 5f93c115ff [util] Make developer flag names easier to manage
They're now an enum, and the flag part of the name is all lowercase, but
now the flag definitions and names list will never get out of sync.
2021-03-29 22:38:47 +09:00
Bill Currie 1068685677 [vulkan] Fix incorrect cast
The result of an aborted attempt to get QF building for 32-bit windows.
2021-03-29 19:55:05 +09:00
Bill Currie 64f51bda6e [build] Get make distcheck working again
again...

This covers only the basic check with a build in debian, but it's a good
start.
2021-03-29 17:35:30 +09:00
Bill Currie a754dbca37 [util] Make va return const char *
And clean up the resulting mess.

I don't know why it wasn't doing so, but it certainly should have been.
2021-03-29 17:24:30 +09:00
Bill Currie 00aa584506 [util] Add re-entrant set_as_string
Makes it easier to debug set-related code in multi-threaded code.
2021-03-28 20:25:57 +09:00
Bill Currie b6ab832ed4 [simd] Add vabsf and some more tests 2021-03-28 19:49:43 +09:00
Bill Currie 29e029c792 [util] Add float a simd version of the SEB
And its support functions. I can't tell if it's any faster (mtwist_rand
is a significant chunk of the benchmark timings, oops), but it's nice to
have.
2021-03-27 23:38:10 +09:00
Bill Currie 72280186bf [qfvis] Use cmem for memory management
While the main bulk of the improvement (36s down from 42s for
gmsp3v2.bsp on my i7-6850K) comes from using a high-tide allocator for
the windings (which necessitated using a fixed size), it is ever so
slightly faster than using malloc as the back-end.
2021-03-27 20:30:35 +09:00
Bill Currie 88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie 8309e1852a [simd] Fix some portability issues
Use [u]int64_t instead of long, and fix some incorrect attribute usage
(I had misread the gcc docs at the time).
2021-03-27 20:04:10 +09:00
Bill Currie 99f0cde080 [util] Add strndup and reentrant quicksort
Needed for portability.
2021-03-27 20:03:39 +09:00
Bill Currie a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie 7c788a6e7a [util] Use size_t for dstring length params
While not overly wrong, unsigned is not really appropriate.
2021-03-27 19:08:18 +09:00
Bill Currie a32e2319e2 Merge branch 'master' into win-merge 2021-03-25 22:42:16 +09:00