mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-09 08:48:44 +00:00
b18ef8e3a0
* Workaround for Intel view format bug * Dispose of the intermmediate texture aswell * Apply workaround on AMD aswell
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using OpenTK.Graphics.OpenGL;
|
|
using Ryujinx.Common.Logging;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Ryujinx.Graphics.OpenGL
|
|
{
|
|
public static class Debugger
|
|
{
|
|
private static DebugProc _debugCallback;
|
|
|
|
public static void Initialize()
|
|
{
|
|
GL.Enable(EnableCap.DebugOutputSynchronous);
|
|
|
|
GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DontCare, DebugSeverityControl.DontCare, 0, (int[])null, true);
|
|
|
|
_debugCallback = GLDebugHandler;
|
|
|
|
GL.DebugMessageCallback(_debugCallback, IntPtr.Zero);
|
|
}
|
|
|
|
private static void GLDebugHandler(
|
|
DebugSource source,
|
|
DebugType type,
|
|
int id,
|
|
DebugSeverity severity,
|
|
int length,
|
|
IntPtr message,
|
|
IntPtr userParam)
|
|
{
|
|
string fullMessage = $"{type} {severity} {source} {Marshal.PtrToStringAnsi(message)}";
|
|
|
|
switch (type)
|
|
{
|
|
case DebugType.DebugTypeError:
|
|
Logger.PrintError(LogClass.Gpu, fullMessage);
|
|
break;
|
|
case DebugType.DebugTypePerformance:
|
|
Logger.PrintWarning(LogClass.Gpu, fullMessage);
|
|
break;
|
|
default:
|
|
Logger.PrintDebug(LogClass.Gpu, fullMessage);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|