Invalidate overlapping textures when creating resolve texture

This fixes a case where we would leave an uploaded texture lying around that
was inadvertantly generated when a game sampled from a resolve texture that
had not been populated yet.
This commit is contained in:
Dan Weatherford 2017-10-01 23:03:02 -05:00 committed by DrChat
parent 277b9dd9ae
commit f44e8acccb
1 changed files with 10 additions and 0 deletions

View File

@ -456,6 +456,16 @@ TextureCache::Texture* TextureCache::DemandResolveTexture(
texture_info.guest_address, texture_info.input_length,
cpu::MMIOHandler::kWatchWrite, &WatchCallback, this, texture);
// Invalidate any textures that share this memory location
for (auto it = textures_.begin(); it != textures_.end(); ++it) {
if (it->second->texture_info.guest_address == texture_info.guest_address) {
it->second->pending_invalidation = true;
invalidated_textures_mutex_.lock();
invalidated_textures_->push_back(it->second);
invalidated_textures_mutex_.unlock();
}
}
textures_[texture_hash] = texture;
COUNT_profile_set("gpu/texture_cache/textures", textures_.size());
return texture;