Beispiel #1
0
    public static void GLDebugProc(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam)
    {
        string strMessage = Marshal.PtrToStringAnsi(message);


        Console.WriteLine($"[{ (type == DebugType.DebugTypeError ? "**GL ERROR**" : type.ToString())}; {severity.ToString()}]: {strMessage}; From: {source.ToString()}");
        Debugger.Break();
    }
Beispiel #2
0
 private static void GLDebugAction(DebugSource source, DebugType type, DebugSeverity severity, string msg)
 {
     if (type.HasFlag(DebugType.DebugTypeError))
     {
         throw new Exception("[GLError] " + msg);
     }
     Write("GL" + (type != DebugType.DontCare ? type.ToString().Substring(9) : "DontCare"), ConsoleColor.Gray, msg);
 }
Beispiel #3
0
        private void OnDebugMessage(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr user)
        {
            // Ignores
            if (id == 0x00020071)
            {
                return;                   // memory usage
            }
            if (id == 0x00020084)
            {
                return;                   // Texture state usage warning: Texture 0 is base level inconsistent. Check texture size.
            }
            if (id == 0x00020061)
            {
                return;                   // Framebuffer detailed info: The driver allocated storage for renderbuffer 1.
            }
            if (id == 0x00020004)
            {
                return;                   // Usage warning: Generic vertex attribute array ... uses a pointer with a small value (...). Is this intended to be used as an offset into a buffer object?
            }
            if (id == 0x00020072)
            {
                return;                   // Buffer performance warning: Buffer object ... (bound to ..., usage hint is GL_STATIC_DRAW) is being copied/moved from VIDEO memory to HOST memory.
            }
            if (id == 0x00020074)
            {
                return;                   // Buffer usage warning: Analysis of buffer object ... (bound to ...) usage indicates that the GPU is the primary producer and consumer of data for this buffer object.  The usage hint s upplied with this buffer object, GL_STATIC_DRAW, is inconsistent with this usage pattern.  Try using GL_STREAM_COPY_ARB, GL_STATIC_COPY_ARB, or GL_DYNAMIC_COPY_ARB instead.
            }
            string sourceString = source.ToString();

            if (sourceString.StartsWith("DebugSource"))
            {
                sourceString = sourceString.Remove(0, "DebugSource".Length);
            }

            string typeString = type.ToString();

            if (typeString.StartsWith("DebugType"))
            {
                typeString = typeString.Remove(0, "DebugType".Length);
            }

            string severityString = severity.ToString();

            if (severityString.StartsWith("DebugSeverity"))
            {
                severityString = severityString.Remove(0, "DebugSeverity".Length);
            }

            string messageString = string.Format("(OpenGL) ({0}) ({1}) ({2}) {3}", severityString, sourceString, typeString, Marshal.PtrToStringAnsi(message, length));


            Log.Debug(messageString);
            Log.FlushBuffer();
        }
    private void F1Menu()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            debugType++;
            if (Enum.GetValues(typeof(DebugType)).Length - 1 < (int)debugType)
            {
                debugType = 0;
            }

            layerDebugText.color = Color.white;
            layerDebugText.text  = debugType.ToString();

            switch (debugType)
            {
            default:
            case DebugType.None:
                Instance.hexSystemText.ForEach(h => h.gameObject.SetActive(false));
                break;

            case DebugType.Index:
                Instance.hexSystemText.ForEach(h => h.gameObject.SetActive(true));
                Instance.hexSystemText.ForEach(h => h.text = h.transform.GetComponentInParent <HexObject>().Index.ToString());
                break;

            case DebugType.CubeCoord:
                Instance.hexSystemText.ForEach(h => h.gameObject.SetActive(true));
                Instance.hexSystemText.ForEach(h => h.text = h.transform.GetComponentInParent <HexObject>().hex.cubeCoords.ToString());
                break;

            case DebugType.PotentialField:
                layerDebugText.text += ": " + layerType.ToString();
                Instance.hexSystemText.ForEach(h => h.gameObject.SetActive(true));
                Instance.hexSystemText.ForEach(h => h.text = HeatMapInfo.Instance.Field[layerType][h.transform.GetComponentInParent <HexObject>().Index].ToString());
                break;
            }
        }
    }
