Commit graph

180 commits

Author SHA1 Message Date
Muller-Castro
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Rémi Verschelde
dc99c8d4a4
Merge pull request #87008 from KoBeWi/cache_mode_replace_fixes²
Fix² behavior of ResourceFormatLoader `CACHE_MODE_REPLACE`
2024-02-13 23:43:18 +01:00
vittorioromeo
71e0082ab0 Extract 'SafeBinaryMutex' to separate header
This change simply extracts 'SafeBinaryMutex' from 'mutex.h' to
    'safe_binary_mutex.h', in an effort to reduce the compilation
    speed impact of including `mutex.h`.
2024-02-04 16:59:54 +01:00
Rémi Verschelde
3dfedd69ea
Merge pull request #87711 from matthew1006/threaded-loading-progress-fix
Fix `ResourceLoader.load_threaded_get_status` returning `[0]` constantly in exported projects.
2024-01-30 17:48:11 +01:00
Rémi Verschelde
b65c495d6e
Merge pull request #86845 from RandomShaper/no_load_regress
Avoid regressing in progress reporting in resource load
2024-01-29 21:33:00 +01:00
Matthew Edwards
7565d1f3ab Push p_original_path into load_paths_stack and sub_tasks instead of p_path. 2024-01-29 17:27:57 +00:00
Rémi Verschelde
dc79e956b6
Merge pull request #86587 from RandomShaper/wtp_enhance
Enhance & fix `WorkerThreadPool`
2024-01-11 17:38:09 +01:00
kobewi
2e09985c0d Fix² behavior of ResourceFormatLoader CACHE_MODE_REPLACE 2024-01-09 16:01:37 +01:00
Rémi Verschelde
9ca3d3ec83
Revert "Fix behavior of ResourceFormatLoader CACHE_MODE_REPLACE" 2024-01-09 10:49:14 +01:00
Pedro J. Estébanez
9444d297ed WorkerThreadPool: Overhaul scheduling and synchronization
This commits rewrites the sync logic in a way that the
`use_system_threads_for_low_priority_tasks` setting, which was added due to
the lack of a cross-platform wait-for-multiple-objects functionality, can be
removed (it's as if it was effectively hardcoded to `false`).

With the new implementation, we have the best of both worlds: threads don't
have to poll, plus no bespoke threads are used.

In addition, regarding deadlock prevention, since not every possible case of
wait-deadlock could be avoided, this commits removes the current best-effort
avoidance mechanisms and keeps only a simple, pessimistic way of detection.

It turns out that the only current user of deadlock prevention, ResourceLoader,
works fine with it and so every possible situation in resource loading is now
properly handled, with no possibilities of deadlocking. There's a comment in
the code with further details.

Lastly, a potential for load tasks never being awaited/disposed is cleared.
2024-01-08 12:45:42 +01:00
Pedro J. Estébanez
f5ca58d32f Avoid regressing in progress reporting in resource load 2024-01-05 19:33:58 +01:00
Yuri Sizov
2e94be2ea4 Merge pull request #84167 from SaracenOne/cache_mode_replace_fixes
Fix behavior of ResourceFormatLoader `CACHE_MODE_REPLACE`
2023-12-08 15:23:13 +01:00
Yuri Sizov
bc1949d797 Correctly check scripts that must inherit EditorPlugin
Also updates some error messages related to this kind of check
across the codebase.
2023-11-23 16:24:43 +01:00
Saracen
f392a9c4f8 Fix CACHE_MODE_REPLACE 2023-11-15 18:55:20 +00:00
Rémi Verschelde
2bcc2a3cd0
Merge pull request #84791 from akien-mga/fix-translation-remapping-check
Fix translation remapping check for imported resources
2023-11-12 23:00:08 +01:00
Rémi Verschelde
2729a78fd7
Fix translation remapping check for imported resources
Fixes #81660.
2023-11-12 13:17:12 +01:00
kobewi
a3627b6e37 Assign temporary path to preloaded resources 2023-11-10 00:43:30 +01:00
Haoyu Qiu
dc7e309f48 Fix heap-use-after-free when resource loaded with load_threaded_request is never fetched
Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2023-10-23 16:21:17 +08:00
A Thousand Ships
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
Yuri Sizov
d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Hugo Locurcio
5bf64255b0
Mention expected resource type in ResourceLoader load error
This helps troubleshoot issues due to incorrect import types.
2023-07-21 04:45:34 +02:00
Rémi Verschelde
cdd2313ba2
Merge pull request #78977 from RandomShaper/workaround_tls_shutdown
Workaround resource loading crashes due to buggy TLS
2023-07-03 19:43:07 +02:00
Pedro J. Estébanez
41c0785636 Workaround resource loading crashes due to buggy TLS 2023-07-03 13:54:55 +02:00
Pedro J. Estébanez
30925fcfb0 Fix management of safe-for-nodes flag in ResourceLoader and WorkerThreadPool 2023-07-03 12:27:57 +02:00
Pedro J. Estébanez
2b001db76e Let user scripts disable thread safety checks 2023-06-09 18:24:01 +02:00
Pedro J. Estébanez
e725b4b02b Allow threads to mark themselves as safe for nodes 2023-05-24 00:22:58 +02:00
Pedro J. Estébanez
c450260e3e Fix message queue issues
- Missing flush in resource loading.
- Wrong checks about message queue instance.
2023-05-19 13:11:34 +02:00
Pedro J. Estébanez
a6e43f71b6 Avoid multiple possibilites of deadlock in resource loading 2023-05-17 01:52:39 +02:00
Pedro J. Estébanez
7537a0521f Simplify ResourceLoader error callbacks 2023-05-12 17:44:48 +02:00
Pedro J. Estébanez
045401c64e Use WorkerThreadPool for threaded resource loading 2023-05-10 18:53:41 +02:00
Pedro J. Estébanez
5a4613f551 Avoid sync issues in resources with deferred updates 2023-05-10 18:53:41 +02:00
Pedro J. Estébanez
8983b20ccd Avoid interaction issues between resource loading threads 2023-05-10 18:53:41 +02:00
Rémi Verschelde
cef3587427
Merge pull request #74120 from RandomShaper/res_loader_teardown
Clear resource load tasks at exit
2023-04-03 15:59:51 +02:00
Rémi Verschelde
bdb3738023
Merge pull request #74166 from RandomShaper/fix_res_loader_read_freed
Fix crash in resource load
2023-03-03 11:06:15 +01:00
Rémi Verschelde
4fceabc30c
Merge pull request #73862 from RandomShaper/fix_subthreaded_res_load
Lift restriction that resource load thread requester has to be the initiator
2023-03-02 11:26:54 +01:00
Pedro J. Estébanez
047671df0f Fix crash in resource load 2023-03-01 18:30:16 +01:00
Pedro J. Estébanez
b8b6a05c17 Clear resource load tasks at exit 2023-02-28 18:56:21 +01:00
Pedro J. Estébanez
b60197d1c6 Fix deadlock in cyclic resource load 2023-02-26 17:19:48 +01:00
Pedro J. Estébanez
c51229491d Lift restriction that resource load thread requester has to be the initiator 2023-02-24 13:19:31 +01:00
Pedro J. Estébanez
b862fc8c9b Fix cases of resource load tasks not being awaitable 2023-02-20 21:20:05 +01:00
Pedro J. Estébanez
618bb173ba Fix race condition in resource loader when a load task is reused 2023-02-20 21:20:05 +01:00
Raul Santos
9e9eac4676
Use enum instead of int in virtual methods return type 2023-01-31 19:06:49 +01:00
Rémi Verschelde
ebd0b40f6e
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
2023-01-21 16:54:23 +01:00
Juan Linietsky
dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
kobewi
c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +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
Adam Scott
4a16b8630e Fix ResourceLoader::thread_load_tasks crash 2022-12-07 16:59:10 -05:00
Rémi Verschelde
5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
kobewi
d06a8320e5 Simplify GDVIRTUAL_CALL calls 2022-10-19 00:05:48 +02:00
kobewi
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00