Address PR feedback

Removes a useless null check

Aligns some values to improve readability
This commit is contained in:
gdkchan 2020-01-06 19:27:50 -03:00 committed by Thog
parent 912e43e979
commit 29a825b43b
12 changed files with 86 additions and 79 deletions

View File

@ -33,7 +33,9 @@ namespace Ryujinx.Common
using (var stream = GetStream(assembly, filename)) using (var stream = GetStream(assembly, filename))
{ {
if (stream == null) if (stream == null)
{
return null; return null;
}
using (var mem = new MemoryStream()) using (var mem = new MemoryStream())
{ {
@ -49,7 +51,9 @@ namespace Ryujinx.Common
using (var stream = GetStream(assembly, filename)) using (var stream = GetStream(assembly, filename))
{ {
if (stream == null) if (stream == null)
{
return null; return null;
}
using (var mem = new MemoryStream()) using (var mem = new MemoryStream())
{ {
@ -79,7 +83,9 @@ namespace Ryujinx.Common
using (var stream = GetStream(assembly, filename)) using (var stream = GetStream(assembly, filename))
{ {
if (stream == null) if (stream == null)
{
return null; return null;
}
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@ -93,7 +99,9 @@ namespace Ryujinx.Common
using (var stream = GetStream(assembly, filename)) using (var stream = GetStream(assembly, filename))
{ {
if (stream == null) if (stream == null)
{
return null; return null;
}
using (var reader = new StreamReader(stream)) using (var reader = new StreamReader(stream))
{ {
@ -104,7 +112,7 @@ namespace Ryujinx.Common
public static Stream GetStream(string filename) public static Stream GetStream(string filename)
{ {
var (assembly, path) = ResolveManifestPath(filename); var (assembly, _) = ResolveManifestPath(filename);
return GetStream(assembly, filename); return GetStream(assembly, filename);
} }
@ -116,9 +124,6 @@ namespace Ryujinx.Common
var stream = assembly.GetManifestResourceStream(manifestUri); var stream = assembly.GetManifestResourceStream(manifestUri);
if (stream == null)
return null;
return stream; return stream;
} }
@ -131,11 +136,13 @@ namespace Ryujinx.Common
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{ {
if (assembly.GetName().Name == segments[0]) if (assembly.GetName().Name == segments[0])
{
return (assembly, segments[1]); return (assembly, segments[1]);
} }
} }
}
return (EmbeddedResources.ResourceAssembly, filename); return (ResourceAssembly, filename);
} }
} }
} }

View File

@ -61,42 +61,42 @@ namespace Ryujinx.Graphics.GAL
SwizzleA = swizzleA; SwizzleA = swizzleA;
} }
public int GetMipSize(int level) public readonly int GetMipSize(int level)
{ {
return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level); return GetMipStride(level) * GetLevelHeight(level) * GetLevelDepth(level);
} }
public int GetMipSize2D(int level) public readonly int GetMipSize2D(int level)
{ {
return GetMipStride(level) * GetLevelHeight(level); return GetMipStride(level) * GetLevelHeight(level);
} }
public int GetMipStride(int level) public readonly int GetMipStride(int level)
{ {
return BitUtils.AlignUp(GetLevelWidth(level) * BytesPerPixel, 4); 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); 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); 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(); return Target == Target.Texture3D ? GetLevelSize(Depth, level) : GetLayers();
} }
public int GetDepthOrLayers() public readonly int GetDepthOrLayers()
{ {
return Target == Target.Texture3D ? Depth : GetLayers(); return Target == Target.Texture3D ? Depth : GetLayers();
} }
public int GetLayers() public readonly int GetLayers()
{ {
if (Target == Target.Texture2DArray || if (Target == Target.Texture2DArray ||
Target == Target.Texture2DMultisampleArray || Target == Target.Texture2DMultisampleArray ||

View File

@ -19,9 +19,6 @@ namespace Ryujinx.Graphics.OpenGL
private int _firstLayer; private int _firstLayer;
private int _firstLevel; private int _firstLevel;
private bool _acquired;
private bool _pendingDelete;
public int Width => _info.Width; public int Width => _info.Width;
public int Height => _info.Height; public int Height => _info.Height;
public int DepthOrLayers => _info.GetDepthOrLayers(); public int DepthOrLayers => _info.GetDepthOrLayers();

View File

@ -1,5 +1,8 @@
using System;
namespace Ryujinx.Graphics.Shader.Translation namespace Ryujinx.Graphics.Shader.Translation
{ {
[Flags]
public enum TranslationFlags public enum TranslationFlags
{ {
None = 0, None = 0,