Commit graph

36 commits

Author SHA1 Message Date
Andrei Alexeyev
8b37d1cbf2
src: the great #include massacre of 2024 2024-05-17 14:11:48 +02:00
Andrei Alexeyev
be7905d6a3
src: run upkeep 2024-05-17 04:58:47 +02:00
Andrei Alexeyev
0fdea86be1
Implement Robin Hood hashing (#200)
* 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.
2020-03-17 10:09:49 +02:00
Andrei Alexeyev
5a23fb95fc
make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
Andrei Alexeyev
3055901998
update my email 2019-07-03 21:00:56 +03:00
Andrei Alexeyev
14f0a170c8
WIP: accelerate build with precompiled headers
Also got rid of rwops_pipe; we don't use it and PCHs make passing the
required feature macro for the posix implementation too complicated.
2019-02-09 12:29:54 +02:00
Andrei Alexeyev
4159ea1249
'upkeep' target for maintenance tasks; back to include guards; happy new year! 2019-01-23 22:10:43 +02:00
Andrei Alexeyev
322edd0dce
Text rendering rewrite and optimizations; some refactoring (#129)
* 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
2018-06-30 00:36:51 +03:00
Andrei Alexeyev
09946ebff9
Threading improvements (#125)
* Add a general purpose multi-threaded task manager (worker pool) for background tasks

Reimplemented screenshots off-loading using the new task manager.

* Largerly rewrite resource loading internals

They use the new task manager API now and should be generally more
robust.

* Made the game playable without threads again

* wait for resource async load task instead of intermediate state change

* remove dead code

* taskmgr: if creating a worker thread fails, try to make sure the others terminate
2018-05-25 09:01:07 +03:00
Andrei Alexeyev
aefc398883
remove outdated/broken tests 2018-04-18 18:23:24 +03:00
Andrei Alexeyev
8ef5ffd32c
Flexible draw order; entity "base class" for all game objects 2018-04-15 09:43:11 +03:00
Andrei Alexeyev
59cf8f6300
Rendering system rewrite, tons of refactoring, optimizations, and other cool stuff (#116) 2018-04-12 17:08:48 +03:00
Andrei Alexeyev
513d613387
Consistent indentation: indent with tabs, align with spaces (#104)
I would've preferred to just go with 4-spaces for indent and no tabs,
but lao is a bit conservative about it. :^)

Still, this is a ton better than mixing different styles all over the
place, especially within the same file.
2018-01-12 20:26:07 +02:00
Andrei Alexeyev
485c9a8ed6
Happy New Year! 2018-01-04 19:14:31 +02:00
Andrei Alexeyev
e355e57fb5
make the list api require less insane casts all over the place
by sealing the spirit of insanity in its header file, that is
2017-12-24 08:16:25 +02:00
Andrei Alexeyev
29acd5f58a meson: intel intrinsics, various improvements 2017-12-21 03:58:54 +01:00
Andrei Alexeyev
db8dd8ad7c
desperate optimizations
i even used a profiler
2017-11-23 18:23:30 +02:00
Andrei Alexeyev
7b53d9e731
redesign list api 2017-11-21 16:45:01 +02:00
Andrei Alexeyev
3413bd92e7
many vfs improvements
* There's no distinction between "temp" and "perm" nodes anymore.
    All nodes are allocated with 1 reference belonging to the
    vfs_alloc() caller.

    * VFSNode pointers retrieved by any API that returns one (most
    notably vfs_locate) are guaranteed to have exactly one reference
    belonging to the caller. What this means is that you must always
    decref them when you're done using them.

    If you're implementing such an API (e.g. a custom locate), remember
    to incref any persistent nodes you return.

    * Passing a VFSNode* to anything that successfully consumes one (for
    example, vfs_mount) transfers ownership of the reference to the
    consumer. In other words, consumers do not incref your nodes, but
    they will decref them once they don't need them anymore. If you want
    to keep the node around, then you must incref it first.

    * Bunch of other stuff.

"Ownership" is an abstract concept in this context. Basically it just
means "cleanup responsibility".
2017-11-10 21:49:54 +02:00
Andrei "Akari" Alexeyev
7c9e54a71d
update copyright and credits 2017-09-12 04:28:15 +03:00
Andrei "Akari" Alexeyev
f084840c37 fix a minor memory leak in hashtable code 2017-04-30 01:17:57 +03:00
Andrei "Akari" Alexeyev
e3da5f27f6 more correct and portable printing of size_t and fixed-width integers
previously it didn't work properly on windows
2017-04-21 02:11:53 +03:00
Andrei "Akari" Alexeyev
d24234e6d5 hashtables: dynamic size and a faster hash function for string keys 2017-03-29 01:11:39 +03:00
Andrei "Akari" Alexeyev
9c5d6dee9b hashtable: fix a concurrent write-during-read possibility
well, it actually still exists, but the chance should be much lower and
i don't know how to fix this better without locking on every read.

fwiw, i never had it actually break even before this fix.
2017-03-18 10:13:02 +02:00
Andrei "Akari" Alexeyev
8fdf8d1fc7 Merge branch 'master' into async 2017-03-15 12:07:29 +02:00
Andrei "Akari" Alexeyev
455039edb4 Implemented a custom assert() that uses the log system if possible
Bonus: no need to include assert.h
2017-03-15 11:21:39 +02:00
Andrei "Akari" Alexeyev
48c10ab7e1 Experimental hashtable locking mechanism
Supposed to allow concurrent reads, but forbid reads during writes or
writes during reads, and forbid concurrent writes.
2017-03-14 02:46:06 +02:00
Andrei "Akari" Alexeyev
df90733c8f WIP async loading 2017-03-14 02:46:06 +02:00
Andrei "Akari" Alexeyev
ca16c30966 large refactoring WIP
windows & osx untested
bgm untested
too many changes to comment on
2017-03-05 00:39:17 +02:00
Andrei "Akari" Alexeyev
4b8b00f21b fixed unset/reassign in hashtables 2017-03-02 23:45:35 +02:00
Andrei "Akari" Alexeyev
beda0d6380 use adler32() instead of adler32_z()
some old versions of zlib don't have the later
2017-03-01 19:03:56 +02:00
Andrei "Akari" Alexeyev
0fe9ecd436 hashtable: made the hash 32 bit and fixed some warnings 2017-03-01 17:42:47 +02:00
Andrei "Akari" Alexeyev
e49a401b71 tweaked hashtable sizes 2017-03-01 00:42:33 +02:00
Andrei "Akari" Alexeyev
70b85b0ff6 Added a subcommand to dump some stats about the resource hashtables 2017-03-01 00:10:23 +02:00
Andrei "Akari" Alexeyev
18652576d6 Use hashtables for resource management 2017-02-28 22:51:47 +02:00
Andrei "Akari" Alexeyev
fdd4633e19 Implemented a simple general-purpose hashtable 2017-02-28 19:28:15 +02:00