Address PR feedback
Removes a useless null check Aligns some values to improve readability
This commit is contained in:
parent
912e43e979
commit
29a825b43b
12 changed files with 86 additions and 79 deletions
|
@ -33,7 +33,9 @@ namespace Ryujinx.Common
|
|||
using (var stream = GetStream(assembly, filename))
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
|
@ -49,7 +51,9 @@ namespace Ryujinx.Common
|
|||
using (var stream = GetStream(assembly, filename))
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
|
@ -79,7 +83,9 @@ namespace Ryujinx.Common
|
|||
using (var stream = GetStream(assembly, filename))
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
|
@ -93,7 +99,9 @@ namespace Ryujinx.Common
|
|||
using (var stream = GetStream(assembly, filename))
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
|
@ -104,7 +112,7 @@ namespace Ryujinx.Common
|
|||
|
||||
public static Stream GetStream(string filename)
|
||||
{
|
||||
var (assembly, path) = ResolveManifestPath(filename);
|
||||
var (assembly, _) = ResolveManifestPath(filename);
|
||||
|
||||
return GetStream(assembly, filename);
|
||||
}
|
||||
|
@ -116,9 +124,6 @@ namespace Ryujinx.Common
|
|||
|
||||
var stream = assembly.GetManifestResourceStream(manifestUri);
|
||||
|
||||
if (stream == null)
|
||||
return null;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -131,11 +136,13 @@ namespace Ryujinx.Common
|
|||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
if (assembly.GetName().Name == segments[0])
|
||||
{
|
||||
return (assembly, segments[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (EmbeddedResources.ResourceAssembly, filename);
|
||||
return (ResourceAssembly, filename);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,42 +61,42 @@ namespace Ryujinx.Graphics.GAL
|
|||
SwizzleA = swizzleA;
|
||||
}
|
||||
|
||||
public int GetMipSize(int level)
|
||||
public readonly int GetMipSize(int level)
|
||||
{
|
||||
return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level);
|
||||
}
|
||||
|
||||
public int GetMipSize2D(int level)
|
||||
public readonly int GetMipSize2D(int level)
|
||||
{
|
||||
return GetMipStride(level) * GetLevelHeight(level);
|
||||
}
|
||||
|
||||
public int GetMipStride(int level)
|
||||
public readonly int GetMipStride(int level)
|
||||
{
|
||||
return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4);
|
||||
}
|
||||
|
||||
private int GetLevelWidth(int level)
|
||||
private readonly int GetLevelWidth(int level)
|
||||
{
|
||||
return BitUtils.DivRoundUp(GetLevelSize(Width, level), BlockWidth);
|
||||
}
|
||||
|
||||
private int GetLevelHeight(int level)
|
||||
private readonly int GetLevelHeight(int level)
|
||||
{
|
||||
return BitUtils.DivRoundUp(GetLevelSize(Height, level), BlockHeight);
|
||||
}
|
||||
|
||||
private int GetLevelDepth(int level)
|
||||
private readonly int GetLevelDepth(int level)
|
||||
{
|
||||
return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers();
|
||||
}
|
||||
|
||||
public int GetDepthOrLayers()
|
||||
public readonly int GetDepthOrLayers()
|
||||
{
|
||||
return Target == Target.Texture3D ? Depth : GetLayers();
|
||||
}
|
||||
|
||||
public int GetLayers()
|
||||
public readonly int GetLayers()
|
||||
{
|
||||
if (Target == Target.Texture2DArray ||
|
||||
Target == Target.Texture2DMultisampleArray ||
|
||||
|
|
|
@ -19,9 +19,6 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
private int _firstLayer;
|
||||
private int _firstLevel;
|
||||
|
||||
private bool _acquired;
|
||||
private bool _pendingDelete;
|
||||
|
||||
public int Width => _info.Width;
|
||||
public int Height => _info.Height;
|
||||
public int DepthOrLayers => _info.GetDepthOrLayers();
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.Translation
|
||||
{
|
||||
[Flags]
|
||||
public enum TranslationFlags
|
||||
{
|
||||
None = 0,
|
||||
|
|
Loading…
Reference in a new issue