Commit graph

3070 commits

Author SHA1 Message Date
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
Denis Pauk
ba173e68b5 rearrange init functions 2021-02-06 22:42:15 +02:00
Denis Pauk
0b79fa99ed #660: convert wrong modeltype to warning 2021-02-03 00:08:10 +02:00
Denis Pauk
1882fc2dbc #661: Use corrected resolution in fullscreen=1 2021-02-01 23:02:51 +02:00
Yamagi
06d183b6db
Merge pull request #655 from 0lvin/stereo_sound
Support of wav stereo sound
2021-01-31 12:18:26 +01:00
Ricardo Garcia
8599cab275 Load framebuffer contents correctly for MSAA
The contents of the previous drawn frame, used to mask geometry glitches
due to geometry sometimes not being watertight, was not being correctly
loaded for MSAA cases.

When MSAA is not used, the single-sample attachment needs to be loaded
and stored. With MSAA enabled, it's the multisample attachment the one
needing to be loaded and stored.
2021-01-31 10:54:03 +01:00
Ricardo Garcia
9661ce0ba0 Make scaled down view borders work with MSAA
The pipeline used to draw a texture quad was only created compatible
with the RP_UI render pass, which has a single-sample color attachment.
This made the pipeline work when MSAA was disabled, but it did not work
properly with it enabled.

To fix the issue, create a set of pipelines, instead of a single one,
with compatibility with the different types of render passes, as the
pipeline is used for both the scaled down view borders as well as UI
elements in the third render pass.
2021-01-31 10:38:59 +01:00
Yamagi
9a17eb9ac3 Make limiting power screen sounds to 16 optional.
This was added in e3e5bd1 as a work around for some openal-soft bug.
When too many audio samples got played at the same time, the global
volume dropped. This was fixed in openal-soft 0.19.0, released more
than two years ago. We're keeping the work around, because some
distros may still ship with buggy openal-soft versions and some
players may like the changed behavior. It's disabled by default.
2021-01-30 13:51:02 +01:00
Denis Pauk
6f045f71af sound: use current func name in Com_Error 2021-01-27 22:38:31 +02:00
Denis Pauk
f73bcf5fbd cppcheck fixes
src/client/refresh/soft/sw_main.c:
   1512 (style) Variable 'err' is assigned a value that is never used. [unreadVariable]

src/client/refresh/vk/vk_rmain.c:
  1023 (style) Suspicious calculation. Please use parentheses to clarify the code. The code ''a&b?c:d'' should be written as either ''(a&b)?c:d'' or ''a&(b?c:d)''. [clarifyCalculation]

src/client/sound/ogg.c:
  335 (style,inconclusive) Function 'OGG_PlayTrack' argument 1 names different: declaration 'track' definition 'trackNo'. [funcArgNamesDifferent]
  212 (style) Local variable 'gogTrack' shadows outer variable [shadowVariable]

src/client/sound/sdl.c:
  179 (style) The scope of the variable 'i' can be reduced.
  180 (style) The scope of the variable 'lpos' can be reduced.
  181 (style) The scope of the variable 'ls_paintedtime' can be reduced.
  182 (style) The scope of the variable 'out_idx' can be reduced.
  183 (style) The scope of the variable 'count' can be reduced.
  185 (style) The scope of the variable 'p' can be reduced.
  186 (style) The scope of the variable 'snd_linear_count' can be reduced.
  187 (style) The scope of the variable 'step' can be reduced.
  189 (style) The scope of the variable 'snd_out' can be reduced.
  330 (style) The scope of the variable 'data' can be reduced.
  368 (style) The scope of the variable 'data' can be reduced.
  369 (style) The scope of the variable 'left' can be reduced.
  369 (style) The scope of the variable 'right' can be reduced.
  401 (style) The scope of the variable 'end' can be reduced.
  529 (style) The scope of the variable 's' can be reduced.
  799 (style) The scope of the variable 'i' can be reduced.
  874 (style) The scope of the variable 'scale' can be reduced.
  910 (style) The scope of the variable 'srcsample' can be reduced.
  1093 (style) The scope of the variable 'total' can be reduced.
  196 (style) Local variable 'i' shadows outer variable [shadowVariable]
  197 (style) Local variable 'count' shadows outer variable [shadowVariable]

