mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-10-05 18:58:56 +02:00
misc: chore: Merge into pattern
This commit is contained in:
@@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
mipLodBias,
|
||||
Math.Min(maxRequestedAnisotropy, maxSupportedAnisotropy)));
|
||||
|
||||
if (GraphicsConfig.MaxAnisotropy >= 0 && GraphicsConfig.MaxAnisotropy <= 16 && (minFilter == MinFilter.LinearMipmapNearest || minFilter == MinFilter.LinearMipmapLinear))
|
||||
if (GraphicsConfig.MaxAnisotropy >= 0 && GraphicsConfig.MaxAnisotropy <= 16 && minFilter is MinFilter.LinearMipmapNearest or MinFilter.LinearMipmapLinear)
|
||||
{
|
||||
maxRequestedAnisotropy = GraphicsConfig.MaxAnisotropy;
|
||||
|
||||
|
||||
@@ -1343,7 +1343,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>True if anisotropic filtering can be forced, false otherwise</returns>
|
||||
private bool CanTextureForceAnisotropy()
|
||||
{
|
||||
if (!(Target == Target.Texture2D || Target == Target.Texture2DArray))
|
||||
if (!(Target is Target.Texture2D or Target.Texture2DArray))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1367,16 +1367,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
case Target.Texture1D:
|
||||
case Target.Texture1DArray:
|
||||
return target == Target.Texture1D || target == Target.Texture1DArray;
|
||||
return target is Target.Texture1D or Target.Texture1DArray;
|
||||
case Target.Texture2D:
|
||||
case Target.Texture2DArray:
|
||||
return target == Target.Texture2D || target == Target.Texture2DArray;
|
||||
return target is Target.Texture2D or Target.Texture2DArray;
|
||||
case Target.Cubemap:
|
||||
case Target.CubemapArray:
|
||||
return target == Target.Cubemap || target == Target.CubemapArray;
|
||||
return target is Target.Cubemap or Target.CubemapArray;
|
||||
case Target.Texture2DMultisample:
|
||||
case Target.Texture2DMultisampleArray:
|
||||
return target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray;
|
||||
return target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray;
|
||||
case Target.Texture3D:
|
||||
return target == Target.Texture3D;
|
||||
default:
|
||||
|
||||
@@ -784,8 +784,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
samplerHandle = samplerWordOffset;
|
||||
}
|
||||
|
||||
if (handleType == TextureHandleType.SeparateSamplerId ||
|
||||
handleType == TextureHandleType.SeparateConstantSamplerHandle)
|
||||
if (handleType is TextureHandleType.SeparateSamplerId or TextureHandleType.SeparateConstantSamplerHandle)
|
||||
{
|
||||
samplerHandle <<= 20;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>True if eligible</returns>
|
||||
private static TextureScaleMode IsUpscaleCompatible(TextureInfo info, bool withUpscale)
|
||||
{
|
||||
if ((info.Target == Target.Texture2D || info.Target == Target.Texture2DArray || info.Target == Target.Texture2DMultisample) && !info.FormatInfo.IsCompressed)
|
||||
if (info.Target is Target.Texture2D or Target.Texture2DArray or Target.Texture2DMultisample && !info.FormatInfo.IsCompressed)
|
||||
{
|
||||
return UpscaleSafeMode(info) ? (withUpscale ? TextureScaleMode.Scaled : TextureScaleMode.Eligible) : TextureScaleMode.Undesired;
|
||||
}
|
||||
@@ -675,10 +675,11 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((info.Target == Target.Texture3D ||
|
||||
info.Target == Target.Texture2DArray ||
|
||||
info.Target == Target.Texture2DMultisampleArray ||
|
||||
info.Target == Target.CubemapArray) && info.DepthOrLayers < 1)
|
||||
if (info.Target is Target.Texture3D
|
||||
or Target.Texture2DArray
|
||||
or Target.Texture2DMultisampleArray
|
||||
or Target.CubemapArray &&
|
||||
info.DepthOrLayers < 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -207,8 +207,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return false; // Flushing this format is not supported, as it may have been converted to another host format.
|
||||
}
|
||||
|
||||
if (info.Target == Target.Texture2DMultisample ||
|
||||
info.Target == Target.Texture2DMultisampleArray)
|
||||
if (info.Target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return false; // Flushing multisample textures is not supported, the host does not allow getting their data.
|
||||
}
|
||||
@@ -241,9 +240,10 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
return TextureMatchQuality.FormatAlias;
|
||||
}
|
||||
else if ((lhs.FormatInfo.Format == Format.D24UnormS8Uint ||
|
||||
lhs.FormatInfo.Format == Format.S8UintD24Unorm ||
|
||||
lhs.FormatInfo.Format == Format.X8UintD24Unorm) && rhs.FormatInfo.Format == Format.B8G8R8A8Unorm ||
|
||||
else if (lhs.FormatInfo.Format is Format.D24UnormS8Uint
|
||||
or Format.S8UintD24Unorm
|
||||
or Format.X8UintD24Unorm &&
|
||||
rhs.FormatInfo.Format == Format.B8G8R8A8Unorm ||
|
||||
lhs.FormatInfo.Format == Format.D32FloatS8Uint && rhs.FormatInfo.Format == Format.R32G32Float)
|
||||
{
|
||||
return TextureMatchQuality.FormatAlias;
|
||||
@@ -755,43 +755,38 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
case Target.Texture1D:
|
||||
case Target.Texture1DArray:
|
||||
result = rhs.Target == Target.Texture1D ||
|
||||
rhs.Target == Target.Texture1DArray;
|
||||
result = rhs.Target is Target.Texture1D or Target.Texture1DArray;
|
||||
break;
|
||||
|
||||
case Target.Texture2D:
|
||||
result = rhs.Target == Target.Texture2D ||
|
||||
rhs.Target == Target.Texture2DArray;
|
||||
result = rhs.Target is Target.Texture2D or Target.Texture2DArray;
|
||||
break;
|
||||
|
||||
case Target.Texture2DArray:
|
||||
result = rhs.Target == Target.Texture2D ||
|
||||
rhs.Target == Target.Texture2DArray;
|
||||
result = rhs.Target is Target.Texture2D or Target.Texture2DArray;
|
||||
|
||||
if (rhs.Target == Target.Cubemap || rhs.Target == Target.CubemapArray)
|
||||
if (rhs.Target is Target.Cubemap or Target.CubemapArray)
|
||||
{
|
||||
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
break;
|
||||
case Target.Cubemap:
|
||||
case Target.CubemapArray:
|
||||
result = rhs.Target == Target.Cubemap ||
|
||||
rhs.Target == Target.CubemapArray;
|
||||
result = rhs.Target is Target.Cubemap or Target.CubemapArray;
|
||||
|
||||
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
|
||||
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
|
||||
{
|
||||
return caps.SupportsCubemapView ? TextureViewCompatibility.Full : TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
break;
|
||||
case Target.Texture2DMultisample:
|
||||
case Target.Texture2DMultisampleArray:
|
||||
if (rhs.Target == Target.Texture2D || rhs.Target == Target.Texture2DArray)
|
||||
if (rhs.Target is Target.Texture2D or Target.Texture2DArray)
|
||||
{
|
||||
return TextureViewCompatibility.CopyOnly;
|
||||
}
|
||||
|
||||
result = rhs.Target == Target.Texture2DMultisample ||
|
||||
rhs.Target == Target.Texture2DMultisampleArray;
|
||||
result = rhs.Target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray;
|
||||
break;
|
||||
|
||||
case Target.Texture3D:
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>The number of texture layers</returns>
|
||||
public static int GetLayers(Target target, int depthOrLayers)
|
||||
{
|
||||
if (target == Target.Texture2DArray || target == Target.Texture2DMultisampleArray)
|
||||
if (target is Target.Texture2DArray or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return depthOrLayers;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>The number of texture slices</returns>
|
||||
public int GetSlices()
|
||||
{
|
||||
if (Target == Target.Texture3D || Target == Target.Texture2DArray || Target == Target.Texture2DMultisampleArray)
|
||||
if (Target is Target.Texture3D or Target.Texture2DArray or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
return DepthOrLayers;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>True if the scale needs updating, false if the scale is up to date</returns>
|
||||
private static bool ScaleNeedsUpdated(Texture texture)
|
||||
{
|
||||
return texture != null && !(texture.ScaleMode == TextureScaleMode.Blacklisted || texture.ScaleMode == TextureScaleMode.Undesired) && texture.ScaleFactor != GraphicsConfig.ResScale;
|
||||
return texture != null && !(texture.ScaleMode is TextureScaleMode.Blacklisted or TextureScaleMode.Undesired) && texture.ScaleFactor != GraphicsConfig.ResScale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -554,7 +554,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
int width = target == Target.TextureBuffer ? descriptor.UnpackBufferTextureWidth() : descriptor.UnpackWidth();
|
||||
int height = descriptor.UnpackHeight();
|
||||
|
||||
if (target == Target.Texture2DMultisample || target == Target.Texture2DMultisampleArray)
|
||||
if (target is Target.Texture2DMultisample or Target.Texture2DMultisampleArray)
|
||||
{
|
||||
// This is divided back before the backend texture is created.
|
||||
width *= samplesInX;
|
||||
@@ -771,8 +771,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// <returns>True if the swizzle component is equal to the red or green, false otherwise</returns>
|
||||
private static bool IsRG(SwizzleComponent component)
|
||||
{
|
||||
return component == SwizzleComponent.Red ||
|
||||
component == SwizzleComponent.Green;
|
||||
return component is SwizzleComponent.Red or SwizzleComponent.Green;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user