Gleb Mazovetskiy
112e113201
Optimize `DoCrawl`
...
Benchmark:
```
cmake -S. -Bbuild-reld -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON
cmake --build build-reld --target crawl_benchmark && build-reld/crawl_benchmark
```
Before:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 3.53 ns 3.53 ns 198384032
BM_Crawl/4 54.3 ns 54.2 ns 12907171
BM_Crawl/16 733 ns 732 ns 955101
BM_Crawl/20 1142 ns 1141 ns 613766
```
After:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 1.36 ns 1.36 ns 453018506
BM_Crawl/4 5.59 ns 5.59 ns 124244505
BM_Crawl/16 102 ns 101 ns 6577269
BM_Crawl/20 147 ns 147 ns 4684004
```
2 years ago
Gleb Mazovetskiy
bf98d9f533
Speed up DeadItem
...
Previously, the same tiles were rechecked over and over again.
O(k^3) -> O(k^2)
This changes the visitation order but we agreed in #7215 that
we don't care.
2 years ago
Gleb Mazovetskiy
91306d8c22
Migrate misdat.cpp data to TSV
2 years ago
Gleb Mazovetskiy
624afafe58
Extract Crawl to a library
...
Also adds a test and a benchmark
2 years ago
Gleb Mazovetskiy
df3d76c3c1
Add utils/string_view_hash.hpp
2 years ago
Gleb Mazovetskiy
78e87e9f09
clx_sprite: Minor improvements from #7191
2 years ago
Gleb Mazovetskiy
90732aa7be
Migrate objdat.cpp data to TSV
2 years ago
Gleb Mazovetskiy
e5e007cd3c
Slightly optimize `Utf8CodePointLen`
...
A few more operations but the "lookup table" is now an immediate constant.
https://godbolt.org/z/7YG3ohWT6
2 years ago
Gleb Mazovetskiy
730c26a856
Migrate maps to unordered maps
2 years ago
Gleb Mazovetskiy
e9c29fa806
Switch to ankerl::unordered_dense
2 years ago
Gleb Mazovetskiy
01147410c1
Add dependency on unordered_dense
...
https://github.com/martinus/unordered_dense
2 years ago
Gleb Mazovetskiy
e7c58ad0ef
Remove missing SfxID
...
Follow-up to #7310
Also removes 1 more unused sound
2 years ago
Gleb Mazovetskiy
067d83afac
Remove "Book of " from `translation_dummy.cpp`
2 years ago
staphen
df0b3aaab7
Ensure that network timeout info shows up in the info panel
2 years ago
Eric Robinson
5ae0e5eb17
Optimize DeadItem() ( #7213 )
...
Optimize DeadItem() - Look up `player.position.tile` only once.
2 years ago
Anders Jenbo
28b7ae6b03
Allow for more flexible translations of "Book of {SpellName}"
2 years ago
Byrgius
0a778eec4b
Turkish Translation ( #7197 )
2 years ago
Gleb Mazovetskiy
27206cd1d7
Load font variant for Turkish
2 years ago
Anders Jenbo
211e99b420
Correct translation comment
2 years ago
Gleb Mazovetskiy
ada13f9e9a
Take PNG screenshots by default in SDL2 builds
...
PNG screenshots are also lossless and about half the size of the PCX
screenshots.
2 years ago
Gleb Mazovetskiy
33cc487ae4
Add single-argument logging overloads
...
Avoids going through `fmt` for single-argument log calls.
2 years ago
Gleb Mazovetskiy
b0c0ffef29
Fix tests build on SDL1
...
In SDL1, add `sdl2_to_1_2_backports` dependency to the interface of
`DevilutionX::SDL`, so that everything that uses SDL can also use
the backports.
Nearly everything uses the backports because logging uses the backports.
2 years ago
Gleb Mazovetskiy
177ba45f8d
Controller buttons: Make most of the code private
...
The compiler constant-folds the lookups in `printItemMiscGamepad`
code to the same asm as the manual version.
2 years ago
Gleb Mazovetskiy
742f5fd5f7
Fix a couple of compilation warnings
2 years ago
staphen
60113bb0b8
Fix brightness of whu casting animations
2 years ago
obligaron
597e6b5f5f
Add comment for fully light and fully dark optimiation assert
2 years ago
obligaron
4b7424949f
Make IsFullyDark/IsFullyLit respect hell and hellfire levels
2 years ago
obligaron
56044b7021
Introduce IsFullyDark/IsFullyLit
2 years ago
staphen
753633f2ad
Don't validate items in Single Player
2 years ago
staphen
e0dddb1178
Don't draw non-item cursors as items
2 years ago
Gleb Mazovetskiy
8a135c9c3b
Increase OutlinePixels limit from 1024 to 1536
...
@Trihedraf reported that the game crashed when killing Diablo.
1536 should be enough for Diablo and any custom sprites (if not, we can increase it further).
2 years ago
staphen
15e44a19c3
Fix order of events when drawing timeout cursor
2 years ago
Gleb Mazovetskiy
35e93366f6
Replace uses of deprecated u8path
2 years ago
Gleb Mazovetskiy
09e7cfea0e
Turn codec into a standalone library
2 years ago
Gleb Mazovetskiy
3b0cde6704
Turn utils/format_int into a standalone library
2 years ago
Gleb Mazovetskiy
495e583e64
Turn utils/file_util into a standalone library
2 years ago
Gleb Mazovetskiy
164dc9dc87
Turn util/parse_int into a standalone library
2 years ago
Gleb Mazovetskiy
3e22e8065b
Turn util/str_* into a standalone library
2 years ago
Gleb Mazovetskiy
713c04838c
Turn utils/utf8 into a standalone library
2 years ago
Gleb Mazovetskiy
706905fd59
SDL1: Fix windowed video mode
...
On Ubuntu 24.04 when running in a window,
`SDL_GetVideoInfo` returns the display size rather than the window size,
resulting in incorrect scaling.
Using `SDL_GetVideoSurface` instead of `SDL_GetVideoInfo` fixes this.
2 years ago
Eric Robinson
a30f7c0b8e
Randomize Unique Item Generation (Reverse compatible) ( #7060 )
...
Co-authored-by: staphen <staphen@gmail.com>
2 years ago
Gleb Mazovetskiy
637b51c103
Fix a few more warnings
...
The pure attribute on `StaticVector#empty` is needed so that
it can be used in `DVL_ASSUME` without a warning about side-effects in
assume.
2 years ago
Gleb Mazovetskiy
56342126bf
Log: Avoid making strings that won't be printed
...
When we switched to `fmt` for logging, the log functions were
implemented in such a way that the strings were always constructed,
even if log priority was such that they weren't ever logged.
2 years ago
Gleb Mazovetskiy
e078b46fec
Remove static_bit_vector
2 years ago
Gleb Mazovetskiy
b6347fb194
clx_render: Further simplify outline rendering
...
1. Switches to uint8_t for coordinate storage.
2. Avoids producing duplicate pixels.
2 years ago
Gleb Mazovetskiy
2e7d565b05
CLX renderer: Cache the last drawn outline
2 years ago
Gleb Mazovetskiy
ee8ca1c005
Greatly simplify outline rendering
...
The new algorithm is a lot less code, slightly faster, and results
in a smaller binary (-40 KiB on rg99).
The previous algorithm filled all the pixels around every solid pixel.
The new algorithm only fills pixels that will be visible.
We first collect the outline pixels into an array (which may contain a
small amount of duplicates). Then, we render the entire array in a
single loop. This turns out to be slightly faster than rendering inline,
at the cost of ~4 KiB of stack (basically free).
To collect the pixels, we go through the CLX sprite, keeping track
of the solid runs in the current row, and the filled pixels on the line
above and the line below.
To be able to quickly test the pixels above and below, we introduce a
new data structure, `StaticBitVector`. It is similar to a bitset,
except the size is determined at runtime (capacity is fixed),
and it supports quick updates of entire subspans.
2 years ago
Gleb Mazovetskiy
2c8b0cb0c3
blit_impl.hpp: Fix incorrect assumption
...
Turns out we can have fills of length 1
2 years ago
Gleb Mazovetskiy
5ff588d402
Fix some compilation warnings
2 years ago
Gleb Mazovetskiy
aa0476b0cc
Use -O2 for render code even in release mode
...
-O3 tries to vectorize blit loops too aggressively,
but our blit calls mostly loop only a few times.
`measure_timedemo_performance` on my machine:
* O1: 6.606 ± 0.060 seconds, 1109.520 ± 9.843 FPS
* O2: 6.484 ± 0.063 seconds, 1130.220 ± 10.909 FPS
* O3: 6.746 ± 0.017 seconds, 1086.260 ± 2.170 FPS
2 years ago