summaryrefslogtreecommitdiffstats
path: root/core/io/resource_loader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Revert "Return error when no ResourceFormatLoader found."Rémi Verschelde2024-09-191-4/+0
| | | | | | This reverts commit 6df3621b472f7033de9d8391a2057a64aa5a42d6. Fixes #97153.
* ResourceLoader: Fixup resource changed feature (no. 2)Pedro J. Estébanez2024-09-131-1/+1
|
* Merge pull request #96617 from RandomShaper/res_loader_pendingRémi Verschelde2024-09-061-0/+10
|\ | | | | | | ResourceLoader: Add last resort life-time insurance for tokens
| * ResourceLoader: Add last resort life-time insurance for tokensPedro J. Estébanez2024-09-061-0/+10
| |
* | ResourceLoader: Fixup resource changed featurePedro J. Estébanez2024-09-061-0/+4
|/ | | | This is a complement to: https://github.com/godotengine/godot/pull/96593
* ResourceLoader: Add thread-aware resource changed mechanismPedro J. Estébanez2024-09-061-0/+84
|
* ResourceLoader: Simplify handling of unregistered tasksPedro J. Estébanez2024-09-051-39/+31
|
* Use `MutexLock` in more placesA Thousand Ships2024-08-291-33/+31
|
* ResourceLoader: Handle another case of user tokensPedro J. Estébanez2024-08-281-0/+5
|
* Fix ResourceLoader is not verbosely printing a resource path on loadingKongfa Waroros2024-08-281-0/+7
|
* Merge pull request #93739 from AThousandShips/lock_unlockRémi Verschelde2024-08-261-8/+7
|\ | | | | | | [Core] Allow locking/unlocking of `MutexLock`
| * [Core] Allow locking/unlocking of `MutexLock`A Thousand Ships2024-08-261-8/+7
| |
* | Merge pull request #93064 from ↵Rémi Verschelde2024-08-261-29/+32
|\ \ | |/ |/| | | | | | | Hilderin/fix-fileSystem-dock-wont-show-any-file-folders Fix FileSystem dock won't show any file folders (v2)
| * Fix FileSystem dock won't show any file folders (v2)Hilderin2024-08-201-29/+32
| |
* | WorkerThreadPool (plus friends): Overhaul unlock allowance zonesPedro J. Estébanez2024-08-211-1/+5
| | | | | | | | This fixes a rare but possible deadlock, maybe due to undefined behavior. The new implementation is safer, at the cost of some added boilerplate.
* | ResourceLoader: Fix edge cases in the management of user tokensPedro J. Estébanez2024-08-211-83/+95
| | | | | | | | | | | | | | | | | | | | | | 1. Make handling of user tokens atomic: Loads started with the external-facing API used to perform a two-step setup of the user token. Between both, the mutex was unlocked without its reference count having been increased. A non-user-initiated load could therefore destroy the load task when it unreferenced the token. Those stages now happen atomically so in the one hand, the described race condition can't happen so the load task life insurance doesn't have a gap anymore and, on the other hand, the ugliness that the call to load could return `ERR_BUSY` if happening while other thread was between both steps is gone. The code has been refactored so the user token concerns are still outside the inner load start function, which is agnostic to that for a cleaner implementation. 2. Clear ambiguity between load operations running on `WorkerThreadPool`: The two cases are: single-loaded thread directly started by a user pool task and a load started by the system as part of a multi-threaded load. Since ensuring all the code dealing with this distinction would make it very complex, and error-prone, a different measure is applied instead: just take one of the cases out of the dicotomy. We now ensure every load happening on a pool thread has been initiated by the system. The way of achieving that is that a single-threaded user-started load initiated from a pool thread, is run as another task.
* | ResourceLoader: Optimize remap check by deferring until a non-mutex zonePedro J. Estébanez2024-08-211-4/+5
| |
* | ResourceLoader: Enhance deadlock preventionPedro J. Estébanez2024-08-211-18/+34
| | | | | | | | | | | | | | | | Benefits: - Simpler code. The main load function is renamed so it's apparent that it's not just a thread entry point anymore. - Cache and thread modes of the original task are honored. A beautiful consequence of this is that, unlike formerly, re-issued loads can use the resource cache, which makes this mechanism much more performant. - The newly added getter for caller task id in WorkerThreadPool allows to remove the custom tracking of that in ResourceLoader. - The check to replace a cached resource and the replacement itself happen atomically. That fixes deadlock prevention leading to multiple resource instances of the same one on disk. As a side effect, it also makes the regular check for replace load mode more robust.
* | ResourceLoader: Properly push & pop TLS state on recursive load tasksPedro J. Estébanez2024-08-211-0/+22
| |
* | Merge pull request #94801 from gamelessone/fix-cond-varRémi Verschelde2024-08-211-8/+12
|\ \ | | | | | | Fix use-after-free of `ConditionVariable` in `ResourceLoader`
| * | Fix use condition_variable after freeAleksey Vasenev2024-07-301-8/+12
| | |
* | | Merge pull request #95508 from Summersay415/loaded-when-notRémi Verschelde2024-08-191-0/+4
|\ \ \ | | | | | | | | | | | | Return error when no ResourceFormatLoader found
| * | | Return error when no ResourceFormatLoader found.Summersay4152024-08-141-0/+4
| | |/ | |/|
* | | ResourceLoader: Revert workaround resource loading crashes due to buggy TLSPedro J. Estébanez2024-08-191-11/+7
| | | | | | | | | | | | This reverts commit 41c07856361d7cf2bcbda6d84386b1a0d3969f6a.
* | | Merge pull request #95549 from timothyqiu/split-translation-serverRémi Verschelde2024-08-161-1/+1
|\ \ \ | | | | | | | | | | | | Split `TranslationServer` into its own file
| * | | Split TranslationServer into its own fileHaoyu Qiu2024-08-151-1/+1
| |/ /
* | | Merge pull request #95477 from RandomShaper/res_load_dev_bugsRémi Verschelde2024-08-161-12/+2
|\ \ \ | |/ / |/| | | | | ResourceLoader: Use better error handling for possible engine bugs
| * | ResourceLoader: Use better error handling for possible engine bugsPedro J. Estébanez2024-08-131-12/+2
| | |
* | | ResourceLoader: Fix error on querying progress for uncached loadsPedro J. Estébanez2024-08-131-4/+6
|/ /
* | [ResourceLoader] Add check to prevent double free crashes.bruvzg2024-08-061-2/+5
| |
* | ResourceLoader: Let resource setup late steps invoke loading in turnPedro J. Estébanez2024-07-291-1/+13
|/
* ResourceLoader: Fix sync issues with error reportingPedro J. Estébanez2024-07-191-2/+4
| | | | | | This is about not letting the resource format loader set the error code directly on the task anymore. Instead, it's stored locally and assigned only when it is right to do so. Otherwise, other tasks may see an error code in the current one before it's state having transitioned to errored. While this, besides the technically true data race, may not be a problem in practice, it causes surprising situations during debugging as it breaks assumptions.
* Fixup recent changes to threading concernsPedro J. Estébanez2024-07-161-39/+39
| | | | | | | | | | | | | | ResourceLoader: - Fix invalid tokens being returned. - Remove no longer written `ThreadLoadTask::dependent_path` and the code reading from it. - Clear deadlock hazard by keeping the mutex unlocked during userland polling. WorkerThreadPool: - Include thread call queue override in the thread state reset set, which allows to simplify the code that handled that (imperfectly) in the ResourceLoader. - Handle the mutex type correctly on entering an allowance zone. CommandQueueMT: - Handle the additional possibility of command buffer reallocation that mutex unlock allowance introduces.
* ResourceLoader: Fix error message due to already-awaited tasks being re-awaitedPedro J. Estébanez2024-07-081-1/+1
|
* ResourceLoader: Fixup management of thread-specific statusPedro J. Estébanez2024-07-081-5/+2
| | | | | - Allows the message queue override to flush after loading each resource, which was the original intent. - Removes a redundant call to mark the thread as safe-for-nodes.
* ResourceLoader: Support polling and get-before-complete on the main threadPedro J. Estébanez2024-06-281-0/+37
|
* GDScript: Enhance handling of cyclic dependenciesPedro J. Estébanez2024-06-261-0/+36
|
* ResourceLoader: Fix handling of uncached loadsPedro J. Estébanez2024-06-241-14/+12
| | | | | - `CACHE_MODE_IGNORE_DEEP` is checked in addition to `CACHE_MODE_IGNORE` to determine if a load is uncached. This avoids crashes in uncached loads due to prematurely freed load tasks. - Cached load tasks are isolated (not registered in the task map ever). This avoids regular loads from reusing in-flight cached loads, which is not correct.
* Merge pull request #93124 from RandomShaper/skull_trioRémi Verschelde2024-06-141-7/+13
|\ | | | | | | `ResourceLoader`: Let the caller thread use its own message queue override
| * ResourceLoader: Let the caller thread use its own message queue overridePedro J. Estébanez2024-06-131-7/+12
| |
| * WorkerThreadPool: Fix thread message queue not restored after overridden in ↵Pedro J. Estébanez2024-06-131-0/+1
| | | | | | | | | | | | a task Also, simplifies the thread override teardown in MessageQueue.
* | ResourceLoader: Avoid deadlock when awaiting a loader thread that failed earlyPedro J. Estébanez2024-06-121-26/+37
|/
* Revert "Fix FileSystem dock won't show any file folders"Rémi Verschelde2024-06-111-32/+29
| | | | | | This reverts commit 72856d633a6be5c596d4a3231acab009828a2efe. Fixes #93022.
* Fix FileSystem dock won't show any file foldersHilderin2024-06-101-29/+32
|
* Merge pull request #90091 from ↵Rémi Verschelde2024-04-241-4/+8
|\ | | | | | | | | | | ajreckof/Fix-load-subtask-not-being-registered-leading-to-false-progress-values- Fix load subtask not being registered leading to false progress values.
| * Fix load subtask not being registered leading to false progress values.ajreckof2024-04-131-4/+8
| |
* | [Core] Add iteration support to `Array`A Thousand Ships2024-04-101-2/+3
| |
* | [Core] Fix `ResourceLoader.load` cache with relative pathsA Thousand Ships2024-03-301-1/+1
|/ | | | | Paths were not simplified meaning that `res://foo.bar` was treated differently from `./foo.bar` and similar
* Enhance cache modes in resource loadingPedro J. Estébanez2024-02-261-5/+9
| | | | | | | - 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.