Commit Graph

1717 Commits

Author SHA1 Message Date
Ivan Avdeev
0028899eac rtx: add better hashes
from: Mark Jarzynski and Marc Olano, Hash Functions for GPU Rendering, Journal of Computer Graphics Techniques (JCGT), vol. 9, no. 3, 21-38, 2020
http://www.jcgt.org/published/0009/03/02/
2021-08-04 19:32:56 -07:00
Ivan Avdeev
378c1e52e0 enable anisotropy only for rtx
this doesn't make any visible impact for rtx rendering. but does affect non-rtx rendering when running with rtx enabled (kekw)
2021-08-04 18:56:11 -07:00
Ivan Avdeev
94ac51a527 rtx: sample mip levels based on ray cone width
this is mostly copied from ray tracing gems 2 chapter 7 (Texture Coordinate Gradients Estimation for Ray Cones, by Wessam Bahnassi).
There's a weird bit about radians vs degrees. We'll figure it out later when the book becomes available.
2021-08-04 18:36:53 -07:00
Ivan Avdeev
71bf85d4f8 fix mips generation 2021-08-04 17:44:21 -07:00
Ivan Avdeev
dbd5a7a2e4 add texture mipmaps
they're still corrupted a bit
2021-08-02 10:55:26 -07:00
Ivan Avdeev
074fdf84b4 update todo 2021-07-31 12:43:35 -07:00
Ivan Avdeev
fc2c7185df rtx: add basic transparency and reflections
this is very proof-of-concept quality. it should be definitely done some other way

e.g. we should control reflectivity and transparency differently (and not together)
and they should be based on texture ids, not on render_mode

it's also unfortunate that transparency required a lot of bounces. we should probably control transparency bounces separately from light bounces.
alternatively, transparency effects (beams, sprites) should be done with custom intersection shaders and not based on transparent geometry
2021-07-31 12:35:59 -07:00
Ivan Avdeev
84b696ca7a
Merge pull request #20 from w23/amd_ray_tracing_fixes
Ray tracing fixes for AMD GPUs, fix #13
2021-07-17 12:57:00 -07:00
Ivan Avdeev
1d94f5da00 rtx: fix c90 compilation errors 2021-07-17 12:40:26 -07:00
Ivan Avdeev
c2729c9d63 rtx: fix reflections; update todo 2021-07-17 12:37:12 -07:00
Ivan Avdeev
eeb83bd99f rtx: dont trace ray when there's no geometry
We used to dispatch rays anyway even if there was no models to render and tlas wasn't built (which is the case for the first few frames).
This ended up crashing AMD gpu when using some (but not all) variants of rgen shaders.

With this change we'll check for whether there are any models to render, and if there are none, then we'll just clear frame to black.

This change also refactors ray tracing a bit.
2021-07-17 11:45:28 -07:00
Ivan Avdeev
316e77df78 rtx: add alpha mask transparency 2021-07-14 11:54:21 -07:00
Ivan Avdeev
d7fc697de4 rtx: HACK: workaround for amd
for some reason amd will lose device whenever the first rendered frame has multiple push-constant-depndent bounces and break on line 138 in rgen.
when both break is commented out and bounces are compile-time constant, it will work just fine.
moreover, if we start xash with the workaround shader, get it to draw a few frames, and only then bring back both break and pc-bounces, recompile and reload shader, it will run just fine. not losing device and all.

wtf
2021-07-14 11:49:37 -07:00
Ivan Avdeev
59361f91cb rtx: remove old compute shader 2021-07-14 10:15:56 -07:00
Ivan Avdeev
4fa079b05a rtx: restore multiple bounces and dlights 2021-07-14 10:10:20 -07:00
Ivan Avdeev
38c636cad4 rtx: make freeman drunk again 2021-07-14 09:48:32 -07:00
Ivan Avdeev
04d92508ae rtx: bring back random sampling lights 2021-07-14 09:43:36 -07:00
Ivan Avdeev
caa284f835 rtx: add shadows 2021-07-12 10:59:52 -07:00
Ivan Avdeev
7d6ee9623b rtx: add lighting w/o shadows 2021-07-12 10:42:20 -07:00
Ivan Avdeev
d1fe897966 Merge remote-tracking branch 'origin/vulkan' into amd_ray_tracing_fixes 2021-07-12 09:45:26 -07:00
Ivan Avdeev
b639aa8bc2
Merge pull request #22 from upstream master w/ github actions
- merge latest upstream master that includes moving from travis to github actions
- implement some vulkan-specific ci build fixes
- disable motomagx as it doesn't build at all and breaks merge checks (does not seem to be vulkan-specific)

