Needed to hide invisible geometry on e.g. c5a1. Breaks de_dust2 roofs
(#474). That will need to be addressed some other way.
Still uses special value for base_color texture to signal SKY SURFACE.
A supposedly better way to do this would be to have them have a special
material.
1. Completely remove them from geometries
2. Draw skybox where the ray hasn't hit anything
3. In the same fashion sky is not shadowed when there's nothing hit by
the shadow ray.
This allows completely removing the sky material flag.
Also supposedly fixes#474
This is needed to enable advanced material patching, where the material
can be picked up based on source type, render mode, surface number, etc
etc and all of the above combined if needed.
Previous scheme was picking up materials very late when all of this info
has been already lost.
vk: profiler: fix source locations for scopes (#542)
Fix source locations for scopes in `r_speeds_list_metrics` as described in Issue #542.
Also slightly simplify metrics list print formatting and add an option to print it as a table. It can be turned on/off via cvar `r_speeds_metrics_as_table`.
This does not look very good in HL itself because it uses non-monospace font by default in console, but it looks much cleaner and readable in console and log file output.
Remove unnecessary `crtlib.h` import in `profiler.h`.
Simplify `get_filename_from_filepath` function.
Add extra guards in metrics line printing to make sure we would not
leak/blow up anything.
Previously, source filepath was truncated right at metric registration,
so only the filename was stored. Now, full source filepath is stored.
The truncation to its filename happens only in metrics print. This way
we preserve full information, but also throw away redundancy in print.
Remove command `r_speeds_list_metrics` and cvar
`r_speeds_metrics_as_table`. Now, there are 2 new commands:
`r_speeds_mlist` - to print metrics as a list, and
`r_speeds_mtable` - to print metrics as a table.
Both of them can handle optional filter argument.
Reduces enormous amount of space used by absolute filepaths in
metrics print. This does not mean we cannot locate the files now.
Pretty much all of the vk files have such prefix in their name.
Slightly improve metrics list print formatting and
add new option to print it as a table. Table alignment relies on
monospace font.
This can be turned on/off with cvar `r_speeds_metrics_as_table`.
Fixing pool allocator to properly signal allocation failure uncovered an
existing issue where we were lacking enough memory for dynamic model
BLASes on Linux/amdgpu. Erroneously the same memory region was used for
>1 BLAS. Surprisingly this hasn't led to any noticeable issues so far.
Increasing accels buffer size fixes the issue.
Entity data gets reallocate on every NewMap regardless of whether it was a load from a save. Thus all entity pointers and data are invalidated. EntityData keeps things using pointers as keys.
Make sure it is properly cleared on `R_NewMap()`
Fixes#562
Returning `0` instead of `ALO_ALLOC_FAILED` let to API consumers believe that allocation was successful. This lead to asserts failing when trying to free such allocations.
Makes #562 not crash (but miss studio models anyway)
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