blob: 9da98ae1a620d9952aac997c4276e959368403d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
using OpenTK.Graphics.OpenGL;
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);
int[] array = null;
GL.DebugMessageControl(DebugSourceControl.DontCare, DebugTypeControl.DontCare, DebugSeverityControl.DontCare, 0, array, true);
_debugCallback = PrintDbg;
GL.DebugMessageCallback(_debugCallback, IntPtr.Zero);
}
private static void PrintDbg(
DebugSource source,
DebugType type,
int id,
DebugSeverity severity,
int length,
IntPtr message,
IntPtr userParam)
{
string msg = Marshal.PtrToStringAnsi(message);
if (type == DebugType.DebugTypeError && !msg.Contains("link"))
{
throw new Exception(msg);
}
System.Console.WriteLine("GL message: " + source + " " + type + " " + severity + " " + msg);
}
}
}
|