Commit Graph

3007 Commits

Author SHA1 Message Date
David Carlier 159f5e3ae4 Little optimisation attempt targeted only for ARM 32 bits,
enabling "RunFast" mode ; benefits might depend on the board
 at hand.
2021-04-04 13:15:42 +01:00
Denis Pauk e8105810d7 vk: rework lefthand pipeline logic 2021-04-04 13:36:47 +03:00
Denis Pauk 456acfda05 vk: Reuse TriangledFan logic for TriangleStrip 2021-04-04 12:11:11 +03:00
Denis Pauk f8708a0f76 vk: rename triangle_{fan}_index_count 2021-04-04 10:46:35 +03:00
Denis Pauk b2ff95249e vk: fix water on jail1 level 2021-04-03 13:31:21 +03:00
Denis Pauk ec013874a0 check vert realloc in vk and vert list overflow in model 2021-04-03 13:31:05 +03:00
David Carlier df3b2307f2 unix network little change proposal. socket port fits within unsigned 16 bits type. 2021-04-01 19:39:23 +01:00
David Carlier 4bbf7ef27a game data packing representation of the headers 2021-04-01 12:18:13 +01:00
Denis Pauk 0b821a49c3 ref_vk: Reallocate mesh verts 2021-04-01 00:26:55 +03:00
Denis Pauk bef9485859 Fix vulkan validation warning
VK_WARNING: Validation Performance Warning: [ UNASSIGNED-BestPractices-vkCreateRenderPass-image-requires-memory ] Object 0: handle = 0x58e7d23ea0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x4003982 | Attachment 2 in the VkRenderPass is a multisampled image with 4 samples, but it uses loadOp/storeOp which requires accessing data from memory. Multisampled images should always be loadOp = CLEAR or DONT_CARE, storeOp = DONT_CARE. This allows the implementation to use lazily allocated memory effectively. (performance)
2021-03-31 22:20:01 +03:00
Yamagi 557668c35e
Merge pull request #680 from rg3/vk_restart_tweaks
Vulkan restart tweaks
2021-03-31 19:36:18 +02:00
Yamagi ee945625d3 Add a cvar `g_commanderbody_nogod` to make the com. body destructable.
The commanders body entity is special, because it's spawned in god mode.
That's no problem in the baseq2 and addons campaigns. But it may break
some custom maps and prevents some hacks, one example is putting the
entity inside an killbox.

Submitted by Евгений T.
2021-03-31 19:28:20 +02:00
Yamagi 635f6ffb16
Merge pull request #685 from BjossiAlfreds/bad-triggered
Console warning and fix for triggered monsters with no targetname
2021-03-31 10:07:06 +02:00
Ricardo Garcia 6c3261180b Use vid_renderer instead of vid_refresh to re-register clients 2021-03-29 22:15:28 +02:00
BjossiAlfreds fe517fd755 Console warning and fix for triggered monsters with no targetname 2021-03-28 17:16:36 +00:00
Yamagi baae6bed89 Send protocol version to client.
Knightmare of KMQ2 requested this as an easy way to support client site
prtocol auto detection.

While here fix the protocol version number in the error string.
2021-03-28 18:48:38 +02:00
Yamagi 1c8077cf61
Merge pull request #683 from devnexen/mapids_code_simpl
map list/little code changes proposal.
2021-03-28 18:32:00 +02:00
Yamagi 3371cf3014
Merge pull request #681 from rg3/aniso_rework
Vulkan anisotropic filter tweaks
2021-03-28 18:30:11 +02:00
David Carlier 7492fd875d map list/little code changes proposal. 2021-03-27 08:10:15 +00:00
Ricardo Garcia 17c2c94f07 Fix memory leak when restarting the Vulkan renderer
models_known needs to be freed after freeing its contents.
2021-03-21 18:30:06 +01:00
Ricardo Garcia e362e0280e Restart Vulkan renderer at EndFrame instead of BeginFrame
This brings yquake2 closer to vkQuake2 regarding renderer restarts when
the swapchain is out of date, among other situations that trigger a
Vulkan renderer restart.

Basically, the current behavior has the problem that when the renderer
is restarted at the beginning of the frame, the models are lost and we
end up with "ERROR: Mod_PointInLeaf: bad model" when attempting to
render anything after that restart.

