Commit Graph

660 Commits

Author SHA1 Message Date
Ivan 'provod' Avdeev
d34bf3aa8d rt: fix studio models colorful flickering 2022-09-03 11:25:33 -07:00
Ivan 'provod' Avdeev
df09a4e637 rt: move AS management from vk_rtx to vk_ray_accel
no functional changes yet.
2022-08-27 12:30:53 -07:00
Ivan 'provod' Avdeev
275417772e rt: move image-related funcs from vk_rtx to vk_image 2022-08-27 11:39:29 -07:00
Ivan 'provod' Avdeev
77b05af59a rt: don't forget to fill kusochki with static geometry data on update
this also makes dynamic model gpu crashes more salient, investigating
2022-08-27 11:25:09 -07:00
Ivan 'provod' Avdeev
9a335a1e56 (wip) rt: add uploading kusochki on every frame
disabled due to severe glitches
2022-08-20 13:56:29 -07:00
Ivan 'provod' Avdeev
501c3d15ad rt: use staging to upload kusochki
fixes more weird square glitches
breaks animated textures, colors and conveyors
2022-08-20 12:13:03 -07:00
Ivan 'provod' Avdeev
7f3dca0993 rt: use proper staging for light uploading
also don't upload clusters as we're thinking about sunsetting them in their current form.
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
41e5757c0a FIXME: rt: try disabling light grid entirely
this skips 40ms+ grid upload cost, and seems generally just a few ms more costly than sampling clusters.
however, there are sync glitches for reasons unknown.
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
188d02c4aa rt: fix shader reloading validation crashes
wait for gpu to become idle before trying to recreate pipelines
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
c53f22d028 rt: extract bit array 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
9f6fa0a8cb rt: make lights data more private 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
0f0a58d1aa rt: add debug markers to see that uploading lights takes >35ms 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
1d2e763baf rt: add staging buffer for light grid, fix #368 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
1d25b718dd rt: split light metadata/grid bindings back in shader
for some reason joining them leads to "invalid spirv" validation errors (and broken lights).
split the bindings back making shaders essentially unchanged, while still keeping a single physical buffer
2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
01d4764cf4 vk: do not compile dumbspter 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
1b834f37be rt: join metadata and grid buffers together (breaks validation) 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
608bf020c4 rt: move light metadata uploading to vk_light.c 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
1f741a48a3 rt: hide emissive_textures info 2022-08-15 09:31:13 -07:00
Ivan 'provod' Avdeev
a5efa71ecb rt: clean vk_light a bit 2022-08-15 09:31:13 -07:00
Ivan Avdeev
202f2b8462 rt: print material load stats 2022-08-13 14:17:43 -07:00
Ivan Avdeev
8ee68935d0 rt: do not print each material texture lookup 2022-08-13 14:17:43 -07:00
NightFox
91df117998
new material paths (#382) 2022-08-12 10:27:41 -07:00
Ivan Avdeev
85c55a7fc9 update after merge, make it build and run with rasterizer
have not checked ray tracing, or playing longer than a couple of minutes
2022-08-08 00:23:38 -07:00
Ivan 'provod' Avdeev
0d0241d088 vk: recreate swapchain on all errors except fatal
Unless we know the error is unrecoverable, try to recreate swapchain anyway.
2022-07-23 14:17:20 -07:00
Ivan 'provod' Avdeev
8291efd08b rt: fix polygon light clusters on missing pvs 2022-07-23 13:39:37 -07:00
Ivan 'provod' Avdeev
af594203f8 rt: fix point light cluster crash on missing pvs
will still crash for polygon lights
2022-07-23 13:39:37 -07:00
Ivan 'provod' Avdeev
9b76f3acb4 rt: fix missing moving polygon lights 2022-07-23 12:06:43 -07:00
NightFox
8baf34768a correct environment light power 2022-07-23 11:34:57 -07:00
Ivan 'provod' Avdeev
ceea3a614e vk: do not forget to upload staging without rays 2022-07-23 11:33:15 -07:00
Ivan 'provod' Avdeev
aaab09fd38 vk: remove old ring buffer helper 2022-07-15 00:50:29 -07:00
Ivan Avdeev
394587adbf vk: remove geometry print stats func 2022-07-09 13:37:09 -07:00
Ivan 'provod' Avdeev
118bdd9985 vk: use debuffer for geometry mem management 2022-07-09 13:37:09 -07:00
Ivan 'provod' Avdeev
a2b083300c vk: move geometry buffer handling to separate files 2022-07-09 13:37:09 -07:00
Ivan 'provod' Avdeev
da97f664d7 vk: recreate swapchain on exclusive mode lost, fix #365 2022-07-09 12:47:45 -07:00
Ivan 'provod' Avdeev
23ad2096a9 rt: remove old single-pipeline raytracer 2022-07-09 11:54:47 -07:00
Ivan 'provod' Avdeev
0fcd05554a implement debuffer on top of flipping buffer 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
b634d6251e replace debuffer with flipping one where possible 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
c299ac9ccd do not overwrite ubo buffers being used 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
f8ea93656f do not overwrite staging data until we know it's been uploaded 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
be20ae2fb0 vk: coalesce same buffer dest staging regions uploading 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
f390591647 vk: fix texture mips uploading 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
88f8aabf8e vk: fix linux build 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
1d48982e7b vk: refactor staging api a bit 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
eda34ee9db vk: explicitly synchronize adjacent command buffer submissions 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
ebcee75c0b vk: silence offset prints in render 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
4ef261a0b0 vk: print devmem allocation failure reason 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
09112bedef vk: slightly refactor s/2d/overlay/ 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
b0f1b60f62 vk: supposedly fix menu glitches
had to ringify 2d buffer too
2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
dc129475bd vk: fix synchronization on resize/swapchain recreation 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
2c667bdc60 fix func declaration 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
31c35a4c82 rt: ringify tlas geom buffer 2022-07-09 10:41:59 -07:00
Ivan 'provod' Avdeev
aca2849c5a rt: make kusochki use double-ended buffers 2022-07-09 10:41:59 -07:00
NightFox
4809fc5d02 more correct base_color processing 2022-05-30 18:04:59 -07:00
Ivan 'provod' Avdeev
d2bb972930 rt: assoc dyn polylights w/ render model
fix #355
2022-05-27 11:28:45 -07:00
NightFox
4e1982815c correct payload.emissive.rgb 2022-05-27 11:28:26 -07:00
NightFox
c713c7fc59 correct lighting and gamma-correction improvement 2022-05-27 11:28:26 -07:00
Ivan 'provod' Avdeev
cb427d0839 vk: ring-based dynamic geometry buf alloc
- Clear split between static and dynamic geometry within the same buffer
- Store previous frame geometry data longer
- Use simpler ring buffer for allocation
- Add waf unit tests for alolcator

Known issues:
- ray tracing still glitches a lot
2022-05-14 14:00:13 -07:00
Ivan 'provod' Avdeev
fed12884dc vk: ne sri v log 2022-05-04 09:55:13 -07:00
Ivan 'provod' Avdeev
608aa4137d vk: use staging for uploading geometry 2022-05-04 09:23:37 -07:00
Ivan 'provod' Avdeev
c5012328d6 vk: pick device memory slot based on type index 2022-04-30 00:28:52 -07:00
Ivan 'provod' Avdeev
a3ff75b48f vk: draft staging api, use it for textures 2022-04-28 00:16:25 -07:00
Ivan 'provod' Avdeev
573d006c4a Merge remote-tracking branch 'origin/vulkan' into better-sampling-passes-parallel 2022-03-21 12:00:55 -07:00
NightFox
5342c92019
Rads and patches, rev1 (#328)
Обновлённые рады и патчи карт для лучей. Куча ненужных источников выкинута, местами освещение переделано в пользу реализма. Попытка вытянуть освещение через доступные светящиеся поверхности. Список радов и патчей будет потихоньку обновляться. Это первая ревизия, во второй будут исправляться пропущенные ошибки и коррекция освещения относительно новых материалов.

Для патчей исправлен масштаб яркости у светящихся текстур.

Также теперь рад файлы лежат в data/valve/maps/ а патчи в data/valve/luchiki/maps/. Теперь возможно добавлять другие моды.
2022-03-21 12:00:02 -07:00
Ivan 'provod' Avdeev
31e15e40c6 vk: print allocations only under -vkdebugmem 2022-02-22 21:46:44 -08:00
Ivan 'provod' Avdeev
00652f0e7d rt: fix pcie bus thrashing; add profiler scopes
turns out it's not cool to read color from on-gpu kusok data, modify it, and write back
2022-02-21 23:46:50 -08:00
Ivan 'provod' Avdeev
3ebdeb876e differentiate debug markers vs validation layers
Split concerns:
- validation layers help with correctness, but not performance (*generally)
- debug markers help with profiling (and ony sometimes with correctness too)

These were conflated into a single `-vkdebug` arg.
And sometimes you need only markers and no validation for performance.
(Validation is like 30% slower)

Make it so that:
- `-vkdebug` enables only debug names and time markers, but not validation
- `-vkvalidate` enables validation layers and also debug markers
2022-02-20 23:40:48 -08:00
Ivan 'provod' Avdeev
e35e2aa043 rt: allocate as many desc sets as frames in flight
still not fully correct or robust, but passes validation

missing correctness things:
- Nx light data buffers
- Nx dynamic model buffers
- Nx dynamic BLASes

quite likely will also need (depending on update strategy, direct vs upload):
- Nx light data buffers
- Nx UBOs

probably fine since frames don't really overlap:
- single TLAS
2022-02-20 23:30:23 -08:00
Ivan 'provod' Avdeev
955f36a423 Merge branch 'parallel-frames' into better-sampling-passes-parallel
includes a few initial compilation fixes for parallel ray tracing. does not work yet
2022-02-20 16:00:33 -08:00
Ivan Avdeev
22917938d9 vk: initial draft of parallel frames
adds multiple command buffers and bits of synchronization.

is not correct at all:
- no depth buffer barrier
- no ubo slots in render
- no proper render memory management
- no ray tracing support whatsoever
- ... etc
2022-02-10 22:55:33 -08:00
Ivan Avdeev
668d3fb81a rt: add shadows for environment lights 2022-02-09 21:57:55 -08:00
Ivan Avdeev
152cca3a47 rt: select random triangle to sample based on solid angle
looks correct enough(ish?)

perf (c1a0):
direct poly light 4.4ms, v85(96), o10/16 (-6v +1o)
2022-02-08 23:04:00 -08:00
Ivan Avdeev
e2694ecf36 rt: try single triangle solid angle sampling
1. it looks way better
2. still missing other triangles

perf (c1a0):
4.2ms, v87(96), o10/16 (-6v +1o)
2022-02-08 22:26:39 -08:00
Ivan Avdeev
b68dcf81a1
vk: move big enum to string tables to dedicated source file (#345) 2022-02-06 23:16:54 -08:00
Ivan Avdeev
113039a929 vk: print surface formats and colorspaces names 2022-02-06 09:42:03 -08:00
Ivan Avdeev
8d8abb7e29 vk: synchronize screenshots with swapchain, fix #192 2022-02-06 09:42:03 -08:00
Ivan Avdeev
970089516c vk: move swapchain out from framectl 2022-02-06 09:42:03 -08:00
Ivan Avdeev
dd1f58d0b7 rt: simplify polygon light sampling
do stupid first triangle sampling, w/ contrib estimation area * dot(LP) / dist^2

4.7ms all poly lights, occupancy 10, vgpr 86(96)
2022-02-04 18:38:36 -08:00
Ivan Avdeev
4bb44c1569 rt: add skybox support 2022-02-02 21:47:40 -08:00
Ivan Avdeev
3a6bed136a rt: add moving polygon lights support 2022-02-02 21:32:10 -08:00
Ivan Avdeev
f9bf0aadd0 rt: add emissive color 2022-02-02 19:04:45 -08:00
Ivan Avdeev
6b381c8970 rt: flatten pass bindings a bit 2022-01-31 20:50:39 -08:00
Ivan Avdeev
b6c96ddebd rt: automate image barriers for passes 2022-01-31 20:40:41 -08:00
Ivan Avdeev
c2d8ecbf79 rt: make denoiser to be just another pass
that requires also supporting compute shaders as passes.
2022-01-30 22:24:55 -08:00
Ivan Avdeev
950b1ff6cf rt: tie pass binding to resource semantic
this allows removing pass write function and moves us closer to
auto-solving pass dependencies
2022-01-30 20:49:37 -08:00
Ivan Avdeev
6c6e6e191d rt: make array of resources
this moves one step closer to fully dynamic resources and automatic
barriers.
next steps would be:
- passes declaring their bindings at creation time
- resources automatically preparing values based on that declaration
- automatic barriers
- single descriptor pool stored at resources (aware of frames in flight,
  etc)
- parsing shaders to generate binding declaration
2022-01-28 22:58:07 -08:00
Ivan Avdeev
61ecda02f2 rt: add output material channel to primary ray
perf (--//--)
- total ray time: 14.5ms
- primary: 0.2ms v:81/96 s:60/128 o:10/16 (-6v +1o)
- light poly: 13.4ms v:256/256 s:98/128 o:4/16 (-28v +1o)
- light point: 0.8ms v:87/96 s:68/128 o:10/16 (-6v +1o)
2022-01-27 20:04:18 -08:00
Ivan Avdeev
90fa6161ac rt: add parallel direct point light pass
(look how easy that was! yay passes!
... still need to do spir-v parsing to extract bindings though)

perf (c1a0 lobby, 720p, 6900XT)
- total ray tracing time: 15.2ms
- primary: 0.7ms v:80/80 s:60/128 lds:2048 o:12/16 (-4v +1o)
- dir poly: 13.8ms v:256/256 s:98/128 lds:2048 o:4/16 (-28v +1o)
- dir point: 0.9ms v:85/96 s:68/128 lds:2048 o:10/16 (-6v +1o)

dir point and poly are not synchronized and overlap. but poly takes most
of the time, and point can only ramp up gradually at the very tail of
poly.
2022-01-27 19:14:56 -08:00
Ivan Avdeev
c3a7a01620 rt: passify light direct poly 2022-01-27 17:47:00 -08:00
Ivan Avdeev
b3c69851dc rt: draft a universal pass sketch
allows easily creating arbitrary ray tracing pipelines out of sets of
bindings and shaders

what's missing:
- optimal handling of duplicate shaders
- reading bindings from shaders (parse SPIR-V) instead of specifying in
  code
- automatic resource creation according to binding definitions
- automatic barriers according to bindings interface
2022-01-26 23:52:19 -08:00
Ivan Avdeev
e384f2e1f7 rt: move shader binding defs to interop 2022-01-22 19:13:08 -08:00
Ivan Avdeev
5d8e15bfac rt: sample all poly lights more correctly 2022-01-22 18:54:40 -08:00
Ivan Avdeev
21ff19be83 rt: convert denoiser to use resources 2022-01-22 18:54:11 -08:00
Ivan Avdeev
202eccb3d1 rt: cosolidate pass args in a central structure 2022-01-21 20:55:43 -08:00
Ivan Avdeev
e295f39c2b rt: fix for X macro redefinition 2022-01-21 09:52:16 -08:00
Ivan Avdeev
7b7d08a944 rt: make primary ray use ray pipeline framework 2022-01-20 20:21:06 -08:00
Ivan Avdeev
70eb2fed6f rt: read tangents and normal map 2022-01-20 20:09:21 -08:00
Ivan Avdeev
5b4a22e97e rt: remove ray_query extension dependency 2022-01-20 20:08:46 -08:00
Ivan Avdeev
23b4bdd4f8 rt: consolidate specialization data 2022-01-20 20:04:43 -08:00
Ivan Avdeev
94b4066d8d rt: move ray pipeline to vk_pipeline 2022-01-20 18:48:01 -08:00
Ivan Avdeev
63358be4a3 rt: replace ray query with rt pipeline for direct light
it stays roughly the same, vgpr 256, etc.
perf is a tiny bit better (12ms vs 14ms for all poly lights in c1a0
lobby /w shadows), but it may be sampling artifact
2022-01-20 00:06:38 -08:00