Do not aggravate the validator by uploading to the same memory region twice. Make sure that there's synchronization between updating kusochki.
Fixes#553
Sometimes the initial list of models doesn't contain everything that is
used later. I don't know why. So detect this and allow loading model
infos later.
Fixes#546
Smooth normals between selected brush surfaces if the angle between them is small enough.
- [x] Per-vertex-per-surface smoothing functionality (differs from qrad, which is per-edge; this gives artifacts as (supposedly) we have higher than lightmap lighting resolution)
- [x] Automatically select surfaces with less than X degrees between normals.
- [x] Make this X threshold adjustable from <map>.bsp.patch
- [ ] ~~Try not joining coplanar surfaces~~ -- doesn't seem to be affecting anything.
- [ ] ~~Think about linking surfaces more. Should we link distant surfaces w/o direct edges to this one?~~ -- it seems that we should be fine for now. Per-surface+vertex vs per-edge smoothing has no clear winner, just different tradeoffs.
- [ ] ~~Scale normals according to surfaces areas, so larger surfaces have more weight (experimental; may improve some artifacts)~~ -- also, non trivial to compute, and may not affect things too much.
- [x] Patch: add explicit smoothing or no-smoothing for given surfaces.
Fixes#139, supersedes #348
This doesn't work as expected in some cases, as surfaces might still get
linked transitively by neighbours. Solving this seems non-trivial for
now, but maybe we can just live with it
Automatically smooth normals between surfaces with normals less than 45
degrees off.
Can be adjusted from map.bsp.patch file like this (e.g. to 50 degrees):
```
{
"_xvk_smoothing_threshold" "50"
}
```
Improve BLAS management
This PR is to address #533 and related issues, e.g.:
- [x] Fixes#236
- [x] Fixes#350
- [x] Fixes#354
- [x] #364
- [x] Fixes#422
- [x] Fixes#443
- [x] Fixes#533
- [x] Fixes#539
- [x] Fixes#458
An arbitrary list of other things to do in this PR also:
- [x] Use new model create and render for brushes
- [ ] ? split materials from kusochki
- [x] fix sprite textures: pass texture override and upload dynamic/instanced kusochki
- [x] orient sprites
- [ ] fix NewMap-vs-long allocations for:
- [ ] accel buffer
- [ ] kusochki
- [ ] create/allocate tlas only once
- [x] studio models:
- [x] pre-cached models with prebuilt blases
- [x] blas update
- [x] counters for static-vs-dynamic cache entries count
- [x] better `r_speeds_graphs`
- [x] add/remove commands which modify the string
- [x] constant monitoring of the available metrics: metric registering later should start being drawn
- [ ] ~~cache eviction/LRU (needs proper allocs for accel buffer and kusochki)~~ -- doesn't seem to be a problem for now. Can totally live without.
- [x] previous vertices and transform
- [x] Fix animated textures: pass and update kusochki
- [x] Fix emissive textures
- loading order has changes, now kusochki are uploaded when brush model is loaded, and before lighting data is applied, thus losing emissive values
- [x] Remove deprecated APIs:
- [x] dynamic model
- [x] `VK_RenderModelInit_old`
- [x] `VK_RenderModelDraw_old`
- [x] `deprecated` section from `vk_render_model_t`
- [x] old ray model
- [x] old ray model cache
- [x] hide `rt_blas_t` as rt-internal, only expose new `rt_model_t`
- [x] restore TriApi/dynamic geometry for RT
- [x] dynamic drawing for RT
- [x] dynamic `rt_blas_t`
- [x] brush water update
- [x] rt_blas update
- [x] vk/rt models update
- [x] studio dynamic models
- [x] reloading c2a5 leads to geometry exhaustion (cannot allocate N vertices M indices, and missing models)
- [x] better static model detection: many sequences/frames are the same and are not in fact animated. This can be detected at load time.
- [x] `r_speeds` persistent metrics which are not reset on every frame, e.g. allocation counts, cache sizes, etc
Add render refcount to submodels to diagnose when it can't properly clear things due to them being used somewhere still.
Also add `speeds.submodels_cache_{dynamic,static}` counters to show how many submodels render models have been allocated.
Gives out individual render submodels for dynamic ones, receives and remembers them when they are not needed anymore.
Stores only one render submodel for static ones. Reuses/instantiates it for everyone.
Detect whether studio model has changed, and replace it with a new one.
It does (as predicted) run into a gpu sync issue if reuse happened while previous frame with the old user is still being drawn.