Commit graph

11604 commits

Author SHA1 Message Date
Bill Currie
ef9b04ba83 [util] Get tests working with sse2
It seems that i686 code generation is all over the place reguarding sse2
vs fp, with the resulting differences in carried precision. I'm not sure
I'm happy with the situation, but at least it's being tested to a
certain extent. Not sure if this broke basic (no sse) i686 tests.
2021-06-01 18:53:53 +09:00
Bill Currie
c5f2aca07d [vulkan] Conditionalize vulkan tests 2021-06-01 18:53:53 +09:00
Bill Currie
85087177bf [vulkan] Conditionalize build of vkgen
vkgen cannot be built if vulkan headers are unavailable.
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
0a6cb3ad53 [vulkan] Don't build vkgen when vulkan is unavailable 2021-06-01 18:53:52 +09:00
Bill Currie
9dca47c0e1 Make the set tests word size agnostic. 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
d5454faeb7 [gamecode] Set legacy progs def sizes from type
Legacy progs do not have the extended defs data (and usually won't have
anything more complicated than a vector), so use the basic type size for
the def size. Fixes broken edict prints.
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
52168da93e [vulkan] Don't lose other sky cube faces
Because LoadImage uses Hunk_TempAlloc, the face images need to be copied
individually. Really, what's neeeded is to be able to load the image
data into a pre-allocated buffer (ideally, the staging buffer for
vulkan, but that's for later).
2021-04-25 08:38:48 +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
c29e9828b6 [vulkan] Clean up misuse of va for vulkan handles
The built up "path" name of the handle resource was not always surviving
the intervening call to cexpr_eval_string (in particular, when other
handles were created in the process of creating a handle). Rather than
simply increase the number of va buffers (where would it end?), just
regenerate the path when adding the new handle. It's probably quick
enough, and the code is not usually not on a critical path.
2021-04-22 19:47:42 +09:00
Bill Currie
140425be33 [vulkan] Name some more objects
Shaders and descriptor set layouts.
2021-04-19 18:07:45 +09:00
Bill Currie
2918410b30 [vulkan] Fix a couple of minor issues
Magic number for compose descriptors and mistaken masking of vulkan
plist parse errors.
2021-04-19 18:07:45 +09:00
Bill Currie
52bfb0aeb0 [vulkan] Label the drawing command buffers 2021-04-19 18:07:45 +09:00
Bill Currie
da39bb2df3 [vulkan] Use more correct dependency flags
I was reading about multi-pass rendering on mobile devices
(https://developer.oculus.com/blog/loads-stores-passes-and-advanced-gpu-pipelines/)
and discovered that I had used the wrong flags (but then, I think Graham
Sellers had, too, since used his Vulkan Programming Guide as a
reference). Doesn't seem to make any difference on desktop, but as
there's no loss there, but potential gains on mobile, I'd say it's a
win.
2021-04-18 18:56:31 +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
87eccb9e6f [nq] Ensure stuffcmd is done for cl_quakerc 0
This was done years ago for qw, but missed for nq.
2021-04-11 20:09:03 +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
a630c95eb6 [nat] Remove the datagram test commands
They seem to be related to the server list protocol, probably from its
development, but no longer needed.
2021-04-04 18:31:57 +09:00
Bill Currie
5f682ff1df [net] Clean up nq's packet reading and writing
It should be more portable now and hopefully future proof against C
aliasing. Also, the send and receive buffers are now separate.
2021-04-04 17:01:53 +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
59e5592fed [net] Dump nq udp packets
Probably need some finer control, but it will do for now.
2021-04-04 14:09:02 +09:00
Bill Currie
7864bb0ba6 [util] Use a clearer parameter name for SZ_Alloc 2021-04-04 14:09:02 +09:00
Bill Currie
658890d681 [net] Clean up some formatting
Doing this before attacking the actual code (lots of potential buffer
overflows and possibly unnecessary code).
2021-04-04 14:09:01 +09:00
Bill Currie
e2f545eb23 [vulkan] Wait on device idle before deleting models
This fixes the textures (and presumably mesh data) being deleted while
still in use. Oddly, the wait was needed in both brush and alias models
(I expected brush to always come first).
2021-04-03 01:14:44 +09:00
Bill Currie
7e6928d7d5 [qwaq] Work around a gcc non-conformance
*sigh*
2021-04-03 00:27:43 +09:00
Bill Currie
6e9ee98e88 [models] Add floodfill.c to the vulkan alias lib
Many thanks to JohnnyonFlame for his testing on a different system.
2021-04-03 00:16:25 +09:00
Bill Currie
a5df5867b6 [qwaq] Avoid ignored return val warning
If those particular writes file (and it matters), we probably have
bigger problems.
2021-04-03 00:14:49 +09:00
Bill Currie
64bfaeca6c [vulkan] Skip values array for empty enum symtabs
Fixes an unused warning/error when the enum has no interesting values
(eg, VkRenderPassCreateFlagBits on older versions of the vulkan api).
2021-04-03 00:06:54 +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
37be6a23a2 [entity] Use _aligned_malloc etc for _WIN32
This is a bit of a hack for now (need to look into maybe using cmem),
but it gets 32-bit windows working for all but the software renderer
(probably just refdef (and maybe viddef) getting out of sync with the
assembly code.
2021-04-02 21:02:14 +09:00
Bill Currie
18247a8c8e [tools] Fix up 32-bit cross-compile scripts 2021-04-02 08:55:16 +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