Size hints for copy regions and viewport dimensions to avoid data loss (#1686)

* Size hints for copy regions and viewport dimensions to avoid data loss

* Reword comment.

* Use info for the rule rather than calculating aligned size.

* Reorder min/max, remove spaces
This commit is contained in:
riperiperi 2020-11-10 00:41:13 +00:00 committed by GitHub
parent c3d62bd078
commit 02872833b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 111 additions and 45 deletions

View file

@ -67,6 +67,22 @@ namespace Ryujinx.Graphics.Gpu.Image
}
else
{
if (texture.ChangedSize)
{
// Texture changed size at one point - it may be a different size than the sampler expects.
// This can be triggered when the size is changed by a size hint on copy or draw, but the texture has been sampled before.
TextureDescriptor descriptor = GetDescriptor(id);
int width = descriptor.UnpackWidth();
int height = descriptor.UnpackHeight();
if (texture.Info.Width != width || texture.Info.Height != height)
{
texture.ChangeSize(width, height, texture.Info.DepthOrLayers);
}
}
// Memory is automatically synchronized on texture creation.
texture.SynchronizeMemory();
}