python/357 has bullets submodels which are animated using parent bones.
Their direct bones are static, and thus the entire submodel was picked
up as static.
Now when computing bone transform for particular sequence/anim frame
also merge it with parent transform. Bones are laid out sequentially in
their "dependency order" so using a direct parent is fine, as it also
contains its parent transforms.
Fixes: #554
On Windows we're seeing a max size = 0x0 swapchains. Those cannot be created or used. Make sure that we're not, and we're not trying to draw anything when there's no swapchain available.
Unfortunately we still have to call some rendering functions (without actually rendering anything) to make sure that various invariants hold.
fixes#463
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.
Renames previous METRICS to COUNTERS. These are still reset to zero
every frame.
Adds new METRICS which are preserved, maintained externally to speeds,
and only sampled by speeds code once per frame.
Also adds new metrics:
- `studio.cached_submodels` -- number of submodels in cache
- `geom.used` -- memory used by long allocations
- `geom.{vertices,indices}` -- counts of vertices/indices for long
allocations
- `geom.dyn_{vertices,indices}` -- counts of vertices/indices for
single-frame dynamic allocations
When `r_speeds_graphs` cvar is read for the first time, not all metrics
might be registered yet. It leads to some graphs missing.
Retry searching for these metrics on further frames, thus preserving the
graph list from previous session fully.
- Add variable name and registration src:line to the
`r_speeds_list_metrics` output. Makes it easier to reason about where
does this metric come from.
- Group metrics by their modules, makes it easier to discover.
- Do not print the list immediately on command, do it later in the
frame. Makes it print correct latest frame values.
Still slightly KORYAVY as:
- there's no cache eviction, it might get full pretty quick
- static-vs-dynamic animation decision is pretty rudimentary, might consider non-animated things as dynamic
- args passing vs global state is meh