src/client/sound/sound.c:
  450 (style) The scope of the variable 'maleFilename' can be reduced.
  980 (style) The scope of the variable 'num' can be reduced.
  1085 (style) The scope of the variable 'sfx' can be reduced.
  423 (style,inconclusive) Function 'S_RegisterSound' argument 1 names different: declaration 'sample' definition 'name'. [funcArgNamesDifferent]
  909 (style,inconclusive) Function 'S_StartLocalSound' argument 1 names different: declaration 's' definition 'sound'. [funcArgNamesDifferent]
  1048 (style,inconclusive) Function 'S_Update' argument 2 names different: declaration 'v_forward' definition 'forward'. [funcArgNamesDifferent]
  1048 (style,inconclusive) Function 'S_Update' argument 3 names different: declaration 'v_right' definition 'right'. [funcArgNamesDifferent]
  1048 (style,inconclusive) Function 'S_Update' argument 4 names different: declaration 'v_up' definition 'up'. [funcArgNamesDifferent]
2021-01-27 22:38:31 +02:00
Denis Pauk
8c69684e8d client/sound: make local symbols static 2021-01-27 22:38:31 +02:00
Denis Pauk
c3e76236ba Support stereo effects #641
Based on:
  https://github.com/mczero80/KMQuake2/blob/4c23519/client/snd_mem.c#L324
  https://github.com/mczero80/KMQuake2/blob/4c23519/client/snd_mem.c#L236
2021-01-27 22:38:31 +02:00
Yamagi
957c11513c
Merge pull request #657 from rg3/vulkan_fullscreen_fixes
Fullscreen Vulkan fixes
2021-01-27 08:38:03 +01:00
Yamagi
506ccfa309
Merge pull request #656 from rg3/msaa_samples_text_fix
Fix text indicating MSAA samples for Vulkan
2021-01-27 07:15:32 +01:00
Ricardo Garcia
e85f266a84 Restore reduced view textured borders
This commit removes the previous R_CleanupBorders hack and fixes
textured border drawing, so borders are correctly drawn in the right
place and are not taken into account when applying the underwater
effect.
2021-01-24 23:47:21 +01:00
Ricardo Garcia
741f64604c Remove duplicate comment 2021-01-24 23:25:02 +01:00
Ricardo Garcia
abda667781 Fix screenshots so they capture the center of the framebuffer 2021-01-24 23:19:20 +01:00
Ricardo Garcia
fe13cfbbb7 Avoid frame cleaning hack in refdef changes
With the fix from 76f56458, we no longer need to clean the frame when
the world view changes sizes.
2021-01-24 22:18:41 +01:00
Ricardo Garcia
76f56458b1 Fix water warp edge distortion when keeping resolution
With vid_fullscreen 1 and a scaled down viewport, the water distortion
effect produced waves in the viewport edge. This commit fixes those.
2021-01-24 13:32:45 +01:00
Ricardo Garcia
5fcfcd56b3 Fullscreen Vulkan fixes
This commit includes the following changes:

* When vid_fullscreen is 1, the game is now drawn centered in the
  screen instead of the top left corner, by modifying the viewport and
  scissor when drawing the world warp and UI render passes.

* When vid_fullscreen is 1, the world view no longer has an incorrect
  size and/or aspect ratio. This was due to the world warp and UI
  render passes sampling from the whole color buffer instead of the
  restricted render area. To fix this, the postprocessing and world warp
  shaders now use unnormalized coordinates, corrected with the frame
  offset, and sample directly from the appropriate texels.

* The game no longer outputs pixels which have not been written to,
  which are usually displayed black but may come out with undefined
  colors. For this, some output color attachments are cleared before
  drawing the final elements in the frame.
