aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL
diff options
context:
space:
mode:
authormageven <62494521+mageven@users.noreply.github.com>2020-08-04 05:02:53 +0530
committerGitHub <noreply@github.com>2020-08-04 01:32:53 +0200
commita33dc2f4919f7fdc8ea9db41c4c70c38cedfd3df (patch)
treed3eee67f25c3a302fa23dc39670438e7ebbfd35c /Ryujinx.Graphics.OpenGL
parent60db4c353099e8656a330ede03fdbe57a421fa47 (diff)
Improved Logger (#1292)
* Logger class changes only Now compile-time checking is possible with the help of Nullable Value types. * Misc formatting * Manual optimizations PrintGuestLog PrintGuestStackTrace Surfaceflinger DequeueBuffer * Reduce SendVibrationXX log level to Debug * Add Notice log level This level is always enabled and used to print system info, etc... Also, rewrite LogColor to switch expression as colors are static * Unify unhandled exception event handlers * Print enabled LogLevels during init * Re-add App Exit disposes in proper order nit: switch case spacing * Revert PrintGuestStackTrace to Info logs due to #1407 PrintGuestStackTrace is now called in some critical error handlers so revert to old behavior as KThread isn't part of Guest. * Batch replace Logger statements
Diffstat (limited to 'Ryujinx.Graphics.OpenGL')
-rw-r--r--Ryujinx.Graphics.OpenGL/Debugger.cs14
-rw-r--r--Ryujinx.Graphics.OpenGL/EnumConversion.cs38
-rw-r--r--Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Pipeline.cs6
-rw-r--r--Ryujinx.Graphics.OpenGL/Program.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs2
-rw-r--r--Ryujinx.Graphics.OpenGL/Renderer.cs2
7 files changed, 33 insertions, 33 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Debugger.cs b/Ryujinx.Graphics.OpenGL/Debugger.cs
index 9d0a1f59..974e5ead 100644
--- a/Ryujinx.Graphics.OpenGL/Debugger.cs
+++ b/Ryujinx.Graphics.OpenGL/Debugger.cs
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.OpenGL
GL.DebugMessageCallback(_debugCallback, IntPtr.Zero);
- Logger.PrintWarning(LogClass.Gpu, "OpenGL Debugging is enabled. Performance will be negatively impacted.");
+ Logger.Warning?.Print(LogClass.Gpu, "OpenGL Debugging is enabled. Performance will be negatively impacted.");
}
private static void GLDebugHandler(
@@ -63,18 +63,18 @@ namespace Ryujinx.Graphics.OpenGL
switch (type)
{
- case DebugType.DebugTypeError : Logger.PrintError(LogClass.Gpu, $"{severity}: {msg}\nCallStack={Environment.StackTrace}", "GLERROR"); break;
- case DebugType.DebugTypePerformance: Logger.PrintWarning(LogClass.Gpu, $"{severity}: {msg}", "GLPERF"); break;
- case DebugType.DebugTypePushGroup : Logger.PrintInfo(LogClass.Gpu, $"{{ ({id}) {severity}: {msg}", "GLINFO"); break;
- case DebugType.DebugTypePopGroup : Logger.PrintInfo(LogClass.Gpu, $"}} ({id}) {severity}: {msg}", "GLINFO"); break;
+ case DebugType.DebugTypeError : Logger.Error?.Print(LogClass.Gpu, $"{severity}: {msg}\nCallStack={Environment.StackTrace}", "GLERROR"); break;
+ case DebugType.DebugTypePerformance: Logger.Warning?.Print(LogClass.Gpu, $"{severity}: {msg}", "GLPERF"); break;
+ case DebugType.DebugTypePushGroup : Logger.Info?.Print(LogClass.Gpu, $"{{ ({id}) {severity}: {msg}", "GLINFO"); break;
+ case DebugType.DebugTypePopGroup : Logger.Info?.Print(LogClass.Gpu, $"}} ({id}) {severity}: {msg}", "GLINFO"); break;
default:
if (source == DebugSource.DebugSourceApplication)
{
- Logger.PrintInfo(LogClass.Gpu, $"{type} {severity}: {msg}", "GLINFO");
+ Logger.Info?.Print(LogClass.Gpu, $"{type} {severity}: {msg}", "GLINFO");
}
else
{
- Logger.PrintDebug(LogClass.Gpu, $"{type} {severity}: {msg}", "GLDEBUG");
+ Logger.Debug?.Print(LogClass.Gpu, $"{type} {severity}: {msg}", "GLDEBUG");
}
break;
}
diff --git a/Ryujinx.Graphics.OpenGL/EnumConversion.cs b/Ryujinx.Graphics.OpenGL/EnumConversion.cs
index 09860be3..97fa9e2c 100644
--- a/Ryujinx.Graphics.OpenGL/EnumConversion.cs
+++ b/Ryujinx.Graphics.OpenGL/EnumConversion.cs
@@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.OpenGL
return TextureWrapMode.ClampToEdge;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(AddressMode)} enum value: {mode}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(AddressMode)} enum value: {mode}.");
return TextureWrapMode.Clamp;
}
@@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.OpenGL
return All.OneMinusConstantAlpha;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(BlendFactor)} enum value: {factor}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(BlendFactor)} enum value: {factor}.");
return All.Zero;
}
@@ -118,7 +118,7 @@ namespace Ryujinx.Graphics.OpenGL
return BlendEquationMode.Max;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(BlendOp)} enum value: {op}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(BlendOp)} enum value: {op}.");
return BlendEquationMode.FuncAdd;
}
@@ -133,7 +133,7 @@ namespace Ryujinx.Graphics.OpenGL
return TextureCompareMode.CompareRToTexture;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(CompareMode)} enum value: {mode}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(CompareMode)} enum value: {mode}.");
return TextureCompareMode.None;
}
@@ -168,7 +168,7 @@ namespace Ryujinx.Graphics.OpenGL
return All.Always;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(CompareOp)} enum value: {op}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(CompareOp)} enum value: {op}.");
return All.Never;
}
@@ -183,7 +183,7 @@ namespace Ryujinx.Graphics.OpenGL
return ClipDepthMode.ZeroToOne;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(DepthMode)} enum value: {mode}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(DepthMode)} enum value: {mode}.");
return ClipDepthMode.NegativeOneToOne;
}
@@ -198,7 +198,7 @@ namespace Ryujinx.Graphics.OpenGL
return All.StencilIndex;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(DepthStencilMode)} enum value: {mode}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(DepthStencilMode)} enum value: {mode}.");
return All.Depth;
}
@@ -215,7 +215,7 @@ namespace Ryujinx.Graphics.OpenGL
return CullFaceMode.FrontAndBack;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(Face)} enum value: {face}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(Face)} enum value: {face}.");
return CullFaceMode.Back;
}
@@ -230,7 +230,7 @@ namespace Ryujinx.Graphics.OpenGL
return FrontFaceDirection.Ccw;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(FrontFace)} enum value: {frontFace}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(FrontFace)} enum value: {frontFace}.");
return FrontFaceDirection.Cw;
}
@@ -247,7 +247,7 @@ namespace Ryujinx.Graphics.OpenGL
return DrawElementsType.UnsignedInt;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(IndexType)} enum value: {type}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(IndexType)} enum value: {type}.");
return DrawElementsType.UnsignedByte;
}
@@ -262,7 +262,7 @@ namespace Ryujinx.Graphics.OpenGL
return TextureMagFilter.Linear;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(MagFilter)} enum value: {filter}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(MagFilter)} enum value: {filter}.");
return TextureMagFilter.Nearest;
}
@@ -285,7 +285,7 @@ namespace Ryujinx.Graphics.OpenGL
return TextureMinFilter.LinearMipmapLinear;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(MinFilter)} enum value: {filter}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(MinFilter)} enum value: {filter}.");
return TextureMinFilter.Nearest;
}
@@ -326,7 +326,7 @@ namespace Ryujinx.Graphics.OpenGL
return PrimitiveType.Patches;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}.");
return PrimitiveType.Points;
}
@@ -351,7 +351,7 @@ namespace Ryujinx.Graphics.OpenGL
return TransformFeedbackPrimitiveType.Triangles;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(PrimitiveTopology)} enum value: {topology}.");
return TransformFeedbackPrimitiveType.Points;
}
@@ -378,7 +378,7 @@ namespace Ryujinx.Graphics.OpenGL
return OpenTK.Graphics.OpenGL.StencilOp.DecrWrap;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(GAL.StencilOp)} enum value: {op}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(GAL.StencilOp)} enum value: {op}.");
return OpenTK.Graphics.OpenGL.StencilOp.Keep;
}
@@ -401,7 +401,7 @@ namespace Ryujinx.Graphics.OpenGL
return All.Alpha;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(SwizzleComponent)} enum value: {swizzleComponent}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(SwizzleComponent)} enum value: {swizzleComponent}.");
return All.Zero;
}
@@ -437,7 +437,7 @@ namespace Ryujinx.Graphics.OpenGL
return TextureTarget.TextureBuffer;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(Target)} enum value: {target}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(Target)} enum value: {target}.");
return TextureTarget.Texture2D;
}
@@ -464,7 +464,7 @@ namespace Ryujinx.Graphics.OpenGL
return NvViewportSwizzle.ViewportSwizzleNegativeWNv;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(ViewportSwizzle)} enum value: {swizzle}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(ViewportSwizzle)} enum value: {swizzle}.");
return NvViewportSwizzle.ViewportSwizzlePositiveXNv;
}
@@ -507,7 +507,7 @@ namespace Ryujinx.Graphics.OpenGL
return All.Set;
}
- Logger.PrintDebug(LogClass.Gpu, $"Invalid {nameof(LogicalOp)} enum value: {op}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid {nameof(LogicalOp)} enum value: {op}.");
return All.Never;
}
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
index 4fc0a77f..ed258aee 100644
--- a/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
+++ b/Ryujinx.Graphics.OpenGL/Image/TextureStorage.cs
@@ -140,7 +140,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
break;
default:
- Logger.PrintDebug(LogClass.Gpu, $"Invalid or unsupported texture target: {target}.");
+ Logger.Debug?.Print(LogClass.Gpu, $"Invalid or unsupported texture target: {target}.");
break;
}
}
diff --git a/Ryujinx.Graphics.OpenGL/Pipeline.cs b/Ryujinx.Graphics.OpenGL/Pipeline.cs
index 69bd7844..b5eb3543 100644
--- a/Ryujinx.Graphics.OpenGL/Pipeline.cs
+++ b/Ryujinx.Graphics.OpenGL/Pipeline.cs
@@ -156,7 +156,7 @@ namespace Ryujinx.Graphics.OpenGL
{
if (!_program.IsLinked)
{
- Logger.PrintDebug(LogClass.Gpu, "Dispatch error, shader not linked.");
+ Logger.Debug?.Print(LogClass.Gpu, "Dispatch error, shader not linked.");
return;
}
@@ -169,7 +169,7 @@ namespace Ryujinx.Graphics.OpenGL
{
if (!_program.IsLinked)
{
- Logger.PrintDebug(LogClass.Gpu, "Draw error, shader not linked.");
+ Logger.Debug?.Print(LogClass.Gpu, "Draw error, shader not linked.");
return;
}
@@ -287,7 +287,7 @@ namespace Ryujinx.Graphics.OpenGL
{
if (!_program.IsLinked)
{
- Logger.PrintDebug(LogClass.Gpu, "Draw error, shader not linked.");
+ Logger.Debug?.Print(LogClass.Gpu, "Draw error, shader not linked.");
return;
}
diff --git a/Ryujinx.Graphics.OpenGL/Program.cs b/Ryujinx.Graphics.OpenGL/Program.cs
index 06f05f67..6e253140 100644
--- a/Ryujinx.Graphics.OpenGL/Program.cs
+++ b/Ryujinx.Graphics.OpenGL/Program.cs
@@ -256,7 +256,7 @@ namespace Ryujinx.Graphics.OpenGL
if (status == 0)
{
// Use GL.GetProgramInfoLog(Handle), it may be too long to print on the log.
- Logger.PrintDebug(LogClass.Gpu, "Shader linking failed.");
+ Logger.Debug?.Print(LogClass.Gpu, "Shader linking failed.");
}
else
{
diff --git a/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs b/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs
index 9750ec92..76c94126 100644
--- a/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs
+++ b/Ryujinx.Graphics.OpenGL/Queries/BufferedQuery.cs
@@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.OpenGL.Queries
if (iterations >= MaxQueryRetries)
{
- Logger.PrintError(LogClass.Gpu, $"Error: Query result timed out. Took more than {MaxQueryRetries} tries.");
+ Logger.Error?.Print(LogClass.Gpu, $"Error: Query result timed out. Took more than {MaxQueryRetries} tries.");
}
}
diff --git a/Ryujinx.Graphics.OpenGL/Renderer.cs b/Ryujinx.Graphics.OpenGL/Renderer.cs
index e7a8a96b..ee2fe93d 100644
--- a/Ryujinx.Graphics.OpenGL/Renderer.cs
+++ b/Ryujinx.Graphics.OpenGL/Renderer.cs
@@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.OpenGL
GpuRenderer = GL.GetString(StringName.Renderer);
GpuVersion = GL.GetString(StringName.Version);
- Logger.PrintInfo(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})");
+ Logger.Notice.Print(LogClass.Gpu, $"{GpuVendor} {GpuRenderer} ({GpuVersion})");
}
public void ResetCounter(CounterType type)