Commit graph

180 commits

Author SHA1 Message Date
Juan Linietsky
65686dedf9 Use WorkerThreadPool for Server threads
* Servers now use WorkerThreadPool for background computation.
* This helps keep the number of threads used fixed at all times.
* It also ensures everything works on HTML5 with threads.
* And makes it easier to support disabling threads for also HTML5.

CommandQueueMT now syncs with the servers via the WorkerThreadPool
yielding mechanism, which makes its classic main sync semaphore
superfluous.

Also, some warnings about calls that kill performance when using
threaded rendering are removed because there's a mechanism that
warns about that in a more general fashion.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2024-04-10 18:47:42 +02:00
Ricardo Buring
2ed2ccc2d8 Fixed Timestep Interpolation (2D)
Adds fixed timestep interpolation to the rendering server (2D only).
Switchable on and off with a project setting (default is off).

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2024-03-23 12:28:36 +01:00
Thaddeus Crews
9903e6779b
Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
Robert Yevdokimov
13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
A Thousand Ships
06f1b114cd
[Core] Upgrade some array helper classes to 64 bits
Following upgrades to `CowData` to 64 bit indices these helpers are no
longer able to handle the index ranges, possibly causing bugs on sort
and search.
2024-02-19 13:17:13 +01:00
Muller-Castro
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Bartłomiej T. Listwon
3fca4d0cb5 Link hash table primes externally to prevent data duplication in binary 2024-02-10 21:42:48 +01:00
bruvzg
7bcb419149
[Core] Improve CowData and Memory metadata alignment. 2024-02-05 17:30:02 +02:00
vittorioromeo
55ed34e37c Use '_v' shorthand for type traits and 'if constexpr' where appropriate 2024-02-02 15:43:21 +01:00
lawnjelly
4577dfdb67 Shadow volume culling and tighter shadow caster culling
Existing shadow caster culling takes no account of the camera.
This PR adds the highly encapsulated class RenderingLightCuller which can cut down the casters in the shadow volume to only those which can cast shadows on the camera frustum.
2024-01-30 08:38:31 +00:00
Rémi Verschelde
0bcc0e92b3
Merge pull request #86730 from reduz/64-bit-cowdata
Promote CowData to 64 bits
2024-01-19 18:46:11 +01:00
Juan Linietsky
24fe0715b5 Promote CowData to 64 bits
Fixes a lot of bugs, please help me fill the list.
2024-01-19 17:41:10 +01:00
Rémi Verschelde
dc79e956b6
Merge pull request #86587 from RandomShaper/wtp_enhance
Enhance & fix `WorkerThreadPool`
2024-01-11 17:38:09 +01:00
Pedro J. Estébanez
a731774813 WorkerThreadPool: Avoid most runtime allocations
Just a little optimization.

**NOTE:**
With `RID_Owner` we could replace each pair of `PagedAllocator` and
`HashMap`-of-ids-to-pointers. However, that would force us to expose
`RID` as the task/group id, instead of `int`, which would break the
API. Too bad. Let's wait until Godot 5.0.
2024-01-08 12:46:31 +01:00
Pedro J. Estébanez
ae418f9469 WorkerThreadPool: Avoid deadlocks when CommandQueueMT is involved
This commit lets CommandQueueMT play nicely with the WorkerThreadPool to avoid
non-progressable situations caused by an interdependence between both. While a
command queue is being flushed, it allows the WTP to release its lock while tasks
are being awaited so they can make progress in case they need in turn to post
to the command queue.
2024-01-08 12:45:43 +01:00
A Thousand Ships
904ecb1d36
[Core] Prevent copying of SelfList and SelfList::List
Copying of these types is unsafe and should be detected

Also removed unnecessary constructors for `TileMap` `DebugQuadrant` and
`RenderingQuadrant` which used copying of `SelfList::List`
2024-01-07 00:48:23 +01:00
Stuart Carnie
70bfd5d065
fix: data race in PagedArray 2024-01-03 13:17:01 +11:00
Pedro J. Estébanez
0567c5df9f Make PagedAllocator more compatible (esp., with HashMap) 2023-12-20 12:05:27 +01:00
Pedro J. Estébanez
1a1c06dfeb RBMap: Add explicit copy operators to iterators
Absence thereof is deprecated and breaks builds on most compilers.