To solve this, we move the restart logic to EndFrame and add a twist to
it: we use a vid_refresh variable to signal the server that the client
needs re-registration before starting the next frame cleanly, which will
trigger the registration logic to prepare the models again.
2021-03-21 18:29:38 +01:00
Ricardo Garcia 8891319bc1 Do not reset r_anisotropic to 1 from GL renderers
r_anisotropic can be zero in Vulkan to indicate anisotropic filtering
needs to be completely disabled, instead of enabled with value 1.0.
2021-03-21 11:08:09 +01:00
Ricardo Garcia f601ffddfc Use the real anisotropic filtering value in Vulkan
When creating the Vulkan texture samplers, make them have the real
anisotropic filtering value selected by the user. This has two side
effects:

* We no longer need two sets of texture samplers in Vulkan (one with and
  another one without anisotropic filtering).

* The anisotropic filter value in Vulkan is no longer an on/off switch
  and we use the value as chosen by the user.
2021-03-21 11:08:09 +01:00
Ricardo Garcia 6f8949fd95 Apply anisotropic filter only when hitting "Apply"
Making the anisotropic filter value only be applied after hitting Apply
in the video menu will make it more natural for the Vulkan renderer to
restart itself when a new anisotropic value is selected, paving the way
to use the actual anisotropic filtering value in Vulkan.
2021-03-21 02:31:09 +01:00
Ricardo Garcia 15e9c5499d Remove documentation for nonexisting vk_aniso variable 2021-03-21 00:33:16 +01:00
Yamagi 11bcb785d0 Force SDL to minimize the window when focus is lost.
This was the default until 2.0.12 and is what the expects. It changed
with 2.0.14, casing problems with window ordering under windows and
some X11 window managers like kwin.

Do it unconditionally. So we're shure that we're ending with a minimized
windows, no matter what SDL does.

Fixes part of #647.
2021-03-17 09:21:48 +01:00
Yamagi 51746d6980
Merge pull request #678 from 0lvin/fullscreen_hacks
Fix fullscreen value in hacks (f1b6b827)
2021-03-11 06:55:48 +01:00
Denis Pauk 56a8ab6d4d Fix fullscreen value in hacks (f1b6b827) 2021-03-10 23:25:59 +02:00
Yamagi 2a18f02186 Don't build the vk renderer when WITH_REFVK is no.
This is the third or forth try, already. *grrr* WITH_REFVK isn't enough,
as long as the target is there. Wrap the whole target in an if-block.
2021-03-10 10:50:02 +01:00
Yamagi 18a9827b74 When drawing the renderer list, move vk before soft.
The software renderer should be the last option offered to the user,
because it is the weakest renderer.
2021-03-10 10:45:36 +01:00
Yamagi f1b6b82721 Pull the major release card and switch the semantics of `vid_fullscreen`
One of the most common bug reports is, that the fullscreen mode doesn't
behave like users expect. This is caused by `vid_fullscreen 1` setting
desktop fullscreen mode (a fullscreen windows) and not the native
fullscreen mode. This commits switches the semantics:

* 1: Native fullscreen, like Vanilla Quake II.
* 2: Desktop fullscreen.

With this alt-tab reverts to native fullscreen. While at it improve the
documentation, suggest setting `r_mode -2` when using `vid_fullscreen
2`. Change the menu strings to make things clearer, set `r_mode -2` when
selecting 'fullscreen window' in the menu.

I pondered several other options:

* Introducing a second cvar for the desktop fullscreen, like we did in
  dhewm3. This has the problem, that in Quake II vi_fullscreen is
  special and used to communicate changed to the renderer configuration
  between the client and renderer. A second fullscreen cvar would
  complicate this already shaky mechanism even more.
* Setting `r_mode -2` when `vid_fullscreen 2`. This might not be what
  the user wants and causes problems when we're unable to get the
  desktop resolution.
2021-03-10 10:30:21 +01:00
Yamagi 51caf5b85e
Merge pull request #676 from rg3/vk_restart_fixes
Avoid restarting the whole video on VK_ERROR_OUT_OF_DATE_KHR
2021-03-10 10:01:47 +01:00
Yamagi 3c4dfcbba8 Switch the `r_fixsurfsky` default value to `0`.
Switching this back to Vanilla Q2 behavior fixes at least one lightning
problem in the space map in baseq2. It'll break the lighting in some
addon maps, but is more correct from a global standpoint. You can't
have everything...

