diff options
| author | Stenzek <stenzek@gmail.com> | 2019-01-19 23:27:49 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2019-01-19 23:38:00 +1000 |
| commit | 84bcbef944669a93bfe2905f1c7eb68bda7c9d4e (patch) | |
| tree | 60293b742121b7cac9cda667e1f6450585222a15 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | ade255a5ffafd69255f3387fe7e0a1a7b4bd6eec (diff) | |
TextureCache: Don't partial copy to non-existant texture layers
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 7dafc7bb4b..f31cac5364 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -416,7 +416,10 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale dstrect.top = dst_y; dstrect.right = (dst_x + copy_width); dstrect.bottom = (dst_y + copy_height); - for (u32 layer = 0; layer < entry->texture->GetConfig().layers; layer++) + + // If one copy is stereo, and the other isn't... not much we can do here :/ + const u32 layers_to_copy = std::min(entry->GetNumLayers(), entry_to_update->GetNumLayers()); + for (u32 layer = 0; layer < layers_to_copy; layer++) { entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, layer, 0, dstrect, layer, 0); @@ -1414,7 +1417,9 @@ TextureCacheBase::GetTextureFromOverlappingTextures(const TextureLookupInformati dstrect.right = (dst_x + copy_width); dstrect.bottom = (dst_y + copy_height); - for (u32 layer = 0; layer < entry->texture->GetConfig().layers; layer++) + // If one copy is stereo, and the other isn't... not much we can do here :/ + const u32 layers_to_copy = std::min(entry->GetNumLayers(), stitched_entry->GetNumLayers()); + for (u32 layer = 0; layer < layers_to_copy; layer++) { stitched_entry->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, layer, 0, dstrect, layer, 0); |