Bonus: Fix parameter naming style throughout.
2023-12-15 13:14:59 +01:00
A Thousand Ships
ca5ec6aec1 [Core] Fix crash when hashing empty CharString 2023-11-26 17:35:27 +01:00
Pedro J. Estébanez
bfe66ab7cd Fixup thread-owned lambda bookkeeping on thread exit (take 2) 2023-11-23 18:50:20 +01:00
Rémi Verschelde
3bc1c9b5e0
Merge pull request #82797 from RandomShaper/fix_rbmap
Fix `RBMap`'s, iterator-based, `remove()`
2023-10-16 20:16:16 +02:00
A Thousand Ships
034c0f1624 Replace sanity with safety for checks 2023-10-08 16:22:24 +02:00
Pedro J. Estébanez
5c81236047 Fix RBMap's, iterator-based, remove() 2023-10-04 18:58:28 +02:00
Rémi Verschelde
023b6b30c1
Merge pull request #73813 from groud/improve_y_sort_performances
Greatly improve Y-sort performance on TileMaps
2023-09-25 22:47:22 +02:00
Gilles Roudière
30b94bb8ab Improve TileMap Y-sorting performance 2023-09-25 18:49:04 +02:00
A Thousand Ships
c48b189e14 Fix allocation size overflow check in CowData 2023-09-19 16:12:02 +02:00
A Thousand Ships
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
RedworkDE
2c0caa5828 Allow renaming child nodes in _ready 2023-06-26 13:25:48 +02:00
Ninni Pipping
e344bab8af Handle RID validator overflow 2023-06-20 13:20:17 +02:00
RedworkDE
69f2bc2751 Improve SelfList and fix error in BaseMaterial3D when running doctool 2023-05-22 16:38:57 +02:00
Pedro J. Estébanez
50cf3d6966 Optimize threading-sensitive node data for single-threaded processing 2023-05-17 02:04:41 +02:00
Juan Linietsky
0a9f72d5a8 Make more base nodes thread safe
Ongoing work to make more of the base nodes thread safe.
2023-05-15 16:54:10 +02:00
Rémi Verschelde
5271186f2f
Merge pull request #75901 from reduz/refactor-node-processing
Refactor Node Processing to allow Scene Multithreading
2023-05-10 12:46:44 +02:00
Juan Linietsky
98c655ec8d Refactor Node Processing
* Node processing works on the concept of process groups.
* A node group can be inherited, run on main thread, or a sub-thread.
* Groups can be ordered.
* Process priority is now present for physics.

This is the first steps towards implementing https://github.com/godotengine/godot-proposals/issues/6424.
No threading or thread guards exist yet in most of the scene code other than Node. That will have to be added later.
2023-05-09 19:17:51 +02:00
Pedro J. Estébanez
341b95871c Add missing thread safety to PagedAllocator 2023-05-08 18:38:56 +02:00
kleonc
0b944e1a68 Make LocalVector respect its tight template parameter 2023-05-08 15:22:58 +02:00
Rémi Verschelde
e0e93ce094
Merge pull request #72421 from myaaaaaaaaa/signal-hashmap
Store Object signals in a HashMap rather than a VMap
2023-04-25 19:26:35 +02:00
bitsawer
723f2f342f Optimize HashMap size 2023-04-24 16:18:58 +03:00
Danil Alexeev
36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
myaaaaaaaaa
1ec5381c16 Store Object signals in a HashMap rather than a VMap 2023-02-25 18:44:09 -05:00
myaaaaaaaaa
6b0f253a45 Fix PagedArray.merge_unordered() dropping pages 2023-02-16 19:58:27 -05:00
kobewi
277d5361df Add range iterator to LocalVector 2023-01-21 18:42:04 +01:00
Rémi Verschelde
d46568205d
Merge pull request #64795 from RandomShaper/fix_saferefcount
Prevent misuse of SafeRefCount
2023-01-09 14:18:53 +01:00
Pedro J. Estébanez
b1c7665866 Prevent misuse of SafeRefCount 2023-01-09 10:17:55 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Bastiaan Olij
a479f5af22 Improve logic for detecting and tracking extensions 2022-11-24 21:48:16 +11:00
Rémi Verschelde
cd7f172cf8 Merge pull request #66804 from akien-mga/core-remove-NO_SAFE_CAST
Remove unsupported `NO_SAFE_CAST`/`-fno-rtti` from Android build
2022-10-04 10:22:24 +02:00
Rémi Verschelde
54418ea659 Remove NO_THREADS fallback code, Godot 4 requires thread support
This also removes `OS::can_use_threads` from the public API since it's always
true.
2022-10-03 11:23:26 +02:00
Rémi Verschelde
82b87d7a17 Remove unsupported NO_SAFE_CAST/-fno-rtti from Android build
Android was the last platform to still attempt to disable RTTI (for binary
size), but both the Android editor and now the ICU library used by templates
need RTTI.

There could still be the possibility to support this for non-ICU template
builds (i.e. without the TextServerAdvanced module), but since this isn't one
of the build configurations we test regularly it's pretty risky to keep this
option only for that specific use case. And our code is already littered with
`dynamic_cast`s which weren't guarded with `!defined(NO_SAFE_CAST)`.
2022-10-03 11:18:31 +02:00