summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2017-12-01 14:24:06 +1000
committerGitHub <noreply@github.com>2017-12-01 14:24:06 +1000
commitcd68b3606cea8a7041751bda482170533bae3220 (patch)
tree4edef80bda42a82a50ff9f9e86d64aac38c8aff3 /Source/Core/VideoCommon/TextureCacheBase.cpp
parent0773a48c6c990c488e70ff7c1f46713593440ddc (diff)
parent7f217a8bb24da323042081a02b65f84f9ce9761f (diff)
Merge pull request #6193 from stenzek/readbacks
Abstract Staging Textures - VideoCommon interface for texture readbacks/uploads
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index 7e3f7b25c0..d6290001a9 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -277,9 +277,9 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* e
std::unique_ptr<AbstractTexture> new_texture = AllocateTexture(newconfig);
if (new_texture)
{
- new_texture->CopyRectangleFromTexture(entry->texture.get(),
- entry->texture->GetConfig().GetRect(),
- new_texture->GetConfig().GetRect());
+ new_texture->ScaleRectangleFromTexture(entry->texture.get(),
+ entry->texture->GetConfig().GetRect(),
+ new_texture->GetConfig().GetRect());
entry->texture.swap(new_texture);
auto config = new_texture->GetConfig();
@@ -406,7 +406,11 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale
dstrect.top = dst_y;
dstrect.right = (dst_x + copy_width);
dstrect.bottom = (dst_y + copy_height);
- entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, dstrect);
+ for (u32 layer = 0; layer < entry->texture->GetConfig().layers; layer++)
+ {
+ entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, layer,
+ 0, dstrect, layer, 0);
+ }
if (isPaletteTexture)
{
@@ -1366,33 +1370,16 @@ bool TextureCacheBase::LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_
srcrect.right = (src_x + copy_width);
srcrect.bottom = (src_y + copy_height);
- if (static_cast<int>(entry->GetWidth()) == srcrect.GetWidth())
- {
- srcrect.right -= 1;
- }
-
- if (static_cast<int>(entry->GetHeight()) == srcrect.GetHeight())
- {
- srcrect.bottom -= 1;
- }
-
dstrect.left = dst_x;
dstrect.top = dst_y;
dstrect.right = (dst_x + copy_width);
dstrect.bottom = (dst_y + copy_height);
- if (static_cast<int>(entry_to_update->GetWidth()) == dstrect.GetWidth())
- {
- dstrect.right -= 1;
- }
-
- if (static_cast<int>(entry_to_update->GetHeight()) == dstrect.GetHeight())
+ for (u32 layer = 0; layer < entry->texture->GetConfig().layers; layer++)
{
- dstrect.bottom -= 1;
+ entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, layer,
+ 0, dstrect, layer, 0);
}
-
- entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, dstrect);
-
updated_entry = true;
if (tex_info.is_palette_texture)
@@ -2090,7 +2077,7 @@ std::unique_ptr<AbstractTexture> TextureCacheBase::AllocateTexture(const Texture
}
else
{
- entry = CreateTexture(config);
+ entry = g_renderer->CreateTexture(config);
if (!entry)
return nullptr;