Closes #677.
2021-03-10 09:49:03 +01:00
Yamagi 4ef0a71b63 Fix another mapbug in city2.bsp.
There's a floater spawned in but never triggered, messing up the monster
count on medium and hard difficulty.

Closes #674.
2021-03-10 09:42:54 +01:00
Yamagi e8107b4c64 Add else case missed / not committed in 9a17eb9a. 2021-03-08 21:30:34 +01:00
Ricardo Garcia 6989d22a2e Avoid restarting the whole video on VK_ERROR_OUT_OF_DATE_KHR
If an error is detected in vkAcquireNextImageKHR or vkQueuePresentKHR,
avoid restarting the whole video system and the game window. Instead,
shut down the Vulkan subsystem as gracefully as possible and restart it
without touching the window.

This fixes the problem with infinite video restarts under the Gnome
desktop environment.
2021-03-07 23:11:10 +01:00
Yamagi 80c637b5d6 Clamp `scr_conspeed` to `0.1f` and use `Cvar_Set()`.
Pointed out by @maraakate.
2021-03-05 10:29:46 +01:00
Yamagi bfa25a13d9 Clamp the console speed to 1 or higher.
Lower values mess up the console rendering. Closes #671.
2021-03-04 07:13:42 +01:00
Yamagi ae9a248e9e Add a cvar `g_footsteps` to control the generation of footstep sound.
1: The Vanilla Quake II behaviour, footsteps are generated when the
   player is faster than 255.
0: Footstep sounds are never generated.
2: Footstep sounds are always generated.

Defaults to `1`, cheat protected to `1`.

Closes #666.
2021-03-02 15:08:23 +01:00
Yamagi 69f029e236 Fix mapbug in lab.bsp: monstercount is off by two on medium skill.
In lab.bsp near the commanders head two parasites spawn in an hidden
place in the ceiling. On hard difficulty the box cracks open, exposing
the parasites. On medium skill it doesn't. Work around that by lowering
the monster count by 2.

Closes #668.
2021-03-02 14:51:22 +01:00
Yamagi 4c16fbe6dc Fix mapbug in cool1.bsp: monstercount is off by one on medium skill.
When coming down the river near the end on hard difficulty a gladiator
breaks out of a big metal crate to the left. On medium difficulty the
gladiator is spawned but never triggered. Work around this by lowering
the monstercount by one when skill is set to 1. This doesn't happen on
easy difficulty.

Closes #667.
2021-03-02 14:44:35 +01:00
Yamagi d713944681
Merge pull request #658 from rg3/more_vulkan_fixes
More Vulkan fixes
2021-02-26 14:48:00 +01:00
Ricardo Garcia bdd715ee5c Fix validation errors with unnormalized samplers
When using samplers with unnormalized coordinates in Vulkan, the shaders
must specify the LOD explicitly.
2021-02-23 22:07:32 +01:00
Yamagi b1ad1329cc
Merge pull request #665 from shamazmazum/master
Fix segmentation fault on FreeBSD.
2021-02-20 17:33:06 +01:00
Vasily Postnicov 8ba25e82c9 Fix segmentation fault on FreeBSD.
Specify correct protection flags when calling mmap() on FreeBSD.
prot | PROT_MAX (prot) are the correct flags because just PROT_MAX
(prot) leaves current protection flags set to PROT_NONE which causes
segmentation fault when reading or writing to the mapped region.
2021-02-17 22:16:58 +03:00
Ricardo Garcia 63f6778910 Only center Vulkan viewport in "keep resolution" mode
When windowed or in "switch resolution" mode, the viewport must be kept
in the top-left corner or it will appear cut while in fullscreen.

Also, make offset and width calculations safe from the point of view of
the swapchain extent, in case there's a mismatch.
2021-02-14 23:01:14 +01:00
Ricardo Garcia b96b3a8d84 Synchronize color attachment layout transitions with loads
Since we are now loading the world color buffer content before drawing
on them again, we need to make sure the attachment layout transition
from shader-read-optimal to color-attachment-optimal happens before
color attachment read operations.
2021-02-14 00:03:40 +01:00
Ricardo Garcia e0e52de47f Add a convenience Qvk_MemoryBarrier function 2021-02-14 00:02:08 +01:00
Yamagi d86905119e
Merge pull request #663 from 0lvin/updates
Soft render updates
2021-02-11 17:28:18 +01:00
Denis Pauk 791b5e1e13 Save buffer size and use as limit for operations 2021-02-06 23:35:02 +02:00