From 49a9c33bd75df2b8cebd58eab10f140c79a8f65c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 30 Sep 2017 16:25:36 +1000 Subject: VideoCommon: Move abstract texture creation function to Renderer --- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 7e3f7b25c0..521f5816f1 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -2090,7 +2090,7 @@ std::unique_ptr TextureCacheBase::AllocateTexture(const Texture } else { - entry = CreateTexture(config); + entry = g_renderer->CreateTexture(config); if (!entry) return nullptr; -- cgit v1.2.3 From 56afebeb44f1ace990d9383e9b840fdc27610029 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 30 Oct 2017 21:51:42 +1000 Subject: AbstractTexture: Seperate CopyRectangleFromTexture to two methods ScaleRectangleFromTexture, which does a draw, and CopyRectangleFromTexture, which where possible, does a bit-for-bit copy. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 521f5816f1..31701e6bc0 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 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,8 @@ 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); + entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, 0, 0, + dstrect, 0, 0); if (isPaletteTexture) { @@ -1391,7 +1392,8 @@ bool TextureCacheBase::LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_ dstrect.bottom -= 1; } - entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, dstrect); + entry_to_update->texture->CopyRectangleFromTexture(entry->texture.get(), srcrect, 0, 0, + dstrect, 0, 0); updated_entry = true; -- cgit v1.2.3 From 193763ca3ab62086c5a2f09870ffdc84cbd8ee00 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 19 Nov 2017 17:35:07 +1000 Subject: TextureCacheBase: Don't crop last row/column of XFB copies Unsure why this was happening in the first place. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 31 +++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 31701e6bc0..d6290001a9 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -406,8 +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, 0, 0, - dstrect, 0, 0); + 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) { @@ -1367,34 +1370,16 @@ bool TextureCacheBase::LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_ srcrect.right = (src_x + copy_width); srcrect.bottom = (src_y + copy_height); - if (static_cast(entry->GetWidth()) == srcrect.GetWidth()) - { - srcrect.right -= 1; - } - - if (static_cast(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(entry_to_update->GetWidth()) == dstrect.GetWidth()) - { - dstrect.right -= 1; - } - - if (static_cast(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, 0, 0, - dstrect, 0, 0); - updated_entry = true; if (tex_info.is_palette_texture) -- cgit v1.2.3