[Vulkan] Track active textures in the texture cache

This commit is contained in:
DrChat 2018-03-02 23:28:29 -06:00
parent f7026cb17b
commit 9235a8107b
1 changed files with 4 additions and 0 deletions

View File

@ -430,6 +430,7 @@ TextureCache::Texture* TextureCache::DemandResolveTexture(
cpu::MMIOHandler::kWatchWrite, &WatchCallback, this, texture); cpu::MMIOHandler::kWatchWrite, &WatchCallback, this, texture);
textures_[texture_hash] = texture; textures_[texture_hash] = texture;
COUNT_profile_set("gpu/texture_cache/textures", textures_.size());
return texture; return texture;
} }
@ -503,6 +504,7 @@ TextureCache::Texture* TextureCache::Demand(const TextureInfo& texture_info,
texture_info.guest_address + texture_info.input_length)); texture_info.guest_address + texture_info.input_length));
textures_[texture_hash] = texture; textures_[texture_hash] = texture;
COUNT_profile_set("gpu/texture_cache/textures", textures_.size());
return texture; return texture;
} }
@ -1488,6 +1490,7 @@ void TextureCache::RemoveInvalidatedTextures() {
it != invalidated_textures.end(); ++it) { it != invalidated_textures.end(); ++it) {
pending_delete_textures_.push_back(*it); pending_delete_textures_.push_back(*it);
textures_.erase((*it)->texture_info.hash()); textures_.erase((*it)->texture_info.hash());
COUNT_profile_set("gpu/texture_cache/textures", textures_.size());
} }
invalidated_textures.clear(); invalidated_textures.clear();
@ -1503,6 +1506,7 @@ void TextureCache::ClearCache() {
} }
} }
textures_.clear(); textures_.clear();
COUNT_profile_set("gpu/texture_cache/textures", 0);
for (auto it = samplers_.begin(); it != samplers_.end(); ++it) { for (auto it = samplers_.begin(); it != samplers_.end(); ++it) {
vkDestroySampler(*device_, it->second->sampler, nullptr); vkDestroySampler(*device_, it->second->sampler, nullptr);