Commit Graph

314 Commits

Author SHA1 Message Date
nilsoncore
4bac2cc96f vk: devmem: fix print formats for linux. 2024-03-24 20:33:03 +03:00
nilsoncore
790bf25263 vk: devmem: fix previously conflicting code.
- `mem->priv_.devmem` -> `slot_index`;
- Move static `VK_DevMemUsageTypeString()` out of `devmem.h` header.
2024-03-22 06:31:39 +03:00
nilsoncore
8363cedf93 vk: devmem: resolve conflicts with w23:vulkan branch. 2024-03-22 06:05:51 +03:00
nilsoncore
a06998321e vk: devmem: track peak single allocation size 2023-12-14 08:13:26 +03:00
nilsoncore
cba1b02103 vk: devmem: print human-friendly memory size values
Raw values are still printed in subsequent messages.
2023-12-14 08:00:21 +03:00
nilsoncore
ceb4437f8c vk: devmem: print number of alloc slots on overflow 2023-12-14 07:54:23 +03:00
nilsoncore
05ac770c81 vk: devmem: track alignment holes correctly
Get `alignment_hole` right from the `alolcator` instead of calculating
outside.
Improve allocation slot variable naming on slot allocation selection.
Restructure internal `vk_devmem_t` fields into `internal` struct.
Make `VK_DevMemUsageTypeString` visibility scope to file-only.
2023-12-14 07:50:15 +03:00
nilsoncore
1117c5969e vk: devmem: simplify flags formatting
Use `PRI_VKxxxFLAGS_FMT` as an inline format macro and
`PRI_VKxxxFLAGS_ARG( ... )` as an inline argument macro for that format.
Also bring back those `!!`.
2023-12-14 07:39:44 +03:00
nilsoncore
79e0e52061 vk: profiler: devmem: save peak instead of total metrics
Also minor code structure changes.
2023-10-07 16:58:04 +03:00
nilsoncore
e3d86af5ab vk: profiler: devmem: code style consistency
Also clarify one comment about enabling stats metrics only with
`-vkdebugmem` parameter.
2023-09-25 23:47:04 +03:00
nilsoncore
95223077b6 vk: profiler: devmem: take into account alignment holes
Also improve `VK_DevMemFree` debug printing: include usage type, size,
alignment, and unusable alignment hole size.
2023-09-25 23:43:45 +03:00
nilsoncore
985ebd23c2 vk: profiler: metrics: fix switch-case scoping to build on linux 2023-09-24 06:23:15 +03:00
nilsoncore
aebc730b35 vk: profiler: metrics: make var column wider to fit new wider ones 2023-09-24 06:06:42 +03:00
nilsoncore
c7f8a2a8f6 vk: profiler: devmem: store stats for each devmem usage type
Make struct `vk_devmem_allocation_stats_t` which will be able to store
overall stats and stats generic for each usage type.
Move Vulkan related devmem allocation arguments into their own type -
`vk_devmem_allocate_args_t`.
Store `vk_devmem_usage_type_t` inside `vk_devmem_t`, so we can handle
deallocations (frees) for each corresponding type aside from overall
stats.
Make `VK_DevMemAllocateBuffer` and `VK_DevMemAllocateImage` macros which
call generic function `VK_DevMemAllocate` with correspoding usage type
set.
Make function `VK_DevMemUsageTypeString` to be able to get short string
of long enum name.
2023-09-24 06:06:42 +03:00
nilsoncore
f515228142 vk: devmem: fix debug message so it builds on linux (hopefully) 2023-09-24 06:06:42 +03:00
nilsoncore
a909f7bcab vk: profiler: use existing functions
Use built-in `Q_memprint` to output memory sizes.
Use built-in `COM_FileWithoutPath` instead of newly added
`get_filepath_from_filepath` to truncate full filepath from filename.
2023-09-22 05:06:57 +03:00
nilsoncore
4f6d9b8e1e vk: devmem: code style consistency 2023-09-22 05:01:46 +03:00
nilsoncore
5a745249e1 vk: devmem: integrate it with r_speeds metrics
Clarify type name `vk_device_memory_t` as `vk_device_memory_slot_t`
to not confuse it with `vk_devmem_t` as their names are pretty much
the same.
Add additional helper functions to standardize VK flags output format.
Also maybe it is a good idea to have it inside `vk_flags.{h,c}`,
for example.
Improve debug printing: bring colors and improve readability.
Add internal (private) field `_block_size` to `vk_devmem_t` so we can
keep track of how much memory we freed.
2023-09-22 04:59:23 +03:00
nilsoncore
02604cd901 vk: profiler: metrics: remove outdated comment 2023-09-18 05:57:49 +03:00
nilsoncore
977eda258a vk: profiler: metrics: little tweaks
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.
2023-09-18 02:57:09 +03:00
nilsoncore
37600be985 vk: profiler: metrics: call print on lines only if necessary 2023-09-18 01:47:58 +03:00
nilsoncore
e939d3eab6 vk: profiler: metrics: drop arguments, use globals
This is related to static function of metrics print.  It probably does
not need to expose arguments and can just use globals directly.
2023-09-18 00:55:18 +03:00
nilsoncore
d5df2d2791 vk: profiler: metrics: store filepath, but print only filename
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.
2023-09-18 00:35:35 +03:00
nilsoncore
79c2d5768f vk: profiler: metrics: separate printing methods into different commands
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.
2023-09-17 17:16:20 +03:00
nilsoncore
b4aa0fcaf1 vk: profiler: metrics: print filenames instead of filepaths
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.
2023-09-17 17:06:49 +03:00
nilsoncore
6659c83c6d vk: profiler: print metrics header twice (top and bottom)
Second header down below the metrics print may help to visually see
the output format without the need to scroll console all the way up.
2023-09-17 16:35:19 +03:00
nilsoncore
c07fe8cd9c vk: profiler: add option to print metrics as table
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`.
2023-09-16 14:08:34 +03:00
nilsoncore
d2b71eb3f7 vk: profiler: fix source locations for scopes (#542)
Fix source locations for scopes in `r_speeds_list_metrics`.
Closes #542.
2023-09-16 14:00:54 +03:00
Ivan Avdeev
e27bfdc682 vk: studio: minor changes around FIXMEs
accidentally fixes #174
2023-09-15 14:00:37 -04:00
Ivan Avdeev
2e1cb8173e vk: studio: use explicitly set RI.currentmodel over entity->model
`thirdperson` mode overrides entity model while leaving entity->model
with the old value. Vk renderer was assuming that those are the same.

Fixes #551
2023-09-15 12:47:53 -04:00
Ivan Avdeev
755b2d59a9 vk: fixup BLAS preallocation on Linux/amdgpu
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.
2023-09-14 13:57:59 -04:00
Ivan 'provod' Avdeev
06a7de02a8 vk: clear EntityData on new map regardless of save-load
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
2023-09-14 13:48:39 -04:00
Ivan 'provod' Avdeev
7d115168ae vk: alolcator: report pool allocation failures correctly
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)
2023-09-14 13:42:47 -04:00
Ivan Avdeev
3333d03a7b vk: studio: add submodel render acquire/release diagnostics
For #562 investigation
2023-09-14 13:02:01 -04:00
Ivan Avdeev
9ceb129576 vk: sprite: enable lerping
It Just Works™  even with raytracing, as RT just blends everything
(including coplanar sprites) order-dependent correctly.

Fixes #433
2023-09-14 12:13:30 -04:00
Ivan Avdeev
40a79d7280 vk: sprite: fix fading
Fixes #441
2023-09-14 11:58:32 -04:00
Ivan Avdeev
5767ddb30c vk: studio: do not ignore parent bones when detecting static submodels
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
2023-09-12 11:12:40 -07:00
Ivan 'provod' Avdeev
64e1a9b763 vk: do not draw into empty swapchain
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
2023-09-12 10:48:26 -07:00
Ivan Avdeev
26a4fff486 vk: brush: improve animated surfaces detection
Explicitly check that there are at least two different textures in an
animation sequence.

Fixes #555
2023-09-08 14:22:37 -04:00
Ivan Avdeev
48b7fcb153 vk: add a bunch of profiler metrics
Done as part of investigation for #555
2023-09-08 14:12:35 -04:00
NightFox
f3b55c63bb
Update rads
performance improvement for c1a0/c1a0d
2023-09-08 17:39:27 +03:00
NightFox
9c7d8a6ee0
Update patches 2023-09-08 17:17:23 +03:00
Ivan 'provod' Avdeev
6d749ea8d0 vk: synchronize updating kusochki
Do not aggravate the validator by uploading to the same memory region twice. Make sure that there's synchronization between updating kusochki.

Fixes #553
2023-09-07 11:19:41 -04:00
Ivan Avdeev
13eef5dda2 vk: silence a bunch of verbose logs
There are some limits that we hit multiple times in a frame that result
int S_ERROR logs. Throttle them

Fixes #545
2023-09-07 10:43:21 -04:00
Ivan Avdeev
b8eb6156a8 vk: studio: allow late "pre"loading for studio models
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
2023-09-07 10:18:31 -04:00
Ivan Avdeev
bdbfbef8a2 vk: add commented out normal debugging code 2023-09-05 13:06:00 -04:00
Ivan Avdeev
f42ea011f1 vk: mapents: fix not clearing smoothing groups 2023-09-05 13:03:53 -04:00
Ivan Avdeev
58ed5e7277 vk: brush: add explicit smoothing group inclusion 2023-09-05 12:54:57 -04:00
Ivan Avdeev
61416cfc66 vk: brush: do not link pairs that were explicitly excluded in patches
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
2023-09-05 12:35:28 -04:00
Ivan Avdeev
d8d5019971 vk: filter smoothing normals by texture
thanks to G.I.F
2023-09-05 12:07:02 -04:00