Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vulkan+rtx renderer #9

Draft
wants to merge 1,515 commits into
base: master
Choose a base branch
from
Draft

Add vulkan+rtx renderer #9

wants to merge 1,515 commits into from

Conversation

w23
Copy link
Owner

@w23 w23 commented Jun 7, 2021

This is here for now only for tracking mergeability + CI purposes

w23 and others added 30 commits November 3, 2023 10:37
- [x] debug: display individual channels #631 
- [x] debug: implement `r_lightmap` #634 
- [x] debug: display surfaces #635
- [x] name cvars and commands consistently #632 
- [x] allow enabling verbose logs at init
Improvement geometry smoothing (normals)
- Do not replace inherited base color texture
- Do not acquire default base color texture

Fixes #638
Detect changes in alternate_anims sequences.

Fixes #640
Fixes a typo that rewrote roughness value with garbage.

Also adds a few more debug channel displays for lighting phases. And
prints out available debug displays.

Fixes #641
Things done during stream E325

- [x] fix #638
- [x] fix #640 
- [x] fix #641
This makes it easily switchable at any point in time.

Still not sure how to properly manage log verbosity cvars:
- cvars are loaded after initialization and map load, so we can't really
  depend on saved cvar values.
- reloading cvars each frame cancels `-vkverboselogs` arg that is
  supposed to work around the above limitation
Adds `_xvk_tex_rotate` field for surface patches. Angle is specified in
degrees.

Note that it rotates the texture around origin, which might be very far
away. So offset patching might be needed to re-align.
We were using a negative value for `SURF_SKY` surfaces, which hit an
assert on uploading kusochki.
Pass current entity to compute wave height. Still doesn't switch to
negative height when underwater for some reason.
And still displays water sides.

Add some notes regarding water geometry generation and drawing.
Things done during stream E326

- [x] list supported arguments for `rt_debug_display_only`
- [x] make `vk_debug_log` a command
- [x] rotate your owl, fix #625
- [x] fix skybox surface assert
- [x] half-fix water levels
- [x] add alternate anims to infotool
Minor changes (replacement by _xvk_tex_rotate)
Add a section for this specific project
Many static worldmodel surfaces still contain alternate texture chains.
That was making these surfaces dynamic, even though there's no way to
trigger these alternate anims.

Make worldmodel ignore alternate_anims when looking for animated
surfaces.

Fixes #644
Worldmodel draws all water surfaces regardless of their
orientation/PLANE_Z.

All other entities only draw sides when EF_WATERSIDES effect bit is set.
Stuff done during stream E327

