Commit graph

4481 commits

Author SHA1 Message Date
Bill Currie
d23c9582f1 [qwaq] Implement execute-to-cursor
Support for finding the first address associated with a source line was
added to the engine, returning 0 if not found.

A temporary breakpoint is set and the progs allowed to run free.
However, better handling of temporary breakpoitns is needed as currently
a "permanent" breakpoint will be cleared without clearing the temporary
breakpoing if the permanent breakpoing is hit while execut-to-cursor is
running.
2021-06-08 16:54:04 +09:00
Bill Currie
204578772d [gl] Move clearing to screen's render frame
This allows 2d-only to be cleared properly.
2021-06-04 16:32:42 +09:00
Bill Currie
dc5ebd5c3d [ruamoko] Actually hook up the stdlib builtins 2021-06-01 23:44:51 +09:00
Bill Currie
713862c511 [util] Fix format issue in set test
I guess I hadn't done a "make check" on 64-bit since getting windows
builds to work.
2021-06-01 19:11:51 +09:00
Bill Currie
897f8ebfbe [vulkan] Fix vkgen linking
I had missed the edit while getting qf to build on my eeepc due to not
having vulkan.
2021-06-01 19:10:01 +09:00
Bill Currie
758a44a946 [vulkan] Fix an uninitialized variable warning
semi-bogus, but I prefer false positives to false negatives.
2021-06-01 19:09:03 +09:00
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
0293167bd2 [util] Get simd tests working for emulated simd
A bit of a mess for optimized vs unoptimized, but the tests acknowledge
the differences in precision while checking that the code produces the
right results allowing for that precision.
2021-06-01 18:53:53 +09:00
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
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
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
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
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
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
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
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
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
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
612eb49d9c [render] Separate fov x and y calculations
This ensures that fov_y is not calculated until after the render view
size is known and thus doesn't become some crazy angle (that happens to
result in a negative tan). Fixes upside-down-quake :)
2021-04-01 19:40:25 +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
73a610508c [util] Fix cmem for windows
I had quite messed up the page size (oops), and missed the fact that
_aligned_free is to be used with _aligned_malloc rather than just free.
2021-04-01 18:00:59 +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
92859b7c2e [input] Set up default bindings for other imts
Now ` and F10 work by default in all contexts.
2021-03-31 17:52:47 +09:00
Bill Currie
bc785ab2c2 [input] Make unbindall less aggressive
As it is a legacy command, it should affect only the legacy bindings
(imt_drop_all is available for aggressively unbinding all keys).
2021-03-31 17:49:26 +09:00
Bill Currie
55d3193b5f [vid] Set pixel format for OpenGL
This gets the GL and GLSL renderers working for the -win targets... sort
of: they are upside down and GLSL's bsp surfaces are black (same as
Vulkan). However, with this, all 5 renderers at least limp along for
-win, 4/5 work for -sdl.
2021-03-31 16:25:19 +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
8e363d424f [vid] Remove redundant call to VID_InitBuffers 2021-03-31 15:11:31 +09:00
Bill Currie
38e7a63cef [vid] Clean up sdl some more
Ugh, its fullscreen is annoying, but later.
2021-03-31 15:10:51 +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
596cd164a3 [win] Handle focus in/out events
This fixes the errant console behavior (cursor wasn't showing because QF
thought it had never received focus).
2021-03-31 02:48:25 +09:00
Bill Currie
63e30e6ae0 [win] Fix a handful of small bugs for windows
Only 64-bit windows is tested, and there are still various failures, but
QF is limping along in windows again.

nq-sdl works for sw, and sw32, gl and glsl are mostly black (but not
entirely for gl?),  vulkan is not supported with sdl.

nq-win works for sw and sw32, and sort of for vulkan (very dark and
upside-down?). gl and glsl complain about vid mode,

qw-client-[sdl,win] seem to be the same, but something is wrong with the
console (reading keyboard input).
2021-03-30 20:19:20 +09:00
Bill Currie
ae78c81b3a [render] Fail gracefully on unsupported render targets
Ideally, this won't be the case, but it currently is for Vulkan and SDL.
2021-03-30 18:29:18 +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
15a5254f04 [build] Get ncurses support working again
Some minor errors dues to getting win32 building (and not testing the
results properly in Linux).
2021-03-29 17:54:39 +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
0da127b822 [gamecode] Fix bad progs strings intialization
The merge with the improvements I made while hacking on csqc (still
undecided as to whether to continue that project) resulted in the size
of the progs string area getting mangled when no heap was allocated for
the progs due to a null zone pointer being used in some pointer
arithmetic. Fixes random(!!!) invalid string error in qfprogs.
2021-03-29 17:31:17 +09:00
Bill Currie
6fea5f5e1a [build] Add -Wformat-non-literal option
While this caused some trouble for pr_strings and configurable strftime
(evil hacks abound), it's the result of discovering an ancient (from
maybe as early as 2004, definitely before 2012) bug in qwaq's printing
that somehow got past months of trial-by-fire testing (origin understood
thanks to the warning finding it).
2021-03-29 17:27:06 +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
2e1f3cda89 [vulkan] Flesh out known required windows functions
It looks like choosing a visual is not necessary (at least for normal
apps, VR might be another matter). Still no idea if anything works (for
-win support in general, let alone vulkan).
2021-03-29 12:03:07 +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
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
c4a0f3cc73 [util] Fix a string handling bug
Good grief, they still exist :(
2021-03-27 20:06:40 +09:00
Bill Currie
99f0cde080 [util] Add strndup and reentrant quicksort
Needed for portability.
2021-03-27 20:03:39 +09:00
Bill Currie
5b1ee0e6f6 [vulkan] Fix an inappropriate cast
I'm surprised that worked at all (and more surprised it got past linux
gcc).
2021-03-27 19:55:43 +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
0167456b21 [util] Loosen up SEB relative epsilon a little
1e-8 is a little too tight, the normal was 4.5x the computed epsilon.
Going to 1e-6 still keeps things tight.
2021-03-27 15:04:13 +09:00
Bill Currie
a32e2319e2 Merge branch 'master' into win-merge 2021-03-25 22:42:16 +09:00
Bill Currie
c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie
0cae54d25d Move the tex conversion to libQFimage.
This is for the conversion /to/ paletted textures. The conversion is
necessary for csqc support. In the process, the conversion has been sped up
by implementing a color cache for the conversion process. I haven't
measured the difference yet, but Mr Fixit does seem to load much faster for
the sw renderer than it did before the change (many months old memory).
2021-03-25 18:16:24 +09:00
Bill Currie
67c220de76 Make R_SetVrect const-correct. 2021-03-25 18:14:17 +09:00
Bill Currie
91e3769c05 Recalculate the fov when the cvar changes.
This separate the FOV calculations from other refdef calcs, cleaning up the
renderer proper and making it easier for other parts of the engine (eg,
csqc) to update the fov.
2021-03-25 18:14:03 +09:00
Bill Currie
66fda1fddb Rewrite edict access.
The server edict arrays are now stored outside of progs memory, only the
entity data itself (ie data accessible to progs via ent.fld) is stored in
progs memory. Many of the changes were due to code accessing edicts and
entity fields directly rather than through the provided macros.
2021-03-25 18:13:48 +09:00
Bill Currie
32c2e013ca [vulkan] Add missed screen capture files
Rather critical to the build (and screenshots)
2021-03-25 16:00:19 +09:00
Bill Currie
999dd8248b [vulkan] Implement sky box loading and rendering
Loading is broken for multi-file image sets due to the way images are
loaded (this needs some thought for making it effecient), but the
Blender environment map loading works.
2021-03-25 15:54:34 +09:00
Bill Currie
c5c44da727 [vulkan] Implement screenshot
Finally, I can brag about my progress on irc :)
2021-03-24 19:20:53 +09:00
Bill Currie
51d6ec7c8c [vulkan] Fix what looks like a thinko
It looked like the code would have deleted a replacement swapchain
instead of the one being replaced.
2021-03-24 12:04:09 +09:00
Bill Currie
a0d47de439 [vulkan] Suppress all the debug output
silence is golden
2021-03-23 13:04:22 +09:00
Bill Currie
5d9bf32d3c Merge branch 'vulkan' 2021-03-23 12:31:58 +09:00
Bill Currie
7e946a4de9 [vulkan] Implement water surface rendering
They're unlit (fullbright, but that's nothing new for quake), but
working nicely. As a bonus, sort out the sky pass (forced to due to the
way command buffers are used).
2021-03-23 12:24:24 +09:00
Bill Currie
6e0312658d [vulkan] Fix sky depth issues
There were actually several problems: translucency wasn't using or
depending on the depth buffer, and the depth buffer wasn't marked as
read-only in the g-buffer pass. Getting that correct seems to have given
bigass1 a 0.5% boost (hard to say, could be the usual noise).
2021-03-23 11:26:24 +09:00
Bill Currie
5ac807d4b2 [vulkan] Remove the old forward renderpass spec
I doubt I'll go back to it, and it was in the wrong place anyway.
2021-03-23 10:12:26 +09:00
Bill Currie
d4e1bfb8b8 [vulkan] Clean up the pipeline specifications
While being able to write pipeline specs like this was the end goal of
the parsing sub-project, I didn't realize it was already usable. This
sure makes going through the pipeline specs much easier.
2021-03-23 10:01:13 +09:00