summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2025-05-23 23:27:11 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2025-06-06 23:03:02 -0500
commit3b83907b88756f9d37ed39fa614efbcdc177e803 (patch)
treeec2046a2dd4521fbf27847df3a01b046323a0014 /Source/Core
parentd940d62caecc9428ae42726575083b82e699e9f4 (diff)
VideoCommon: update CustomAsset's load time to be before the load occurs (this prevents issues where the load time might be incorrectly inflated by long load operations)
Co-authored-by: Jordan Woyak <jordan.woyak@gmail.com>
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/VideoCommon/Assets/CustomAsset.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/Core/VideoCommon/Assets/CustomAsset.cpp b/Source/Core/VideoCommon/Assets/CustomAsset.cpp
index 0fc495fe44..60c7f1ee12 100644
--- a/Source/Core/VideoCommon/Assets/CustomAsset.cpp
+++ b/Source/Core/VideoCommon/Assets/CustomAsset.cpp
@@ -13,12 +13,17 @@ CustomAsset::CustomAsset(std::shared_ptr<CustomAssetLibrary> library,
std::size_t CustomAsset::Load()
{
+ // The load time needs to come from before the data is actually read.
+ // Using a time point from after the read marks the asset as more up-to-date than it actually is,
+ // and has potential to race (and not be updated) if a change happens immediately after load.
+ const auto load_time = ClockType::now();
+
const auto load_information = LoadImpl(m_asset_id);
if (load_information.m_bytes_loaded > 0)
{
std::lock_guard lk(m_info_lock);
m_bytes_loaded = load_information.m_bytes_loaded;
- m_last_loaded_time = ClockType::now();
+ m_last_loaded_time = load_time;
return m_bytes_loaded;
}
return 0;