Merge pull request #14291 from JosJuice/defer-textureinfo
VideoCommon: Defer creating TextureInfo
This commit is contained in:
3 files changed
+12
-13
No files matched your search
@@ -1231,9 +1231,9 @@ private:
|
|||||||
std::vector<Level> levels;
|
std::vector<Level> levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture_info)
|
TCacheEntry* TextureCacheBase::Load(u32 stage)
|
||||||
{
|
{
|
||||||
if (auto entry = LoadImpl(texture_info, false))
|
if (auto entry = LoadImpl(stage, false))
|
||||||
{
|
{
|
||||||
if (!DidLinkedAssetsChange(*entry))
|
if (!DidLinkedAssetsChange(*entry))
|
||||||
{
|
{
|
||||||
@@ -1241,19 +1241,18 @@ TCacheEntry* TextureCacheBase::Load(const TextureInfo& texture_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InvalidateTexture(GetTexCacheIter(entry));
|
InvalidateTexture(GetTexCacheIter(entry));
|
||||||
return LoadImpl(texture_info, true);
|
return LoadImpl(stage, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool force_reload)
|
TCacheEntry* TextureCacheBase::LoadImpl(u32 stage, bool force_reload)
|
||||||
{
|
{
|
||||||
// if this stage was not invalidated by changes to texture registers, keep the current texture
|
// if this stage was not invalidated by changes to texture registers, keep the current texture
|
||||||
if (!force_reload && TMEM::IsValid(texture_info.GetStage()) &&
|
if (!force_reload && TMEM::IsValid(stage) && m_bound_textures[stage])
|
||||||
m_bound_textures[texture_info.GetStage()])
|
|
||||||
{
|
{
|
||||||
TCacheEntry* entry = m_bound_textures[texture_info.GetStage()].get();
|
TCacheEntry* entry = m_bound_textures[stage].get();
|
||||||
// If the TMEM configuration is such that this texture is more or less guaranteed to still
|
// If the TMEM configuration is such that this texture is more or less guaranteed to still
|
||||||
// be in TMEM, then we know we can reuse the old entry without even hashing the memory
|
// be in TMEM, then we know we can reuse the old entry without even hashing the memory
|
||||||
//
|
//
|
||||||
@@ -1263,7 +1262,7 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo
|
|||||||
//
|
//
|
||||||
// Spyro: A Hero's Tail is known for (deliberately?) using such overwritten textures
|
// Spyro: A Hero's Tail is known for (deliberately?) using such overwritten textures
|
||||||
// in it's bloom effect, which breaks without giving it the invalidated texture.
|
// in it's bloom effect, which breaks without giving it the invalidated texture.
|
||||||
if (TMEM::IsCached(texture_info.GetStage()))
|
if (TMEM::IsCached(stage))
|
||||||
{
|
{
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -1276,6 +1275,7 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TextureInfo texture_info = TextureInfo::FromStage(stage);
|
||||||
auto entry = GetTexture(g_ActiveConfig.iSafeTextureCache_ColorSamples, texture_info);
|
auto entry = GetTexture(g_ActiveConfig.iSafeTextureCache_ColorSamples, texture_info);
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ public:
|
|||||||
void Invalidate();
|
void Invalidate();
|
||||||
void ReleaseToPool(TCacheEntry* entry);
|
void ReleaseToPool(TCacheEntry* entry);
|
||||||
|
|
||||||
TCacheEntry* Load(const TextureInfo& texture_info);
|
TCacheEntry* Load(u32 stage);
|
||||||
RcTcacheEntry GetTexture(const int textureCacheSafetyColorSampleSize,
|
RcTcacheEntry GetTexture(const int textureCacheSafetyColorSampleSize,
|
||||||
const TextureInfo& texture_info);
|
const TextureInfo& texture_info);
|
||||||
RcTcacheEntry GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
|
RcTcacheEntry GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
|
||||||
@@ -346,7 +346,7 @@ private:
|
|||||||
|
|
||||||
static bool DidLinkedAssetsChange(const TCacheEntry& entry);
|
static bool DidLinkedAssetsChange(const TCacheEntry& entry);
|
||||||
|
|
||||||
TCacheEntry* LoadImpl(const TextureInfo& texture_info, bool force_reload);
|
TCacheEntry* LoadImpl(u32 stage, bool force_reload);
|
||||||
|
|
||||||
bool CreateUtilityTextures();
|
bool CreateUtilityTextures();
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "VideoCommon/PixelShaderManager.h"
|
#include "VideoCommon/PixelShaderManager.h"
|
||||||
#include "VideoCommon/Statistics.h"
|
#include "VideoCommon/Statistics.h"
|
||||||
#include "VideoCommon/TextureCacheBase.h"
|
#include "VideoCommon/TextureCacheBase.h"
|
||||||
#include "VideoCommon/TextureInfo.h"
|
|
||||||
#include "VideoCommon/VertexLoaderManager.h"
|
#include "VideoCommon/VertexLoaderManager.h"
|
||||||
#include "VideoCommon/VertexShaderManager.h"
|
#include "VideoCommon/VertexShaderManager.h"
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
@@ -569,7 +568,7 @@ void VertexManagerBase::Flush()
|
|||||||
{
|
{
|
||||||
for (const u32 i : used_textures)
|
for (const u32 i : used_textures)
|
||||||
{
|
{
|
||||||
const auto cache_entry = g_texture_cache->Load(TextureInfo::FromStage(i));
|
const auto cache_entry = g_texture_cache->Load(i);
|
||||||
if (!cache_entry)
|
if (!cache_entry)
|
||||||
continue;
|
continue;
|
||||||
const float custom_tex_scale = cache_entry->GetWidth() / float(cache_entry->native_width);
|
const float custom_tex_scale = cache_entry->GetWidth() / float(cache_entry->native_width);
|
||||||
@@ -581,7 +580,7 @@ void VertexManagerBase::Flush()
|
|||||||
{
|
{
|
||||||
for (const u32 i : used_textures)
|
for (const u32 i : used_textures)
|
||||||
{
|
{
|
||||||
const auto cache_entry = g_texture_cache->Load(TextureInfo::FromStage(i));
|
const auto cache_entry = g_texture_cache->Load(i);
|
||||||
if (cache_entry)
|
if (cache_entry)
|
||||||
{
|
{
|
||||||
if (!Common::Contains(texture_names, cache_entry->texture_info_name))
|
if (!Common::Contains(texture_names, cache_entry->texture_info_name))
|
||||||
|
|||||||
Reference in new issue
Block a user