Commit graph

3141 commits

Author SHA1 Message Date
Yamagi
950ec0d67e Lower vkAcquireNextImageKHR() timeout to 500 milliseconds.
The timeout specifies how long Vulkan waits for the next frame becoming
available. On the one hand we need to take the vsync or the possibility
that we get scheduled away for longer times into account. On the other
hand we don't want to wait for too long, the game may run into the
timeout after its windows was minimized, etc. 500 milliseconds sounds
like a good compromise.
2021-04-30 13:14:29 +02:00
Yamagi
7ea425ee25 Handle VK_TIMEOUT, may lead to restart loops. 2021-04-30 13:14:29 +02:00
Yamagi
c543d3cc05 Work around maximal extent size of 0x0 when the game is minimized.
Some GPU drivers set a maximal extent size of 0x0 when the window gets
minimized. One example is Intel on Windows. A swapchain with extent
size of 0x0 is invalid, so we cannot reinitialize the renderer... Work
around that by postponing the restart as long as the maxmimal extent
size stays 0x0.

This could should be done in the client (don't call into th renderer
when the window is minimized), but it would need a lot of changes
to the client <-> renderer interactions. So take the easy route.
2021-04-30 13:14:29 +02:00
Yamagi
dd80702913 Add a function QVk_CheckExtent() to query the extent state.
This will be used to detect if we've got an extent size of 0x0 because
the window has been maximized.
2021-04-30 13:14:29 +02:00
Yamagi
0ccf1e8ef8 Make current frame as not started after vk init / shutdown.
The client might call into the renderer after it was shut down by
`VID_ShutdownRenderer()` or initialized `VID_LoadRenderer()`. This
is arguably a client bug, but hard to fix on client side and not
a problem for all other renderers. Work around it by marking the
current frame as 'not started' at Vulkan shutdown and init.
2021-04-30 13:14:29 +02:00
Yamagi
a38084c621 Move QVk_Postinit() from render init to context init.
This is more in line with the rest of the code. Reinitializing the
internal state when building a new context is saver than relying on
Vulkan telling us that something is wrong an reacting to that.
2021-04-30 13:14:29 +02:00
Yamagi
1f4082c419 Call QVk_WaitAndShutdownAll() on context shutdown.
Just calling `QVk_Shutdown()` is wrong. It doesn't wait for Vulkan to
finish, which can cause crashes. And it leaks some ressources which
makes the GPU driver unhappy.
2021-04-30 13:14:29 +02:00
Yamagi
3cf786e158 Ensure that the vk renderer isn't init or shutdown twice.
The ref_vk renderer was written for vkQ2 which has differend renderer
<-> client semantics. In YQ2 we can end up initializing or shutting the
renderer down several times. Not by the client, but by the client not
knowing of the renderer has already initialized / shutdown it's internal
state. This is fatal, leading to ressource leaks, crashes and other fun.

Introduce a new global variable `vk_initialize` and use it to track if
we're initialized or not.
2021-04-30 13:14:29 +02:00
Yamagi
2ccc80a1c6
Merge pull request #707 from BjossiAlfreds/player-sounds
Fix for some player sound bugs
2021-04-30 11:53:01 +02:00
BjossiAlfreds
d41d90d8b3 Fix for some player sound bugs 2021-04-30 01:43:15 +00:00
Yamagi
4cacd4a0c9
Merge pull request #706 from BjossiAlfreds/shark-bbox
Shark bbox fix and added check for inuse after entity thinking
2021-04-27 08:59:53 +02:00
Yamagi
c88c299172 Fix playback of OGG/Vorbis files with != 2 channels.
This was a stupid bug and the code worked just by luck, but only with
stereo files. Because sizeof(short) == 2 and ogg_file->channels.
2021-04-24 17:48:28 +02:00
BjossiAlfreds
75d671656e Shark bbox fix and added check for inuse after entity thinking 2021-04-18 01:07:07 +00:00
Yamagi
7d27e0d0e8
Merge pull request #698 from BjossiAlfreds/map-fixes
Map fixes for old and newly discovered bugs + removed code hacks
2021-04-13 13:00:19 +02:00
Yamagi
ef248cbe6a Port the vk renderer to the new ref restart API.
Since `vid_fullscreen` isn't special anymore, it's completely handled by
`Vid_Restart_f()`, which in turn simplifies the spaghetti code in the vk
renderer. If I understand that glibberish correctly the only we need to
handle is the partial restart in `QVk_Restart()`.
2021-04-11 11:23:45 +02:00
Yamagi
fa30a41c5e Port the soft renderer to the new ref restart API. 2021-04-11 11:23:45 +02:00
Yamagi
01fa2cfc1c Port the gl1 renderer to the new ref restart API. 2021-04-11 11:23:44 +02:00
Yamagi
27a021eb7c Port the client to the new restart API.
This fixes the video menu and alt-tab when running a renderer that uses
the new API.
2021-04-11 11:23:44 +02:00
Yamagi
a5102f47dd Port the gl3 renderer to the new ref restart API. 2021-04-11 11:23:44 +02:00
Yamagi
09d645ab4b Extend the ref import API with Vid_RequestRestart().
This function will be used to replace the vid_fullscreen->modified
mechanism used the communicate renderer configuration restarts to the
client with a proper proper API. The implementation is backward
compatible, existing renderers are still working.
2021-04-11 11:23:44 +02:00
Yamagi
886ce1525e Port missing !vk_frameStarted guards from vulkanQ2.
Without these guards draw calls may be emitted without having a working
or sane context, leading to crashes in the Vulkan driver.
2021-04-11 11:17:52 +02:00
BjossiAlfreds
47c99cc7a3 Documentation for the map fixes 2021-04-11 02:56:40 +00:00
Yamagi
33148a3085 Revert "unix network little change proposal. socket port fits within unsigned 16 bits type."
This reverts commit df3b2307f2.
2021-04-10 17:40:03 +02:00
BjossiAlfreds
7a92382b96 Fixed spawnflags of DM-only super shotgun in map train 2021-04-08 14:47:05 +00:00
BjossiAlfreds
23f55b72c7 Map fixes for old and newly discovered bugs + removed code hacks 2021-04-08 13:42:18 +00:00
Yamagi
4fd0369f47
Merge pull request #697 from 0lvin/for_review
soft: fix m8 image load
2021-04-08 11:05:56 +02:00
Yamagi
56754ff8b8
Merge pull request #696 from devnexen/segfault_with_console_at_launch
Fix segfault when turning the console before the game is launched
2021-04-08 11:04:17 +02:00
Yamagi
916515182f
Merge pull request #690 from devnexen/savegame_data_packing
game data packing representation of the headers
2021-04-08 11:02:28 +02:00
Denis Pauk
5cc959e501 soft: fix m8 image 2021-04-07 22:58:46 +03:00
David CARLIER
f66d7a9540 Fix segfault when turning the console before the game is launched
(thus audio backend not yet initialised).
2021-04-07 20:17:27 +01:00
Yamagi
26bda18549
Merge pull request #694 from 0lvin/for_review
Vulkan code improvements and cleanup
2021-04-07 09:56:07 +02:00
Yamagi
1bae4e679f
Merge pull request #695 from devnexen/arm_runfast_mode
Little optimisation attempt targeted only for ARM 32 bits,
2021-04-07 09:32:18 +02:00
Yamagi
d4bf1415b7
Merge pull request #691 from devnexen/network_unix_chg
unix network little change proposal. socket port fits within unsigned…
2021-04-07 09:16:41 +02:00
Denis Pauk
68a0605582 sw: support full size retextured it_pic 2021-04-07 00:03:04 +03:00
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