Commit Graph

186 Commits

Author SHA1 Message Date
00cc0a3e8f Merge pull request #90091 from ajreckof/Fix-load-subtask-not-being-registered-leading-to-false-progress-values-
Fix load subtask not being registered leading to false progress values.
2024-04-24 18:55:04 +02:00
ca020ad8cd Fix load subtask not being registered leading to false progress values. 2024-04-13 01:42:29 +02:00
64146cb7f3 [Core] Add iteration support to Array 2024-04-10 14:49:34 +02:00
0274877def [Core] Fix ResourceLoader.load cache with relative paths
Paths were not simplified meaning that `res://foo.bar` was treated
differently from `./foo.bar` and similar
2024-03-30 12:50:08 +01:00
5e144022e7 Enhance cache modes in resource loading
- Unify documentation, hoping to clear misconcepctions about about propagation of the cache mode across dependant loads.
- Clarify in docs that `CACHE_MODE_REPLACE` now also works on the main resource (from #87008).
- Add two recursive modes, counterparts of `CACHE_MODE_REPLACE` and `CACHE_MODE_IGNORE`, since it seems some need them (see #59669, #82830).
- Let resources, even loaded with one of the ignore-cache modes, get a path, which is useful for tools.
2024-02-26 14:59:04 +01:00
851f1d49d7 Remove spammy dev-mode message about load deadlock prevention 2024-02-23 14:54:03 +01:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
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
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
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
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
7565d1f3ab Push p_original_path into load_paths_stack and sub_tasks instead of p_path. 2024-01-29 17:27:57 +00:00
dc79e956b6 Merge pull request #86587 from RandomShaper/wtp_enhance
Enhance & fix `WorkerThreadPool`
2024-01-11 17:38:09 +01:00
2e09985c0d Fix² behavior of ResourceFormatLoader CACHE_MODE_REPLACE 2024-01-09 16:01:37 +01:00
9ca3d3ec83 Revert "Fix behavior of ResourceFormatLoader CACHE_MODE_REPLACE" 2024-01-09 10:49:14 +01:00
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
f5ca58d32f Avoid regressing in progress reporting in resource load 2024-01-05 19:33:58 +01:00
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
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
f392a9c4f8 Fix CACHE_MODE_REPLACE 2023-11-15 18:55:20 +00:00
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
2729a78fd7 Fix translation remapping check for imported resources
Fixes #81660.
2023-11-12 13:17:12 +01:00
a3627b6e37 Assign temporary path to preloaded resources 2023-11-10 00:43:30 +01:00
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
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
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
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
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
41c0785636 Workaround resource loading crashes due to buggy TLS 2023-07-03 13:54:55 +02:00
30925fcfb0 Fix management of safe-for-nodes flag in ResourceLoader and WorkerThreadPool 2023-07-03 12:27:57 +02:00
2b001db76e Let user scripts disable thread safety checks 2023-06-09 18:24:01 +02:00
e725b4b02b Allow threads to mark themselves as safe for nodes 2023-05-24 00:22:58 +02:00
c450260e3e Fix message queue issues
- Missing flush in resource loading.
- Wrong checks about message queue instance.
2023-05-19 13:11:34 +02:00
a6e43f71b6 Avoid multiple possibilites of deadlock in resource loading 2023-05-17 01:52:39 +02:00
7537a0521f Simplify ResourceLoader error callbacks 2023-05-12 17:44:48 +02:00
045401c64e Use WorkerThreadPool for threaded resource loading 2023-05-10 18:53:41 +02:00
5a4613f551 Avoid sync issues in resources with deferred updates 2023-05-10 18:53:41 +02:00
8983b20ccd Avoid interaction issues between resource loading threads 2023-05-10 18:53:41 +02:00
cef3587427 Merge pull request #74120 from RandomShaper/res_loader_teardown
Clear resource load tasks at exit
2023-04-03 15:59:51 +02:00
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
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
047671df0f Fix crash in resource load 2023-03-01 18:30:16 +01:00
b8b6a05c17 Clear resource load tasks at exit 2023-02-28 18:56:21 +01:00
b60197d1c6 Fix deadlock in cyclic resource load 2023-02-26 17:19:48 +01:00
c51229491d Lift restriction that resource load thread requester has to be the initiator 2023-02-24 13:19:31 +01:00
b862fc8c9b Fix cases of resource load tasks not being awaitable 2023-02-20 21:20:05 +01:00
618bb173ba Fix race condition in resource loader when a load task is reused 2023-02-20 21:20:05 +01:00
9e9eac4676 Use enum instead of int in virtual methods return type 2023-01-31 19:06:49 +01:00
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
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