this has not been checked functionally yet
2021-07-12 09:38:06 -07:00
Ivan Avdeev
def7fac402 rtx: fixup build after merge 2021-07-12 09:23:50 -07:00
Ivan Avdeev
a4fd1c1a42 disable motomagx until upstream fixes (or removes) it 2021-07-11 15:54:30 -07:00
Ivan Avdeev
02da9652bf make vulkan deps conditional at configure time 2021-07-11 15:47:51 -07:00
Ivan Avdeev
76d381388b improve vulkan api definitions 2021-07-11 14:07:25 -07:00
Ivan Avdeev
300bd1795c add vulkan-sdk to gha deps 2021-07-11 10:52:14 -07:00
Ivan Avdeev
e5f82b1cc3 add VULKAN_SDK_VERSION to github actions 2021-07-11 10:43:47 -07:00
Ivan Avdeev
552e902a03 Merge remote-tracking branch 'upstream/master' into merge-master 2021-07-11 10:33:23 -07:00
Ivan Avdeev
64469b1a3d fix ci build 2021-07-10 12:42:47 -07:00
Ivan Avdeev
a46b0dffdc rtx: enable textures
- use non-uniform indexing because AMD requires it (which is technically correct by spec, it's just nvidia that supports it transparently)
- disable immutable samplers, as that breaks filtering on amd for some reason (TODO)
2021-07-10 12:37:14 -07:00
Ivan Avdeev
dd6fe33a16 add ghetto device selection, allow skipping first device
device selection should be performed by vulkan physical device index, but we have no way to read numeric cmdline arguments from xash
see #21
2021-07-10 11:34:59 -07:00
Ivan Avdeev
d66ee6b3ce rtx: fix hit/miss shader order
also move geometries offsets to ranges struct instead of adding offsets to buffers addresses
2021-07-10 11:06:55 -07:00
SNMetamorph
09d647182d engine: net_encode: equality comparisions replaced with Q_equal macros 2021-07-09 14:57:49 +03:00
SNMetamorph
af3c0686c5 engine: mathlib: added Q_equal macros 2021-07-09 14:57:49 +03:00
SNMetamorph
8b76ab93fb engine: net_encode: made delta more GoldSrc consistant 2021-07-09 14:57:49 +03:00
Vladimir
9ffc02b6e9
ref_gl: gl_triapi: fixed culling enum in TriCullFace (#522) 2021-07-09 14:55:31 +03:00
5d307d603c Remove clang-format 2021-07-09 14:40:24 +03:00
Ivan Avdeev
9623d6ef31 rtx: add stub closest hit and miss shaders to rt pipeline 2021-07-07 12:02:12 -07:00
Ivan Avdeev
2ca2e2058e fix compile warnings for CI, part 2 2021-07-06 12:54:45 -07:00
Ivan Avdeev
c51d593679 rtx: get ray tracing pipeline to draw at least something
on amd gpus it won't draw anything at all unless you have the entire ray tracing pipeline set up fully and correctly:
- have at least rgen, rmiss and rchit shaders
- set up shader groups to reference them
- set up sbt to reference shader groups
it is not enough to just have a single rgen shader operating like a compute shader. amd will have a shader preamble that checks for something and exit early w/o actually running any shader code you wrote

meh
2021-07-06 11:28:24 -07:00
Ivan Avdeev
56007bdb1d rtx: don't forget to destroy shaders 2021-07-06 09:42:16 -07:00
Ivan Avdeev
cdefb7a50a fix compiler warnings for CI 2021-07-06 09:41:48 -07:00
Ivan Avdeev
23697d75eb Merge branch 'vulkan' into amd_ray_tracing_fixes 2021-07-05 14:50:19 -07:00
Ivan Avdeev
364b46ea87 [WIP] rtx: first build with ray tracing pipeline and black screen 2021-07-05 13:24:57 -07:00
Ivan Avdeev
34359e2f75 rtx: start splitting ray tracing into functional modules
move model management into vk_ray_model
2021-07-05 10:59:14 -07:00
Ivan Avdeev
c662695056 rtx: add runtime toggle between ray tracing and traditional renderer
new command is `vk_rtx_toggle`
2021-07-04 13:17:03 -07:00
Ivan Avdeev
750d3b7608 rtx: fix brush models being invisible
An incorrect range of used vertices was pased into `VkAccelerationStructureGeometryTrianglesDataKHR`.
 `maxVertex` was being set to a count of vertices per geometry, not a maximum used vertex number.

The fix is to track `vertex_offset` of the first used vertex, which makes `maxVertex` correct.
2021-07-04 12:48:32 -07:00
Ivan Avdeev
2034acbe76 rtx: fix build_ranges incorrect pointer indirection 2021-07-04 12:05:21 -07:00
Ivan Avdeev
3ed4d84653 rtx: add runtime toggle between ray tracing and traditional renderer
new command is `vk_rtx_toggle`
2021-07-04 11:18:28 -07:00
affc64c6da gha: don't install unneeded multilib packages for amd64 2021-07-03 23:18:14 +03:00