aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-11-10 00:41:13 +0000
committerGitHub <noreply@github.com>2020-11-09 21:41:13 -0300
commit02872833b6da02a20e331305caf05f722e6c8e68 (patch)
tree4f3948b1ee0ecb4849f0fcfb4cad8cd27c202d30 /Ryujinx.Graphics.Gpu/Image/TexturePool.cs
parentc3d62bd0783a20efb78fa0776f4c620970774cf9 (diff)
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
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePool.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TexturePool.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
index 59f2e901..e26dc501 100644
--- a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
@@ -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();
}