VideoCommon: call texture load graphics mod hook when Dolphin loads a texture
This commit is contained in:
parent
8efd7833e5
commit
ea3e133200
|
@ -35,7 +35,10 @@ void PrintAction::OnProjectionAndTexture(GraphicsModActionData::Projection*)
|
||||||
INFO_LOG_FMT(VIDEO, "OnProjectionAndTexture Called");
|
INFO_LOG_FMT(VIDEO, "OnProjectionAndTexture Called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintAction::OnTextureLoad()
|
void PrintAction::OnTextureLoad(GraphicsModActionData::TextureLoad* texture_load)
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(VIDEO, "OnTextureLoad Called");
|
if (!texture_load) [[unlikely]]
|
||||||
|
return;
|
||||||
|
|
||||||
|
INFO_LOG_FMT(VIDEO, "OnTextureLoad Called. Texture: {}", texture_load->texture_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ public:
|
||||||
void OnEFB(GraphicsModActionData::EFB*) override;
|
void OnEFB(GraphicsModActionData::EFB*) override;
|
||||||
void OnProjection(GraphicsModActionData::Projection*) override;
|
void OnProjection(GraphicsModActionData::Projection*) override;
|
||||||
void OnProjectionAndTexture(GraphicsModActionData::Projection*) override;
|
void OnProjectionAndTexture(GraphicsModActionData::Projection*) override;
|
||||||
void OnTextureLoad() override;
|
void OnTextureLoad(GraphicsModActionData::TextureLoad*) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,6 @@ public:
|
||||||
virtual void OnXFB() {}
|
virtual void OnXFB() {}
|
||||||
virtual void OnProjection(GraphicsModActionData::Projection*) {}
|
virtual void OnProjection(GraphicsModActionData::Projection*) {}
|
||||||
virtual void OnProjectionAndTexture(GraphicsModActionData::Projection*) {}
|
virtual void OnProjectionAndTexture(GraphicsModActionData::Projection*) {}
|
||||||
virtual void OnTextureLoad() {}
|
virtual void OnTextureLoad(GraphicsModActionData::TextureLoad*) {}
|
||||||
virtual void OnFrameEnd() {}
|
virtual void OnFrameEnd() {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Matrix.h"
|
#include "Common/Matrix.h"
|
||||||
|
|
||||||
|
@ -26,4 +28,8 @@ struct Projection
|
||||||
{
|
{
|
||||||
Common::Matrix44* matrix;
|
Common::Matrix44* matrix;
|
||||||
};
|
};
|
||||||
|
struct TextureLoad
|
||||||
|
{
|
||||||
|
std::string_view texture_name;
|
||||||
|
};
|
||||||
} // namespace GraphicsModActionData
|
} // namespace GraphicsModActionData
|
||||||
|
|
|
@ -46,11 +46,11 @@ public:
|
||||||
return;
|
return;
|
||||||
m_action_impl->OnProjectionAndTexture(projection);
|
m_action_impl->OnProjectionAndTexture(projection);
|
||||||
}
|
}
|
||||||
void OnTextureLoad() override
|
void OnTextureLoad(GraphicsModActionData::TextureLoad* texture_load) override
|
||||||
{
|
{
|
||||||
if (!m_mod.m_enabled)
|
if (!m_mod.m_enabled)
|
||||||
return;
|
return;
|
||||||
m_action_impl->OnTextureLoad();
|
m_action_impl->OnTextureLoad(texture_load);
|
||||||
}
|
}
|
||||||
void OnFrameEnd() override
|
void OnFrameEnd() override
|
||||||
{
|
{
|
||||||
|
@ -105,8 +105,8 @@ GraphicsModManager::GetDrawStartedActions(const std::string& texture_name) const
|
||||||
const std::vector<GraphicsModAction*>&
|
const std::vector<GraphicsModAction*>&
|
||||||
GraphicsModManager::GetTextureLoadActions(const std::string& texture_name) const
|
GraphicsModManager::GetTextureLoadActions(const std::string& texture_name) const
|
||||||
{
|
{
|
||||||
if (const auto it = m_load_target_to_actions.find(texture_name);
|
if (const auto it = m_load_texture_target_to_actions.find(texture_name);
|
||||||
it != m_load_target_to_actions.end())
|
it != m_load_texture_target_to_actions.end())
|
||||||
{
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ void GraphicsModManager::Load(const GraphicsModGroupConfig& config)
|
||||||
m_actions.back().get());
|
m_actions.back().get());
|
||||||
},
|
},
|
||||||
[&](const LoadTextureTarget& the_target) {
|
[&](const LoadTextureTarget& the_target) {
|
||||||
m_load_target_to_actions[the_target.m_texture_info_string].push_back(
|
m_load_texture_target_to_actions[the_target.m_texture_info_string].push_back(
|
||||||
m_actions.back().get());
|
m_actions.back().get());
|
||||||
},
|
},
|
||||||
[&](const EFBTarget& the_target) {
|
[&](const EFBTarget& the_target) {
|
||||||
|
@ -272,7 +272,7 @@ void GraphicsModManager::Reset()
|
||||||
m_projection_target_to_actions.clear();
|
m_projection_target_to_actions.clear();
|
||||||
m_projection_texture_target_to_actions.clear();
|
m_projection_texture_target_to_actions.clear();
|
||||||
m_draw_started_target_to_actions.clear();
|
m_draw_started_target_to_actions.clear();
|
||||||
m_load_target_to_actions.clear();
|
m_load_texture_target_to_actions.clear();
|
||||||
m_efb_target_to_actions.clear();
|
m_efb_target_to_actions.clear();
|
||||||
m_xfb_target_to_actions.clear();
|
m_xfb_target_to_actions.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ private:
|
||||||
std::unordered_map<std::string, std::vector<GraphicsModAction*>>
|
std::unordered_map<std::string, std::vector<GraphicsModAction*>>
|
||||||
m_projection_texture_target_to_actions;
|
m_projection_texture_target_to_actions;
|
||||||
std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_draw_started_target_to_actions;
|
std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_draw_started_target_to_actions;
|
||||||
std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_load_target_to_actions;
|
std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_load_texture_target_to_actions;
|
||||||
std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_efb_target_to_actions;
|
std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_efb_target_to_actions;
|
||||||
std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_xfb_target_to_actions;
|
std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_xfb_target_to_actions;
|
||||||
|
|
||||||
|
|
|
@ -1243,6 +1243,13 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture
|
||||||
if (entry->texture_info_name.empty() && g_ActiveConfig.bGraphicMods)
|
if (entry->texture_info_name.empty() && g_ActiveConfig.bGraphicMods)
|
||||||
{
|
{
|
||||||
entry->texture_info_name = texture_info.CalculateTextureName().GetFullName();
|
entry->texture_info_name = texture_info.CalculateTextureName().GetFullName();
|
||||||
|
|
||||||
|
GraphicsModActionData::TextureLoad texture_load{entry->texture_info_name};
|
||||||
|
for (const auto action :
|
||||||
|
g_renderer->GetGraphicsModManager().GetTextureLoadActions(entry->texture_info_name))
|
||||||
|
{
|
||||||
|
action->OnTextureLoad(&texture_load);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bound_textures[texture_info.GetStage()] = entry;
|
bound_textures[texture_info.GetStage()] = entry;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue