mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 06:48:33 +00:00
VideoCommon: call into graphics mods create texture callback, providing additional asset dependencies that trigger the texture to be reloaded
This commit is contained in:
parent
6d7bf60071
commit
0539bb4a3e
3 changed files with 54 additions and 0 deletions
|
@ -272,6 +272,15 @@ bool TextureCacheBase::DidLinkedAssetsChange(const TCacheEntry& entry)
|
|||
}
|
||||
}
|
||||
|
||||
for (const auto& cached_asset : entry.linked_asset_dependencies)
|
||||
{
|
||||
if (cached_asset.m_asset)
|
||||
{
|
||||
if (cached_asset.m_asset->GetLastLoadedTime() > cached_asset.m_cached_write_time)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1612,6 +1621,39 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<VideoCommon::CachedAsset<VideoCommon::CustomAsset>> additional_dependencies;
|
||||
|
||||
std::string texture_name = "";
|
||||
|
||||
if (g_ActiveConfig.bGraphicMods)
|
||||
{
|
||||
u32 height = texture_info.GetRawHeight();
|
||||
u32 width = texture_info.GetRawWidth();
|
||||
if (hires_texture)
|
||||
{
|
||||
auto asset = hires_texture->GetAsset();
|
||||
if (asset)
|
||||
{
|
||||
auto data = asset->GetData();
|
||||
if (data)
|
||||
{
|
||||
if (!data->m_levels.empty())
|
||||
{
|
||||
height = data->m_levels[0].height;
|
||||
width = data->m_levels[0].width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
texture_name = texture_info.CalculateTextureName().GetFullName();
|
||||
GraphicsModActionData::TextureCreate texture_create{
|
||||
texture_name, width, height, &cached_game_assets, &additional_dependencies};
|
||||
for (const auto& action : g_graphics_mod_manager->GetTextureCreateActions(texture_name))
|
||||
{
|
||||
action->OnTextureCreate(&texture_create);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& cached_asset : cached_game_assets)
|
||||
{
|
||||
auto data = cached_asset.m_asset->GetData();
|
||||
|
@ -1628,6 +1670,8 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
|
|||
TextureCreationInfo{base_hash, full_hash, bytes_per_block, palette_size}, texture_info,
|
||||
textureCacheSafetyColorSampleSize, std::move(data_for_assets), has_arbitrary_mipmaps);
|
||||
entry->linked_game_texture_assets = std::move(cached_game_assets);
|
||||
entry->linked_asset_dependencies = std::move(additional_dependencies);
|
||||
entry->texture_info_name = std::move(texture_name);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue