Improve linear texture compatibility rules (#2099)
* Improve linear texture compatibility rules Fixes an issue where small or width-aligned (rather than byte aligned) textures would fail to create a view of existing data. Creates a copy dependency as size change may be risky. * Minor cleanup * Remove Size Change for Copy Depenedencies The copy to the target (potentially different sized) texture can properly deal with cropping by itself. * Move StrideAlignment and GobAlignment into Constants
This commit is contained in:
parent
39899c0407
commit
9b7335a63b
5 changed files with 29 additions and 15 deletions
|
@ -231,8 +231,21 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
result = TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
|
||||
return (size.Width == otherSize.Width &&
|
||||
size.Height == otherSize.Height) ? result : TextureViewCompatibility.Incompatible;
|
||||
if (size.Width == otherSize.Width && size.Height == otherSize.Height)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else if (lhs.IsLinear && rhs.IsLinear)
|
||||
{
|
||||
// Copy between linear textures with matching stride.
|
||||
int stride = BitUtils.AlignUp(Math.Max(1, lhs.Stride >> level), Constants.StrideAlignment);
|
||||
|
||||
return stride == rhs.Stride ? TextureViewCompatibility.CopyOnly : TextureViewCompatibility.Incompatible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TextureViewCompatibility.Incompatible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -372,8 +385,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
// For block linear textures, the stride is ignored.
|
||||
if (rhs.IsLinear)
|
||||
{
|
||||
int width = Math.Max(1, lhs.Width >> level);
|
||||
int stride = width * lhs.FormatInfo.BytesPerPixel;
|
||||
int stride = Math.Max(1, lhs.Stride >> level);
|
||||
stride = BitUtils.AlignUp(stride, 32);
|
||||
|
||||
return stride == rhs.Stride;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue