Commit Graph

2216 Commits

Author SHA1 Message Date
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
Ivan Avdeev
c73f3d0dab rt: sample all polygon light sources in cluster 2022-01-19 20:23:38 -08:00
Ivan Avdeev
460b839a64 rt: add debug labels to command buffer 2022-01-18 22:29:42 -08:00
Ivan Avdeev
1ad24b657b Merge remote-tracking branch 'origin/vulkan' into better-sampling-passes 2022-01-17 23:04:06 -08:00
Ivan Avdeev
59ec44ca34 rt: align SBT buffer allocations 2022-01-17 22:06:30 -08:00
Ivan 'provod' Avdeev
951d382eb6 vk: improve memory allocation logging
print region names, requirements, etc.
also decrease default vulkan device memory allocation size to 64Mb
decrease max vertices to 512k
2022-01-17 22:06:30 -08:00
Ivan Avdeev
a5f22ca11d vk: add verbose memory allocation logs 2022-01-17 22:06:30 -08:00
Ivan Avdeev
24cb0aebfb vk: add a simple block dlinked list based allocator for devmem 2022-01-17 22:06:30 -08:00
Ivan Avdeev
bba8b87ada vk: improve VkDeviceMemory allocation
Allocate device memory in big 128Mb chunks. Sub-allocate buffers, images
and other resources within those chunks.

This uses a dumb grow-only bump allocator for now. Will not work for
more than a couple maps.
2022-01-17 22:06:30 -08:00
Ivan Avdeev
8f7f0d5c8e vk: split devmem into a separate module
prepare for a better device memory allocator
2022-01-17 22:06:30 -08:00
NightFox
95ce46753e fix tr.blend (fade fx) for sprites 2022-01-17 21:12:57 -08:00
Ivan 'provod' Avdeev
5d90e8389e rt: fix validation woes on windows 2022-01-17 21:12:14 -08:00
Ivan Avdeev
815866b353 rt: add per-frame random seed to randomize sampling 2022-01-15 23:15:29 -08:00
Ivan Avdeev
663306f4e1 rt: clusterize the new polygon lights
known issues:
- visible cluster boundaries which affect sampling outcomes
  (essentially clusters act like very coarse shadows, and that's visible)

moving brush models are not supported yet, affects perf measurements
2022-01-15 23:12:12 -08:00
Ivan Avdeev
f7e42e5ae0 rt: add shadows for polylights
also change:
- pass plane equation instead of just normal
- pass area separately
- pack vertices offset+count into single integer

582us, 224(224)v, 97(128)v, 4096lds, 2/16o (-53v => +1)
2022-01-15 21:34:43 -08:00
Ivan Avdeev
6853ad51ea rt: fix polylights facing the wrong direction 2022-01-15 19:54:35 -08:00
Ivan Avdeev
90bf0bc262 rt: select only one light source per pixel
known issues:
- noise is fixed
- overall light is too dark
- some lights are facing the wrong direction

test_brush2, green room, direct light:
336us, 192(192)v, 97(128)s, 4096lds, 2/16o (-45v => +1o)
2022-01-15 19:45:41 -08:00
Ivan Avdeev
85ea822512 rt: sample the new polygon lights with projected solid angle
no shadow rays yet
2022-01-15 17:16:45 -08:00
Ivan Avdeev
04a201c401 rt: pass new polygon lights to shader naively
also start refactoring light collection

broken:
- reloading lights after patching
- wagonchik lights (attached to non-static models)

missing:
- clustering the new poly lights
- proper sampling, only rough estimate for now
- shadows

probably a lot more
2022-01-14 23:48:57 -08:00
Ivan Avdeev
b31462fe18 rt: stub better emissive surfaces representation path
Light polygons that are:
- self-sufficient (no kusochki indirection needed).
- pre-transformed
- contain enough metadata (area, center, normal) for quick sampling
- are polygons with up to 7 vertices and not triangles (easier sampling)

Also move rad file reading to before brush model loading, as it now
requires lighting data.
2022-01-13 22:36:21 -08:00
Ivan Avdeev
e4ade833e8 rt: use a bit more reasonable compute groups
doesn't really affect perf tho
2022-01-12 22:39:09 -08:00
Ivan Avdeev
f4c56ead54 rt: add shadow ray query to direct light pass
7.557ms 212(216)v 65(128)s lds=8192 2/16o :(

also, kernel panics on changelevel
2022-01-11 22:41:21 -08:00
Ivan Avdeev
a47fdcb8ca rt: fix most glaring direct light glitches
- fix normal2 packing
- work around desynced light cluster sizes

known issues:
- static seed for random
- no emissive
- no shadows

perf (direct): 6.4ms, 183(184)v, 59(128)s, lds=0, 2/16o (?!)
2022-01-11 18:13:59 -08:00
Ivan Avdeev
af24afbcc3 rt: draft direct light compute shader
it's bad:
direct light: 1.8ms, 183(184)v, 59(128)s, LDS=0, 2/16o
(-56 vgpr => +1 wavefront??)

also, thread group size = 16, 8, 1, wave64
while ray tracing pipeline = 8, 4, 1, wave32
2022-01-10 19:13:08 -08:00
Ivan Avdeev
b9760aaaea rt: add normals to primary pass
primary: 114us (+15), 62(64)v, 60(128)s, 16/16o
reading: 13us (+3)
2022-01-09 20:02:27 -08:00
Ivan Avdeev
f281b40e34 rt: use the same primary out list for image creation 2022-01-09 19:50:43 -08:00
Ivan Avdeev
c6ea7dc1fc rt: list primary out bindings separately 2022-01-09 19:36:08 -08:00
Ivan Avdeev
090fb3bfbb rt: add alpha test to primary rays
105us, 57(64)v, 60(128)s, 2048l, 16/16
2022-01-08 17:21:04 -08:00
Ivan Avdeev
3453a2f563 rt: add anisomips to primary ray
also move uniform buffer to rtx from render

110us, 57(64)v, 52(128)s, 16/16
2022-01-08 13:44:02 -08:00
Ivan Avdeev
93b0766142 rt: read textures and pass it to gbuffer
102us, 56(64)v, 48(128)s, 16/16o
2022-01-07 23:22:19 -08:00
Ivan Avdeev
4b540d28eb rt: pass both positions and "color" to g-buffer
vgpr is up to 57 :(
2022-01-07 22:43:27 -08:00
Ivan Avdeev
f85b1b9dc1 rt: pass uvs to screen
same: 111us, 53(64)v, 48(128)s, 16/16o
2022-01-07 22:26:57 -08:00
Ivan Avdeev
da91ff551e rt: pass geometry data to primary ray pass
also teach it to reload
2022-01-07 22:14:50 -08:00
Ivan Avdeev
246c42f043 rt: trace actual rays in primary pass
uh oh, test_brush2: 74.3us, 48/48 vgpr, 44/128 sgpr, 16/16 occupancy
2022-01-07 19:22:40 -08:00
Ivan Avdeev
cd47861d9b rt: start splitting tracer into passes; add primary pass stub
renders only uv gradient as a test

empty rgen, 6900xt: 12.3us, 6/16 vgpr, 20/128 sgpr, 16/16 occupancy
2022-01-07 18:53:23 -08:00
Ivan Avdeev
9adf9e1779 rtx: decrease payload_opaque dependencies 2022-01-06 19:56:15 -08:00
Ivan Avdeev
56c0a3273e Merge branch 'vulkan' into better-sampling 2022-01-06 13:34:43 -08:00
Ivan 'provod' Avdeev
8b7ff39efb print more info about vulkan memory and allocations 2022-01-05 20:12:36 -08:00