Exemplo n.º 1
0
        private void SetApplicationInfo()
        {
            uint appVersion    = 0;
            uint engineVersion = 0;

            {
                var    md5  = MD5.Create();
                byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(Application.version));
                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(data);
                }
                appVersion = BitConverter.ToUInt32(data, 0);
            }

            {
                var    md5  = MD5.Create();
                byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(Application.unityVersion));
                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(data);
                }
                engineVersion = BitConverter.ToUInt32(data, 0);
            }


            var section = DiagnosticReport.GetSection("OpenXR Provider Info");

            DiagnosticReport.AddSectionEntry(section, "Spec Version", $"{OpenXRRuntime.apiVersion}");
            DiagnosticReport.AddSectionEntry(section, "Provider Version", $"{OpenXRRuntime.pluginVersion}");
            DiagnosticReport.AddSectionEntry(section, "App", $"{Application.productName} {Application.version} #{appVersion}");
            DiagnosticReport.AddSectionEntry(section, "Engine", $"{Application.unityVersion} #{engineVersion}");

            Internal_SetApplicationInfo(Application.productName, appVersion, engineVersion);
        }
        private void RequestOpenXRFeatures()
        {
            var instance = OpenXRSettings.Instance;

            if (instance == null || instance.features == null)
            {
                return;
            }

            StringBuilder requestedLog = new StringBuilder("");
            StringBuilder failedLog    = new StringBuilder("");
            uint          count        = 0;
            uint          failedCount  = 0;

            foreach (var feature in instance.features)
            {
                if (feature == null || !feature.enabled)
                {
                    continue;
                }

                ++count;

                requestedLog.Append($"  {feature.nameUi}: Version={feature.version}, Company=\"{feature.company}\"");

                if (!string.IsNullOrEmpty(feature.openxrExtensionStrings))
                {
                    requestedLog.Append($", Extensions=\"{feature.openxrExtensionStrings}\"");

                    // Check to see if any of the required extensions are not supported by the runtime
                    foreach (var extensionString in feature.openxrExtensionStrings.Split(' '))
                    {
                        if (string.IsNullOrWhiteSpace(extensionString))
                        {
                            continue;
                        }
                        if (!Internal_RequestEnableExtensionString(extensionString))
                        {
                            ++failedCount;
                            failedLog.Append($"  {extensionString}: Feature=\"{feature.nameUi}\": Version={feature.version}, Company=\"{feature.company}\"\n");
                        }
                    }
                }

                requestedLog.Append("\n");
            }

            var section = DiagnosticReport.GetSection("OpenXR Runtime Info");

            DiagnosticReport.AddSectionBreak(section);
            DiagnosticReport.AddSectionEntry(section, "Features requested to be enabled", $"({count})\n{requestedLog.ToString()}");
            DiagnosticReport.AddSectionBreak(section);
            DiagnosticReport.AddSectionEntry(section, "Requested feature extensions not supported by runtime", $"({failedCount})\n{failedLog.ToString()}");
        }
Exemplo n.º 3
0
        private void RequestOpenXRFeatures()
        {
            var instance = OpenXRSettings.Instance;

            if (instance == null || instance.features == null)
            {
                return;
            }

            StringBuilder requestedLog = new StringBuilder("");
            StringBuilder failedLog    = new StringBuilder("");
            uint          count        = 0;
            uint          failedCount  = 0;

            foreach (var feature in instance.features)
            {
                if (feature != null && feature.enabled)
                {
                    ++count;
                    if (string.IsNullOrEmpty(feature.openxrExtensionStrings))
                    {
                        requestedLog.Append($"    Name={feature.nameUi} Extension=NA Version={feature.version}\n");
                        continue;
                    }
                    else
                    {
                        requestedLog.Append($"    Name={feature.nameUi} Extension={feature.openxrExtensionStrings} Version={feature.version}\n");
                    }

                    foreach (var extensionString in feature.openxrExtensionStrings.Split(' '))
                    {
                        if (string.IsNullOrEmpty(extensionString))
                        {
                            continue;
                        }
                        if (!Internal_RequestEnableExtensionString(extensionString))
                        {
                            ++failedCount;
                            failedLog.Append($"    Name={feature.nameUi} Extension={extensionString}  Version={feature.version}\n");
                        }
                    }
                }
            }

            var section = DiagnosticReport.GetSection("OpenXR Runtime Info");

            DiagnosticReport.AddSectionBreak(section);
            DiagnosticReport.AddSectionEntry(section, "Features requested to be enabled", $"{count}\n{requestedLog.ToString()}");
            DiagnosticReport.AddSectionBreak(section);
            DiagnosticReport.AddSectionEntry(section, "Features failed to be enabled", $"{failedCount}\n{failedLog.ToString()}");
        }
Exemplo n.º 4
0
        static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
        {
            var section = DiagnosticReport.GetSection("Unhandled Exception Report");

            DiagnosticReport.AddSectionEntry(section, "Is Terminating", $"{args.IsTerminating}");

            var e = (Exception)args.ExceptionObject;

            DiagnosticReport.AddSectionEntry(section, "Message", $"{e.Message}");
            DiagnosticReport.AddSectionEntry(section, "Source", $"{e.Source}");
            DiagnosticReport.AddSectionEntry(section, "Stack Trace", $"\n{e.StackTrace}");

            DiagnosticReport.DumpReport("Uncaught Exception");
        }
Exemplo n.º 5
0
        private static void DebugLogEnabledSpecExtensions()
        {
            var section = DiagnosticReport.GetSection("OpenXR Runtime Info");

            DiagnosticReport.AddSectionBreak(section);

            var extensions = OpenXRRuntime.GetEnabledExtensions();
            var log        = new StringBuilder($"({extensions.Length})\n");

            foreach (var extension in extensions)
            {
                log.Append($"  Name={extension} Version={OpenXRRuntime.GetExtensionVersion(extension)}\n");
            }

            DiagnosticReport.AddSectionEntry(section, "Spec extensions enabled", log.ToString());
        }