Convert 1D texture targets to 2D (#1584)

* Convert 1D texture targets to 2D

* Fix typo

* Simplify some code

* Should mask that too

* Consistency
This commit is contained in:
gdkchan 2020-09-29 17:28:50 -03:00 committed by GitHub
parent a15459366e
commit 1560f236da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 119 additions and 12 deletions

View file

@ -144,6 +144,22 @@ namespace Ryujinx.Graphics.Gpu.Image
Target target = descriptor.UnpackTextureTarget().Convert((samplesInX | samplesInY) != 1);
// We use 2D targets for 1D textures as that makes texture cache
// management easier. We don't know the target for render target
// and copies, so those would normally use 2D targets, which are
// not compatible with 1D targets. By doing that we also allow those
// to match when looking for compatible textures on the cache.
if (target == Target.Texture1D)
{
target = Target.Texture2D;
height = 1;
}
else if (target == Target.Texture1DArray)
{
target = Target.Texture2DArray;
height = 1;
}
uint format = descriptor.UnpackFormat();
bool srgb = descriptor.UnpackSrgb();