Texture Cache: Address Feedback

This commit is contained in:
Fernando Sahmkow 2019-12-10 09:34:37 -04:00 committed by FernandoS27
parent 51c9e98677
commit a3916588b6
2 changed files with 11 additions and 11 deletions

View file

@ -138,13 +138,13 @@ public:
std::size_t GetConvertedMipmapSize(u32 level) const; std::size_t GetConvertedMipmapSize(u32 level) const;
// Get this texture Tegra Block size in guest memory layout /// Get this texture Tegra Block size in guest memory layout
u32 GetBlockSize() const; u32 GetBlockSize() const;
// Get X, Y sizes of a block /// Get X, Y sizes of a block
std::pair<u32, u32> GetBlockXY() const; std::pair<u32, u32> GetBlockXY() const;
// Get the offset in x, y, z coordinates from a memory offset /// Get the offset in x, y, z coordinates from a memory offset
std::tuple<u32, u32, u32> GetBlockOffsetXYZ(u32 offset) const; std::tuple<u32, u32, u32> GetBlockOffsetXYZ(u32 offset) const;
/// Returns the size of a layer in bytes in guest memory. /// Returns the size of a layer in bytes in guest memory.

View file

@ -669,7 +669,8 @@ private:
} }
new_surface->MarkAsModified(modified, Tick()); new_surface->MarkAsModified(modified, Tick());
Register(new_surface); Register(new_surface);
return {{new_surface, new_surface->GetMainView()}}; auto view = new_surface->GetMainView();
return {{std::move(new_surface), view}};
} else { } else {
for (const auto& surface : overlaps) { for (const auto& surface : overlaps) {
if (!surface->MatchTarget(params.target)) { if (!surface->MatchTarget(params.target)) {
@ -685,8 +686,7 @@ private:
if (surface->GetCacheAddr() != cache_addr) { if (surface->GetCacheAddr() != cache_addr) {
continue; continue;
} }
const auto struct_result = surface->MatchesStructure(params); if (surface->MatchesStructure(params) == MatchStructureResult::FullMatch) {
if (struct_result == MatchStructureResult::FullMatch) {
return {{surface, surface->GetMainView()}}; return {{surface, surface->GetMainView()}};
} }
} }
@ -768,7 +768,7 @@ private:
// Look if it's a 3D texture // Look if it's a 3D texture
if (params.block_depth > 0) { if (params.block_depth > 0) {
std::optional<std::pair<TSurface, TView>> surface = auto surface =
Manage3DSurfaces(overlaps, params, gpu_addr, cache_addr, preserve_contents); Manage3DSurfaces(overlaps, params, gpu_addr, cache_addr, preserve_contents);
if (surface) { if (surface) {
return *surface; return *surface;