Commit Graph

161 Commits

Author SHA1 Message Date
A Thousand Ships b5e7b2c7a7
[Core] Fix crash when hashing empty `CharString`
(cherry picked from commit ca5ec6aec1)
2023-12-07 10:27:05 +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
bruvzg ea1848ce0a
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00
Rémi Verschelde e5857bd6c7 Merge pull request #66548 from akien-mga/msvc-warnings-c4701-c4703
Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used
2022-09-28 20:47:50 +02:00
Rémi Verschelde 85fe6ecc32 Fix MSVC warnings C4701 and C4703: Potentially uninitialized variable used 2022-09-28 17:05:34 +02:00
Rémi Verschelde 0e53dd642c Fix MSVC warning C4706: assignment within conditional expression
Part of #66537.
2022-09-28 16:05:07 +02:00
Rémi Verschelde 49fcf4ffad Style: Cleanup header guards for consistency
Fix file names for {Static,Lightmap}RaycasterEmbree.
2022-09-26 13:51:17 +02:00
Juan Linietsky f999f52f0a Add a Framebuffer cache
Adds a FramebufferCache singletion that operates the same way as UniformSetCache.

Allows creating framebuffers on the fly (and keep them cached if re-requested) such as:

```C++
RID fb = FramebufferCache::get_singleton()->get_cache(texture1,texture2);
```
2022-08-05 13:37:29 +02:00
Rémi Verschelde 57aac04480
Merge pull request #63906 from Faless/fix/4.x_warnings 2022-08-04 15:16:00 +02:00
Fabio Alessandrelli 6f02183f8c [Core] Use std type traits to check operations triviality. 2022-08-04 14:05:17 +02:00
Rémi Verschelde c717d5c64b Arrays: Zero new items of trivial types on resize() (bindings only)
This is not enabled by default in the core version for performance reasons,
as Vector/CowData are used in critical code paths where not zero'ing memory
which is going to be set later on can be important.

But for bindings / the scripting API, we make zero the new items by default
(which already happened for built types like Vector3, etc., but not for
trivial types like int, float).

Fixes #43033.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
2022-08-04 13:35:37 +02:00
Rémi Verschelde 33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
Juan Linietsky c7255388e1 Remove ThreadWorkPool, replace by WorkerThreadPool
The former needs to be allocated once per usage. The later is shared for all threads, which is more efficient.
It can also be better debugged.
2022-07-25 15:39:50 +02:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz 455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
reduz 67a260d63f Implement a Worker ThreadPool
This PR implements a worked thread pool. It uses a fixed amount of threads in a pool and allows scheduling tasks
that can be run on threads (and then waited for). It satisfies the following use cases:

* HTML5 thread count is fixed (and similar restrictions are known in consoles) so we need to reuse threads.
* Thread spawning is slow in general, so reusing threads is faster anyway.
* This implementation supports recursive waiting for tasks, making it less prone to deadlocks if threads from the pool also run tasks.

After this is approved and merged, subsequent PRs will be needed to replace the ThreadWorkPool usage by this class.
2022-07-22 11:46:48 +02:00
Pedro J. Estébanez 02a584d8e6 Use the right memory ordering in SafeNumeric operations 2022-07-19 10:04:59 +02:00
bruvzg 344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
lawnjelly b221eab426 Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
2022-07-04 12:01:46 +01:00
bruvzg 329923c6ac
Use custom key structs, instead of raw hashes for the Label3D and TextMesh, to avoid potential hash collisions. 2022-07-04 09:47:49 +03:00
Rémi Verschelde 88192269a8
Merge pull request #62477 from lyuma/packedbytearray
Prevent out-of-bounds write in array conversion; avoid logspam on empty arrays.
2022-07-01 09:03:20 +02:00