2021-01-24 11:52:30 +01:00
Ricardo Garcia
bb827cad8c Fix text indicating MSAA samples for Vulkan 2021-01-23 09:56:24 +01:00
Yamagi
449776d3f6
Merge pull request #654 from 0lvin/ref_vk
Sync variable names for msaa, retexturing and anisotropic filtering
2021-01-22 12:27:18 +01:00
Yamagi
0488dcd4e9 Add a replacement chasing the cl_anglekicks -> cl_kickangles rename. 2021-01-22 12:22:47 +01:00
Yamagi
f322b28fa5
Merge pull request #653 from Calinou/rename-anglekicks-cvar
Rename `cl_anglekicks` to `cl_kickangles` for consistency with Q2PRO
2021-01-22 12:21:50 +01:00
Denis Pauk
46c24d4d18 Sync variable names for msaa, retexturing and anisotropic filtering #646 2021-01-19 21:39:44 +02:00
Denis Pauk
6a89f30768 Show message about anisotropy for selected device 2021-01-19 21:39:34 +02:00
Denis Pauk
b9d4549a9b Add support r_customwidth/r_customheight in ref_vk #652 2021-01-19 21:39:25 +02:00
Denis Pauk
000c72fecc Rework vk_msaa to use number of samples #646 2021-01-19 21:39:13 +02:00
Hugo Locurcio
08d59ee8e8
Rename cl_anglekicks to cl_kickangles for consistency with Q2PRO 2021-01-18 04:41:57 +01:00
Yamagi
2fae58d56b Implement singleplayer in the dedicated server.
When set to `1`, both `deathmatch` and `coop` are forced to `0`.
`maxclients` is forced to `1`. This makes it possible to play single
player campaigns over the dedicated server.

Closes #614.
2021-01-17 11:07:46 +01:00
Yamagi
f01998896f Hide the fix for sky surfaces missused for indoor lighting begind cvar.
All renderers had the fix, but it was only optional in the GL renderers.
And there it was missimplemented, cvars must be defined in the renderers
main() function. Otherwise they aren't available at startup.

Rename gl_fixsurfsky to r_fixsurfsky, implement it for all renderers and
enable it by default.
2021-01-17 10:25:09 +01:00
Yamagi
531cbdcdae Mention the Vulkan renderer on all appropriate places. 2021-01-17 10:05:04 +01:00
Yamagi
a9914efde7 Implement vk_underwater, make the underwater warp effect optional.
This was requested in #505.
2021-01-13 21:46:15 +01:00
Yamagi
8a54e49f61
Merge pull request #643 from 0lvin/ref_vk
Enable depthWriteEnable for particles
2021-01-13 18:27:17 +01:00
Yamagi
61766edbe1
Merge pull request #644 from rg3/skybox-fixes
Skybox fixes
2021-01-13 18:22:44 +01:00
Yamagi
d745e16523
Merge pull request #642 from DanielGibson/fix-lm-glitch
Makefile: Fix architecture detection on Windows
2021-01-13 18:11:03 +01:00
Ricardo Garcia
8142898b56 Fix black pixels along skybox edges in Vulkan
Due to the skybox geometry not always being watertight, it's sometimes
possible to see instances of isolated black pixels flickering along
skybox edges. This happens when the sampling coordinates for the given
pixel fall outside any triangle in the skybox due to the previous
problem.

These pixels are usually visible when MSAA is not used and pixels are
big enough on the screen, like when using lower screen resolutions or
large vk_pixel_size values. If MSAA is used, normally only a few of the
samples fall outside any triangle and the problem is masked a bit, being
harder to spot.

Instead of fixing the skybox clipping routines, which may be
complicated, this commit simply preserves color buffer contents between
frames. If any pixel ends up without coverage, its color will be taken
from a previous draw a few frames before, depending on the swapchain
size. This is usually more than enough to completely mask the problem
visually.
2021-01-12 23:33:55 +01:00
Ricardo Garcia
aa2baedd97 Fix skybox edges being visible in Vulkan
Skybox edges are sometimes visible in Vulkan, specially in lower screen
resolutions or when vk_pixel_size is used to the same effect.

To avoid this problem, draw the skybox using CLAMP_TO_EDGE addressing
mode in samplers. In order to do that, the number of texture samplers is
doubled and a second set of samplers with the new addressing mode are
created, and used only when drawing the skybox.
2021-01-12 23:33:55 +01:00