Commit Graph

48 Commits

Author SHA1 Message Date
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
608aa4137d vk: use staging for uploading geometry 2022-05-04 09:23:37 -07: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
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
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 '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
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
8e0be3c372 add vk_rtx_extension cvar for rtx options, more smart vk_rtx cvar 2021-12-04 22:02:34 -08:00
NightFox
c6f92b0664 Add ClearBits for FBitSet
Because otherwise the condition will be called all the time.
2021-12-04 22:02:34 -08:00
NightFox
5917fff727 Update ref_vk/vk_framectl.c
Okay

Co-authored-by: Ivan Avdeev <marflon@gmail.com>
2021-11-30 19:53:06 -08:00
NightFox
1bf72f6a1a Add vk_rtx command
For enable or disable ray tracing mode
2021-11-30 19:53:06 -08:00
Ivan 'provod' Avdeev
e6db0fde45 add debug names to various vk images 2021-11-07 13:49:44 -08:00
Ivan 'provod' Avdeev
3abd5ee259 BROKEN rtx: add denoiser compute stub 2021-11-07 13:49:44 -08:00
Ivan Avdeev
cfbce2c4b9 clamp swapchain dimensions, fix #185 2021-11-02 10:36:31 -07:00
Ivan Avdeev
4b363bc8f3 rtx: add profiler scopes for light cluster building 2021-10-20 11:58:53 -07:00
Ivan Avdeev
8756f648ca add trivial on-screen profiler printout 2021-10-20 11:58:53 -07:00
Ivan Avdeev
8b704ed9a6 handle externally provided swapchain resolution, fix #53 2021-09-24 20:58:01 -07:00
Ivan 'provod' Avdeev
6b1eb26c24 improve screenshot performance, fix #87
make sure that we use host_cached memory, otherwise device_local will be picked by default, which is very slow to read from.
2021-09-22 20:29:31 -07:00
Ivan 'provod' Avdeev
0259c09e9a add swizzle for RGBA-BGRA format pair when saving screenshot
this is the pair that breaks on nvidia (yay there's at least one thing that amd is better at!)
2021-08-31 11:19:44 -07:00
Ivan Avdeev
280e6109c6 add screenshots
now vulkan can do screenshots too. however, it depends on blits being
available between swapchain and rgba8 formats, so if it's not the case
for some reason, the resulting image will have mixed components.
2021-08-31 11:19:44 -07:00
Ivan Avdeev
5208219b44 join alloc+lock operations on buffer init
this simplifies the api and implementation
2021-08-11 11:43:33 -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 'provod' Avdeev
656c00d0b8 fix building and running on linux 2021-06-06 14:17:35 -07:00
Ivan 'provod' Avdeev
eaaadf024e rtx: coalesce building blases in a single command buffer 2021-05-28 10:10:20 -07:00
Ivan 'provod' Avdeev
3045c6ea1f rtx: render into fixed 720p framebuffer then upscale
help with perf stability
2021-03-20 11:15:57 -07:00
Ivan 'provod' Avdeev
cbed97948c add preliminary support for dlights
Move descriptors away from vk_core
Add UBO for dlights
Add test lighting in brush shader
Add brush normals
2021-03-06 16:40:35 -08:00
Ivan 'provod' Avdeev
e0ee4b756b rtx: make it draw yellow screen
this basically checks that acceleration structurs are building without
any vulkan errors (we still don't know whether they are bulding with
correct geometry though).

we also have compute shader pipeline ready for ray tracing (yay)
but it doesn't do any raytracing yet
2021-03-01 11:22:58 -08:00
Ivan Avdeev
5e3010489b rtx: blindly add tlas and compute rendering
it's unknown whether it works at all
no real ray tracing yet
2021-03-01 10:52:08 -08:00
Ivan 'provod' Avdeev
c77f39e353 rtx: fix blas creation validation/memory errors 2021-02-27 15:40:57 -08:00
Ivan Avdeev
9954288450 rtx: add blas building skeleton 2021-02-27 13:43:49 -08:00
Ivan Avdeev
973ef4c677 separate buffer space allocation from buffer uploading
Now each geometry is first allocated a slot with VK_RenderBufferAlloc,
and then VK_RenderBufferLock/Unlock are used to upload buffer contents.

This allow for two things:
1. Uploading buffer data to GPU memory on/after Unlock.
2. (Re)building BLAS for RTX on/after Unlock.

These buffers are now directly referenced by render_draw_t, which also
will be helpful in the future for both renderers.
2021-02-22 18:57:46 -08:00
Ivan Avdeev
3f70b76208 engage scene rendering in VK_RenderFrame and not in EndFrame
Rework a bit how matrices are computed. More global state dependencies
;_;

Buffer-up draw commands, and only schedule them for drawing at EndFrame.
2021-02-20 14:54:57 -08:00
Ivan Avdeev
45ad261129 make unimplemented message less verbose 2021-02-06 13:38:38 -08:00
Ivan Avdeev
bf8a50f4fa recreate swapchain if it's stale on acquire 2021-02-06 11:52:10 -08:00
Ivan Avdeev
8870650466 split vk_map into vk_scene and vk_brush
Scene controls entity list for scenes
Brush is only responsible for drawing brush models
2021-02-01 11:05:04 -08:00
Ivan Avdeev
12c8f00885 add lightmaps; improve performance
1. Improve performance by coalescing multiple surfaces/draw calls with
   the same textures (within a single brush model).
2. Add lightmaps. We don't support lightstyles yet, though, so they seem
   a bit wrong at times. Also gamma handling is not great.

Oh well.
2021-01-30 15:31:23 -08:00
Ivan Avdeev
eaa3d4295d draw brush surface textures
it's now *very slow* because every surface (which is just a few polys)
gets its own draw call and descriptor bind. F

we also had to make default sampler repeating, so now 2d textures in
menu have weird edge artifacts. also F

making progress i guess
2021-01-30 12:12:41 -08:00
Ivan Avdeev
5d0146e17a draw static map geometry with debug shader
there are lots of glitches and no textures, but this is a first step!
2021-01-23 19:38:00 -08:00
Ivan Avdeev
4949f6e29e extract pipeline creation helper 2021-01-23 13:23:25 -08:00
Ivan Avdeev
0cd4cebfbb fix depth buffer recreation on resize 2021-01-23 11:11:45 -08:00
Ivan Avdeev
5a2ad5965d add depth buffer and map geometry loading
it's not being drawn yet though
2021-01-23 10:54:44 -08:00
Ivan Avdeev
014d2d272d massage stubs 2021-01-20 11:16:06 -08:00
Ivan Avdeev
e49591652f add 2d pipelines with blending; menu is drawn almost ok
also switch to non-srgb framebuffer
and remove a bunch of verbose log messages
2021-01-18 13:33:22 -08:00
Ivan Avdeev
ef3a1ad4af handle surface resize 2021-01-18 11:15:51 -08:00
Ivan Avdeev
d4c463c507 move swapchain to framectl; make validation errors crash process early 2021-01-18 10:54:48 -08:00