mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-19 23:28:42 +02:00
* 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;
|
|
}
|
|
}
|
|
}
|
|
}
|