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:
riperiperi 2021-03-19 01:17:38 +00:00 committed by GitHub
parent 39899c0407
commit 9b7335a63b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 15 deletions

View file

@ -429,7 +429,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Discount square textures that aren't depth-stencil like. (excludes game textures, cubemap faces, most 3D texture LUT, texture atlas)
// Detect if the texture is possibly square. Widths may be aligned, so to remove the uncertainty we align both the width and height.
int widthAlignment = (info.IsLinear ? 32 : 64) / info.FormatInfo.BytesPerPixel;
int widthAlignment = (info.IsLinear ? Constants.StrideAlignment : Constants.GobAlignment) / info.FormatInfo.BytesPerPixel;
bool possiblySquare = BitUtils.AlignUp(info.Width, widthAlignment) == BitUtils.AlignUp(info.Height, widthAlignment);
@ -977,8 +977,6 @@ namespace Ryujinx.Graphics.Gpu.Image
{
// Copy only compatibility, or target texture is already a view.
ChangeSizeIfNeeded(overlapInfo, overlap, false, sizeHint); // Force a size match for copy
overlap.SynchronizeMemory();
texture.CreateCopyDependency(overlap, oInfo.FirstLayer, oInfo.FirstLevel, false);
}