mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-04 10:14:11 +00:00
TextureCache: Check for out-of-range partial copy rect after scaling
This commit is contained in:
parent
3791262d96
commit
b09a0e1a60
@ -393,18 +393,6 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale
|
|||||||
dst_y = 0;
|
dst_y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the source rectangle is outside of what we actually have in VRAM, skip the copy.
|
|
||||||
// The backend doesn't do any clamping, so if we don't, we'd pass out-of-range coordinates
|
|
||||||
// to the graphics driver, which can cause GPU resets.
|
|
||||||
if (static_cast<u32>(src_x) >= entry->native_width ||
|
|
||||||
static_cast<u32>(src_y) >= entry->native_height ||
|
|
||||||
static_cast<u32>(dst_x) >= entry_to_update->native_width ||
|
|
||||||
static_cast<u32>(dst_y) >= entry_to_update->native_height)
|
|
||||||
{
|
|
||||||
++iter.first;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 copy_width =
|
u32 copy_width =
|
||||||
std::min(entry->native_width - src_x, entry_to_update->native_width - dst_x);
|
std::min(entry->native_width - src_x, entry_to_update->native_width - dst_x);
|
||||||
u32 copy_height =
|
u32 copy_height =
|
||||||
@ -429,6 +417,18 @@ TextureCacheBase::DoPartialTextureUpdates(TCacheEntry* entry_to_update, u8* pale
|
|||||||
copy_height = g_renderer->EFBToScaledY(copy_height);
|
copy_height = g_renderer->EFBToScaledY(copy_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the source rectangle is outside of what we actually have in VRAM, skip the copy.
|
||||||
|
// The backend doesn't do any clamping, so if we don't, we'd pass out-of-range coordinates
|
||||||
|
// to the graphics driver, which can cause GPU resets.
|
||||||
|
if (static_cast<u32>(src_x + copy_width) > entry->GetWidth() ||
|
||||||
|
static_cast<u32>(src_y + copy_height) > entry->GetHeight() ||
|
||||||
|
static_cast<u32>(dst_x + copy_width) > entry_to_update->GetWidth() ||
|
||||||
|
static_cast<u32>(dst_y + copy_height) > entry_to_update->GetHeight())
|
||||||
|
{
|
||||||
|
++iter.first;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MathUtil::Rectangle<int> srcrect, dstrect;
|
MathUtil::Rectangle<int> srcrect, dstrect;
|
||||||
srcrect.left = src_x;
|
srcrect.left = src_x;
|
||||||
srcrect.top = src_y;
|
srcrect.top = src_y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user