Beispiel #5
0
        static void ProcessMessage(DebugSource source, DebugType type, int id, DebugSeverity severity, string message)
        {
            if (type == DebugType.DebugTypePushGroup || type == DebugType.DebugTypePopGroup)
            {
                return;
            }
            string msg = message + " (source: " + source.ToString() + "; type: " + type.ToString() + "; id: " + id.ToString() + "; severity: " + severity.ToString() + ")";

            OutputTypeGlob outputType = OutputTypeGlob.LogOnly;

            if (severity == DebugSeverity.DebugSeverityMedium || severity == DebugSeverity.DebugSeverityHigh)
            {
                outputType = OutputTypeGlob.PerformanceWarning;
            }
            if (id == 131185 || id == 131186 || id == 131154)            // Buffer memory info, pixel path performance (warning generated by blitFramebuffers)
            {
                return;
            }

            _debugOutput.Print(outputType, msg);
            _debugOutput.Print(OutputTypeGlob.LogOnly, Environment.StackTrace);
        }
    private void F1Menu()
    {
        if (Input.GetAxis("Debug Menu") == 1)
        {
            if (!clickedButton)
            {
                clickedButton = true;

                if (Enum.GetValues(typeof(DebugType)).Length - 1 < (int)++debugType)
                {
                    debugType = 0;
                }

                layerDebugText.color = Color.white;
                layerDebugText.text  = debugType.ToString();

                UpdateValues();
            }
        }
        else
        {
            clickedButton = false;
        }
    }
Beispiel #7
0
 private void DBGProc(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam)
 {
     Debug.WriteLine("OpenGL: [" + severity.ToString() + "] [" + type.ToString() + "] [" + source.ToString() + "] : " + Marshal.PtrToStringAnsi(message));
 }
Beispiel #8
0
 public static void uAddDebugLog(string _log, DebugType _type = DebugType.INFO, string caller = "")
 {
     try
     {
         debugLog.Append($"{DateTime.Now.ToLocalTime().ToString("MM-dd-yy")}_{DateTime.Now.ToLocalTime().ToLongTimeString()} :: {caller.ToUpper()} :: {_type.ToString()}: {_log}{Environment.NewLine}");
         if (Toolbox.debugLog.Length > 10000)
         {
             Toolbox.debugLog.Append($"{DateTime.Now.ToLocalTime().ToString("MM-dd-yy")}_{DateTime.Now.ToLocalTime().ToLongTimeString()} :: {caller.ToUpper()} :: {_type.ToString()}: Dumping Debug Logs...{Environment.NewLine}");
             Director.Main.DumpDebugLog();
         }
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
 public PrintLog(DebugType _type, bool _enable)
 {
     type   = _type.ToString();
     enable = _enable;
 }
Beispiel #10
0
 public static void uDebugLogAdd(string _log, DebugType _type = DebugType.INFO, string caller = "")
 {
     try
     {
         debugLog.Append($"{DateTime.Now.ToLocalTime().ToString("MM-dd-yy")}_{DateTime.Now.ToLocalTime().ToLongTimeString()} :: {caller.ToUpper()} :: {_type.ToString()}: {_log}{Environment.NewLine}");
         if (debugLog.Length > 2500)
         {
             DumpDebugLog();
         }
     }
     catch (Exception ex)
     {
         LogException(ex);
     }
 }
Beispiel #11
0
 public static void D(DebugType type, string msg)
 {
     D(String.Format("<color=#00ffff>[{0}]</color>{1}", type.ToString(), msg));
 }