Expand Up @@ -423,23 +423,24 @@ void CustomPipelineAction::OnTextureCreate(GraphicsModActionData::TextureCreate*
auto data = game_texture.m_asset->GetData();
if (data)
{
if (data->m_slices.empty() || data->m_slices[0].m_levels.empty())
if (data->m_texture.m_slices.empty() || data->m_texture.m_slices[0].m_levels.empty())
{
ERROR_LOG_FMT(
VIDEO,
"Custom pipeline for texture '{}' has asset '{}' that does not have any texture data",
create->texture_name, game_texture.m_asset->GetAssetId());
m_valid = false;
}
else if (create->texture_width != data->m_slices[0].m_levels[0].width ||
create->texture_height != data->m_slices[0].m_levels[0].height)
else if (create->texture_width != data->m_texture.m_slices[0].m_levels[0].width ||
create->texture_height != data->m_texture.m_slices[0].m_levels[0].height)
{
ERROR_LOG_FMT(VIDEO,
"Custom pipeline for texture '{}' has asset '{}' that does not match "
"the width/height of the texture loaded. Texture {}x{} vs asset {}x{}",
create->texture_name, game_texture.m_asset->GetAssetId(),
create->texture_width, create->texture_height,
data->m_slices[0].m_levels[0].width, data->m_slices[0].m_levels[0].height);
data->m_texture.m_slices[0].m_levels[0].width,
data->m_texture.m_slices[0].m_levels[0].height);
m_valid = false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/HiresTextures.cpp
Expand Up @@ -130,8 +130,8 @@ void HiresTexture::Update()
{
// Since this is just a texture (single file) the mapper doesn't really matter
// just provide a string
s_file_library->SetAssetIDMapData(
filename, std::map<std::string, std::filesystem::path>{{"", StringToPath(path)}});
s_file_library->SetAssetIDMapData(filename, std::map<std::string, std::filesystem::path>{
{"texture", StringToPath(path)}});

if (g_ActiveConfig.bCacheHiresTextures)
{
Expand Down
17 changes: 8 additions & 9 deletions Source/Core/VideoCommon/TextureCacheBase.cpp
Expand Up @@ -1606,7 +1606,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
}

std::vector<VideoCommon::CachedAsset<VideoCommon::GameTextureAsset>> cached_game_assets;
std::vector<std::shared_ptr<VideoCommon::CustomTextureData>> data_for_assets;
std::vector<VideoCommon::CustomTextureData*> data_for_assets;
bool has_arbitrary_mipmaps = false;
bool skip_texture_dump = false;
std::shared_ptr<HiresTexture> hires_texture;
Expand Down Expand Up @@ -1640,12 +1640,12 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
auto data = asset->GetData();
if (data)
{
if (!data->m_slices.empty())
if (!data->m_texture.m_slices.empty())
{
if (!data->m_slices[0].m_levels.empty())
if (!data->m_texture.m_slices[0].m_levels.empty())
{
height = data->m_slices[0].m_levels[0].height;
width = data->m_slices[0].m_levels[0].width;
height = data->m_texture.m_slices[0].m_levels[0].height;
width = data->m_texture.m_slices[0].m_levels[0].width;
}
}
}
Expand All @@ -1667,7 +1667,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
{
if (cached_asset.m_asset->Validate(texture_info.GetRawWidth(), texture_info.GetRawHeight()))
{
data_for_assets.push_back(std::move(data));
data_for_assets.push_back(&data->m_texture);
}
}
}
Expand All @@ -1687,8 +1687,7 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp
// expected because each texture is loaded into a texture array
RcTcacheEntry TextureCacheBase::CreateTextureEntry(
const TextureCreationInfo& creation_info, const TextureInfo& texture_info,
const int safety_color_sample_size,
std::vector<std::shared_ptr<VideoCommon::CustomTextureData>> assets_data,
const int safety_color_sample_size, std::vector<VideoCommon::CustomTextureData*> assets_data,
const bool custom_arbitrary_mipmaps, bool skip_texture_dump)
{
#ifdef __APPLE__
Expand All @@ -1705,7 +1704,7 @@ RcTcacheEntry TextureCacheBase::CreateTextureEntry(
assets_data.begin(), assets_data.end(), [](const auto& lhs, const auto& rhs) {
return lhs->m_slices[0].m_levels.size() < rhs->m_slices[0].m_levels.size();
});
return max_element->get()->m_slices[0].m_levels.size();
return (*max_element)->m_slices[0].m_levels.size();
};
const u32 texLevels = no_mips ? 1 : (u32)calculate_max_levels();
const auto& first_level = assets_data[0]->m_slices[0].m_levels[0];
Expand Down
9 changes: 4 additions & 5 deletions Source/Core/VideoCommon/TextureCacheBase.h
Expand Up @@ -346,11 +346,10 @@ class TextureCacheBase

void SetBackupConfig(const VideoConfig& config);

RcTcacheEntry
CreateTextureEntry(const TextureCreationInfo& creation_info, const TextureInfo& texture_info,
int safety_color_sample_size,
std::vector<std::shared_ptr<VideoCommon::CustomTextureData>> assets_data,
bool custom_arbitrary_mipmaps, bool skip_texture_dump);
RcTcacheEntry CreateTextureEntry(const TextureCreationInfo& creation_info,
const TextureInfo& texture_info, int safety_color_sample_size,
std::vector<VideoCommon::CustomTextureData*> assets_data,
bool custom_arbitrary_mipmaps, bool skip_texture_dump);

RcTcacheEntry GetXFBFromCache(u32 address, u32 width, u32 height, u32 stride);

Expand Down
2 changes: 1 addition & 1 deletion docs/CustomPipelineGraphicsMod.md
Expand Up @@ -44,7 +44,7 @@ A full example is given below:
"name": "normal_texture",
"data":
{
"": "normal_texture.png"
"texture": "normal_texture.png"
}
}
],
Expand Down