This fixes a nasty bug that manifests on windows when building without
precompiled headers. util/stringops.h used to silently replace strdup
with a macro that's compatible with mem_free(). This header would
typically be included everywhere due to PCH, but without it the strdup
from libc would sometimes be in scope. On most platforms mem_free() is
equivalent to free(), but not on windows, because we have to use
_aligned_free() there. Attempting to mem_free() the result of a libc
strdup() would segfault in such a configuration.
Avoid the footgun by banning strdup() entirely. Maybe redefining libc
names isn't such a great idea, who knew?
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.
These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.
All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.
The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.
Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
- RESF_UNSAFE is removed.
- Resources that don't have to be finalized on the main thread can load
completely asynchronously.
- A thread waiting for a concurrent task to complete can start executing
that task itself if it hasn't started yet.
- Refactor the resource loading interface, add support for load-time
dependencies.
- Main-thread finalization of asynchronously loaded resources is now
spread out across multiple frames to mitigate frametime spikes.
- Remove some archaisms from the resource management code.
- Fix potential hashtable synchronization issue.
- Fix some deadlock edge cases.
- Don't spawn more worker threads than there are CPU cores (degrades
performance).
- Add TAISEI_AGGRESSIVE_PRELOAD env variable to attempt to aggressively
discover and preload every possible resource.
- Make r_texture_fill{,_region} expect optimal pixmaps, so that it's
never forced to convert them on the main thread. The optimal format may
be queried with the new r_texture_optimal_pixmap_format_for_type API.
These functions will also no longer needlessly copy the entire image
into a staging buffer - previously they did this even if no conversion
was needed.
- Other random changes to facilitate the stuff above.
The overall effect is somewhat faster load times.
Of course it's still all terrible and full of lock contention because I
suck at concurrent programming, but it's not worse than it was.
Probably.
* Implement Robin Hood hashing
This replaces the previous separate chaining implementation. This
approach is more memory-efficient, cache-friendly, and puts much less
stress on the memory allocator.
* Replace crc32 with fnva1
Also attempt to make the compiler pre-hash as much stuff as possible at
build time.
* WIP some projectile effects
* fix segfault
* Laser smoothing and glow via post-processing blur magic
TODO: make it optional
* fix memory corruption
* fix memory corruption for realsies now
* fix color_get_hsl for out-of-range colors
* some more bullet flare tweaks
* some lame clear effect workarounds
* spawn bullet flares after frame 0; looks better and fixes some problems
* New baryon explosion; fix petal_explosion; leanify everything
* Add missing bullet flare sprite, rebuild main atlas
* improve batching efficiency with bullet spawn flares
* forgot git add
* Group projectiles/particles by shader where possible
* Another take on baryon explosion; make fg framebuffers 16bit
* WIP some settings for toasters
* remove stupid debug log
* microoptimization that probably does nothing anyway
* somewhat more intuitive quality settings
* Whitelist more particles (MarisaB is on hold)
* Whitelist (and fix) some more stage6 particles (mostly ToE)
* Add a spell name background
* Experimental radial healthbar for bosses
* healthbar tweaks
* thiccer healthbars in response to feedback
* remove healthbar survival timer; just fade out on survivals
* Add linear healthbars option; WIP other boss HUD tweaks
* Use the proper spell card name format
* New font and some random garbage to go along with it
* Generate static font outlines for use in text shaders
* Use outlines in overlay text shader
* Complete boss HUD/healthbar fading logic
* fix boss timer limit
* stage5 bombs explosion effect
* split PFLAG_NOSPAWNZOOM into PFLAG_NOSPAWNFLARE and PFLAG_NOSPAWNFADE;
introduce PFLAG_NOSPAWNEFFECTS which disables both (it's just the two
values OR'd together)
simplify vampiric vapor bullet spawning effect
* Remove spawn fade-in from super-fast stage5 fairy projectiles (limiters)
* lower particle density in v.vapor in minimal mode
* graze effect tweaks
* fix text shortening, tweak replay menu layout
* stupid debug spam
* revisit grazing effects again
* dumb debug spam again
* improve boss attack timer
* overlay effect for boss deaths (similar to the player one)
* spice up spellcard declaration (HUD)
* don't spawn boss death overlay if fleed
* modify Exo2 font to use tabular figures
* adjust replay menu for the font change
* draw timer & power with standard font (phasing out the numbers font)
* WIP new HUD; random fixes/tweaks
* hud: move difficulty indicator
* hud: move debug stuff around
* preloads, mostly
* fix youmuA batching conflict
* shitty workaround for the shitty screenshake shit
* remove extraspell lag by stopping to draw stagebg sooner
which is possible because extra spells have a different spellcard_intro timing. Fun fact of the day: the duration of spellcard_intro is always ATTACK_START_DELAY_EXTRA even for normal spells!
* new stain particle
* i disabled background rendering…
* "batch" marisa_b masterspark draws
* remove these once a new atlas is generated
* make toe quick again
* hopefully fix all occurences of changed stain and ScaleFade behavior
* tweaking reimu_a and toe boson launch effects
* make lhc fast again
* softer involnerability effect
* fix stage 1 snow on the water bug (and improve performance)
translated the time to the future a bit because it only seemed to be an issue for small time values
* remove unnecessary spawnflare from toe
* tone down extra spell start effect
* experimental ReimuB gap shader optimization
* fix python3 shebangs
* generate simple blur shaders w/ hardcoded kernels
* New loading screen
* lasers: fix incorrect draw hook registration
* add webp support for atlas generator
* Use ImageMagick for atlas composition (adds 16-bit support)
* Atlas maintenance
* make the vampiric vapor bullets less prone to invisibility
* Revert a few particles to the quadratic fade curve
* experimental baryon effect
* improve baryon sprites
* disable the baryon effect on minimal postprocessing setting
* wip font rendering stuff; hashtable monstrosity is temporary
* various text rendering fixes/improvements
* HashTables™ 3.0
* Add some comments to aid navigating the hashtable macro maze
* overhaul text rendering API; add default and example shaders
* text: implement text_render for spellcard effect; misc fixes
* README: update dependencies
Bye SDL_ttf, hello freetype2.
* text_draw: fix resolution/scale-dependent bugs
* make text_draw fallback to the current shader, fix hud and stagetext
* repair the bgm loading
* fix spell practice mode
* fix walloftext
forgot one site of text_draw earlier
* fix wrapped text rendering
* fix and simplify the hud text shader
* dynamic glyph cache
* implement font size change on window resize/quality setting change/etc.
* rename text shaders for consistency
* preloads for fonts and text shaders
* make the stagetext shader look somewhat better
* text_render: attempt to normalize height
* small improvement for stagetext