- [x] Fix alternate worldmodel anims #644
- [x] Hide water sides appropriately
Adds a few things:
- verbose logs about surface flags/type/orientation
- same about surface subdivided polys
- tries culling back water surfaces (doesn't work that well)
- tries culling in rt shaders

This still unfinished
Cull everything except:
- opaque geometry: to avoid shadow and reflection holes
- bleded geometry: particles and such should be visible from any angle

Alpha-tested geometries result in visual glitches when not culled
(double-sided ladders, double shadows, etc). These glitches are worse
than slightly misaligned shadows.

Translucent geometries are still matter of research.
Only leave water surfaces directed towards "air".
This is consistent with:
- non-`kRenderNormal` surfaces, for which there's only one surface present
- opt2 for translucent surfaces, where we aim to detect medium boundary
  direction based on normal-vs-ray-direction

Also add notes about translucent surfaces in general, more info about
water rendering under ref_gl, etc.

Fixes #264
E328-E330: Improve backface culling

- [x] Turn on backface culling in RT shaders for everything.
- [x] Force-disable culling for everything except alpha blended geometries.
- [x] Only leave water surfaces that are directed towards "air", fixes #264
Makes acid water surfaces emissive again.
However, they are not assinged proper emissive color values for direct
ray hits yet, so they do emit light, but look dar still.

Ref: #56
w23 and others added 30 commits January 29, 2024 12:49
Now indirect diffuse channel gets blurred with 2 Á-Trous passes. It
mostly follows the paper, except for Σd_i, which gives very bad
viusal artifacts.
Under `-vkvalidate` enables `debugPrintfEXT()` in shaders, allowing
extra validation and error reporting from shaders.
Severely degrades performance, so should be enabled only for debugging.
Hand-made organic bespoke GMO-free BRDFs

- [x] Fix black metals in #666
  - [x] Better diffuse-vs-specular channels tracking
  - [x] specular reflections
- [x] Fix new `test_material` glitches
- [x] Fix #461 
- [x] Fix #151 
- [x] Fix #266 
- [x] Filter out zero-area degenerate triangles (NOTE: might affect normal smoothing)
- [x] Implement #126 
  - [x] sun solid angle parametrization
- [x] Make new brdfs sampling functions
- [ ] distant light circular glitches
  - [x] not enough float precision, addressed to a degree with slight modifications to equations
- [x] Address glow over weapons in RT, see #442 
- [x] bounces
  - [x] diffuse
    - [x] why is it so dark?
  - [x] specular
- [x] Peformance differences. Why is there no CPU-GPU parallelism anymore?
  - [x] `VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT` forces cpu-gpu sync. 💩 
    - [x] Make a special flag for it
- [x] Update rendertests
  - [x] add more channels
  - [x] add white furnace display test
Once upon a time, there were some BLASes. There were the BLASes for dynamic geometry, that were to be used every frame to draw very dynamic things, like sprites and beams. They were initialized at the very begining of the renderer's lifetime, and were expected to live happily for the entire process duration.
However, an evil NewMap appeared. It didn't care abount anything or anyone, so when it came, it just cleared all the allocators, and allowed other BLASes to be allocated into the same space as dynamic BLASes were already given. This made BLASes live on top of each other, use each others toys and make them fight. They weren't happy.

So we just kill them and creat them again from scratch, when the evil NewMap comes.

The end.

Fixes #729
vk: rt: add workaround for holes in geometry

Once upon a time, there were some BLASes. There were the BLASes for dynamic geometry, that were to be used every frame to draw very dynamic things, like sprites and beams. They were initialized at the very begining of the renderer's lifetime, and were expected to live happily for the entire process duration. However, an evil NewMap appeared. It didn't care abount anything or anyone, so when it came, it just cleared all the allocators, and allowed other BLASes to be allocated into the same space as dynamic BLASes were already given. This made BLASes live on top of each other, use each others toys and make them fight. They weren't happy.

So we just kill them and creat them again from scratch, when the evil NewMap comes.

The end.

Fixes #729
It is not wired up to render anything yet, but we just made sure that it
builds and gets destroyed.

Also, fixup dynamic BLAS double-free.
It does it in a super dirty way, trad renderer needs a massive
refactoring.

It also displays patched skybox, however, we need it to display the
oridingal one.
Also fix:
- a bunch of texture/image destruction issues
- `_xvk_remove_all_sky_surfaces` getting stuck
E373: Draw skybox in traditional renderer

Fixes #732
- `mem->priv_.devmem` -> `slot_index`;
- Move static `VK_DevMemUsageTypeString()` out of `devmem.h` header.
profiler: track memory usage (#502)

* [x]  vulkan device memory:
  * [x]  allocated
  * [x]  used as storage for buffers/images/etc
  * [x]  unusable alignment holes
* [x]  vulkan buffers
  * [x]  allocated
  * [x]  used as storage
  * [x]  unusable alignment holes
* [x]  images memory total
* [ ]  cpu memory allocated in ref/vk

(copied & pasted from Issue #502)
Fixes sync hazard validation error for depth buffer.
`rt_force_disable` is perfectly fine, it just needs to be written into
either `vk.cfg` or `video.cfg` to work. Other configs are read *after*
`R_VkInit()` function get called.
This is a very dirty way of silencing errors, trading them for a
waterfall of warnings. But it will allow making progress for now.
Trad rendering still works with this slightly more tight sync model.

It is suboptimal as it doesn't really know the previous op on the
buffer, so it has to do the ALL_COMMANDS stages, which makes validation
a bit sore.
Not sure what's happening with the rest, but first couple works.
This makes RT rendering work w/o sync hazards.
But it will still fail with one if menu is called.

It's as much as it can go w/o proper state tracking.
Synchronization stuff started on stream E374

Addresses a bunch of validation synchronization hazards. Not all of them. And the remaining ones require more involved state tracking, a big effort.

Also contains a few minor tweaks:
- stop using SDL_GL functions, silence errors
- increase acceleration structures buffer size -- with recent mesa update BLASes got bigger somewhat (?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

4 participants