public void SerializeToAsset()
        {
            var settingsAsset = ScriptableObject.CreateInstance <CurrentSettings>();

            settingsAsset.SimulationMode           = SimulationMode;
            settingsAsset.PlayerGraphicsApi        = PlayerGraphicsApi.ToString();
            settingsAsset.MtRendering              = MtRendering;
            settingsAsset.GraphicsJobs             = GraphicsJobs;
            settingsAsset.ColorSpace               = ColorSpace.ToString();
            settingsAsset.EnabledXrTarget          = XrTarget;
            settingsAsset.XrsdkRevision            = GetOculusXrSdkPackageVersionInfo();
            settingsAsset.XrManagementRevision     = GetXrManagementPackageVersionInfo();
            settingsAsset.UrpPackageVersionInfo    = GetUrpPackageVersionInfo();
            settingsAsset.HdrpPackageVersionInfo   = GetHdrpPackageVersionInfo();
            settingsAsset.PerfTestsPackageRevision = GetPerfTestsPackageVersionInfo();
            settingsAsset.DeviceRuntimeVersion     = DeviceRuntimeVersion;
            settingsAsset.Username                  = Username = Environment.UserName;
            settingsAsset.FfrLevel                  = FfrLevel;
            settingsAsset.TestsRevision             = TestsRevision;
            settingsAsset.TestsRevisionDate         = TestsRevisionDate;
            settingsAsset.TestsBranch               = TestsBranch;
            settingsAsset.AndroidTargetArchitecture = string.Format("AndroidTargetArchitecture|{0}", AndroidTargetArchitecture.ToString());
            settingsAsset.RenderPipeline            = RenderPipeline =
                $"renderpipeline|{(GraphicsSettings.renderPipelineAsset != null ? GraphicsSettings.renderPipelineAsset.name : "BuiltInRenderer")}";

#if URP
            settingsAsset.AntiAliasing = GraphicsSettings.renderPipelineAsset != null
                ? ((UniversalRenderPipelineAsset)GraphicsSettings.renderPipelineAsset).msaaSampleCount
                : QualitySettings.antiAliasing;
#else
            settingsAsset.AntiAliasing = QualitySettings.antiAliasing;
#endif


#if OCULUS_SDK
            // These fields are used by the performance test framework and are an artifact from this class
            // previously using the provider - specific enums before converting to a cross-platform friendly string
            if (BuildTarget == BuildTarget.Android)
            {
                settingsAsset.StereoRenderingModeAndroid = StereoRenderingPath;
            }
            else
            {
                settingsAsset.StereoRenderingModeDesktop = StereoRenderingPath;
            }

#if OCULUS_SDK_PERF
            settingsAsset.PluginVersion = string.Format("OculusPluginVersion|{0}", OculusStats.PluginVersion);
#endif
#endif
#if XR_SDK
            settingsAsset.StereoRenderingMode = StereoRenderingPath;
#else
            // legacy xr has different enum for player settings and runtime settings for stereo rendering mode
            var builtInXrStereoPath = (StereoRenderingPath)Enum.Parse(typeof(StereoRenderingPath), StereoRenderingPath);
            settingsAsset.StereoRenderingMode = GetXrStereoRenderingPathMapping(builtInXrStereoPath).ToString();
#endif
            CreateAndSaveCurrentSettingsAsset(settingsAsset);
        }
コード例 #2
0
        private static List <ComputeShaderInspector.KernelInfo> GetKernelDisplayInfo(ComputeShader cs)
        {
            List <ComputeShaderInspector.KernelInfo> list = new List <ComputeShaderInspector.KernelInfo>();
            int computeShaderPlatformCount = ShaderUtil.GetComputeShaderPlatformCount(cs);

            for (int i = 0; i < computeShaderPlatformCount; i++)
            {
                GraphicsDeviceType computeShaderPlatformType = ShaderUtil.GetComputeShaderPlatformType(cs, i);
                int computeShaderPlatformKernelCount         = ShaderUtil.GetComputeShaderPlatformKernelCount(cs, i);
                for (int j = 0; j < computeShaderPlatformKernelCount; j++)
                {
                    string computeShaderPlatformKernelName = ShaderUtil.GetComputeShaderPlatformKernelName(cs, i, j);
                    bool   flag = false;
                    foreach (ComputeShaderInspector.KernelInfo current in list)
                    {
                        if (current.name == computeShaderPlatformKernelName)
                        {
                            ComputeShaderInspector.KernelInfo expr_6C = current;
                            expr_6C.platforms += ' ';
                            ComputeShaderInspector.KernelInfo expr_85 = current;
                            expr_85.platforms += computeShaderPlatformType.ToString();
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        list.Add(new ComputeShaderInspector.KernelInfo
                        {
                            name      = computeShaderPlatformKernelName,
                            platforms = computeShaderPlatformType.ToString()
                        });
                    }
                }
            }
            return(list);
        }
コード例 #3
0
            public override void DrawGUI()
            {
                EditorGUILayout.HelpBox("BuildTarget is set to use an unsupported GraphicsAPI", MessageType.Error);

                GraphicsDeviceType[] graphicsDeviceTypes     = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget);
                GraphicsDeviceType   firstGraphicsDeviceType = graphicsDeviceTypes[0];

                string message = firstGraphicsDeviceType.ToString() + " is not supported on " + EditorUserBuildSettings.activeBuildTarget;

                message += "\n\n";
                message += "Supported:";

                GraphicsDeviceType[] types = HvrHelper.Support.GetSupportedGraphicsDeviceTypes_FromRuntimePlatform(Application.platform);

                for (int i = 0; i < types.Length; i++)
                {
                    message += "\n - " + types[i].ToString();
                }

                EditorGUILayout.LabelField(message, EditorStyles.textArea);
            }
コード例 #4
0
        private bool CheckGraphicsAPICompatibility(XRLoader loader)
        {
            GraphicsDeviceType        deviceType           = SystemInfo.graphicsDeviceType;
            List <GraphicsDeviceType> supportedDeviceTypes = loader.GetSupportedGraphicsDeviceTypes(false);

            // To help with backward compatibility, if the compatibility list is empty we assume that it does not implement the GetSupportedGraphicsDeviceTypes method
            // Therefore we revert to the previous behavior of building or starting the loader regardless of gfx api settings.
            if (supportedDeviceTypes.Count > 0 && !supportedDeviceTypes.Contains(deviceType))
            {
                Debug.LogWarning(String.Format("The {0} does not support the initialized graphics device, {1}. Please change the preffered Graphics API in PlayerSettings. Attempting to start the next XR loader.", loader.name, deviceType.ToString()));
                return(false);
            }

            return(true);
        }
コード例 #5
0
        public void SerializeToAsset()
        {
            var settings  = CustomMetadataManager.Instance;
            var pathParts = Application.dataPath.Split('/');

            settings.ProjectName                  = pathParts.Length >= 2 ? pathParts[pathParts.Length - 2] : string.Empty;
            settings.PlayerGraphicsApi            = PlayerGraphicsApi.ToString();
            settings.MtRendering                  = MtRendering;
            settings.GraphicsJobs                 = GraphicsJobs;
            settings.EnableBurst                  = EnableBurst;
            settings.ScriptingBackend             = ScriptingImplementation.ToString();
            settings.ColorSpace                   = ColorSpace.ToString();
            settings.Username                     = Username = Environment.UserName;
            settings.PackageUnderTestName         = PackageUnderTestName;
            settings.PackageUnderTestVersion      = PackageUnderTestVersion;
            settings.PackageUnderTestRevision     = PackageUnderTestRevision;
            settings.PackageUnderTestRevisionDate = PackageUnderTestRevisionDate;
            settings.PackageUnderTestBranch       = PackageUnderTestBranch;
            settings.TestsRevision                = TestsRevision;
            settings.TestsRevisionDate            = TestsRevisionDate;
            settings.TestsBranch                  = TestsBranch;
            settings.JobLink                    = JobLink;
            settings.JobWorkerCount             = Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount;
            settings.ApiCompatibilityLevel      = ApiCompatibilityLevel.ToString();
            settings.StripEngineCode            = StringEngineCode;
            settings.ManagedStrippingLevel      = ManagedStrippingLevel.ToString();
            settings.ScriptDebugging            = ScriptDebugging;
            settings.TestProjectName            = TestProjectName;
            settings.TestProjectRevision        = TestProjectRevision;
            settings.TestProjectRevisionDate    = TestProjectRevisionDate;
            settings.TestProjectBranch          = TestProjectBranch;
            settings.EnabledXrTarget            = EnabledXrTarget;
            settings.StereoRenderingMode        = StereoRenderingMode;
            settings.StereoRenderingModeDesktop = StereoRenderingModeDesktop;
            settings.StereoRenderingModeAndroid = StereoRenderingModeAndroid;
            settings.SimulationMode             = SimulationMode;
            settings.PluginVersion              = PluginVersion;
            settings.DeviceRuntimeVersion       = DeviceRuntimeVersion;
            settings.FfrLevel                   = FfrLevel;
            settings.AndroidTargetArchitecture  = AndroidTargetArchitecture.ToString();

            GetPackageUnderTestVersionInfo(settings);
            settings.RenderPipeline = RenderPipeline = $"{(GraphicsSettings.renderPipelineAsset != null ? GraphicsSettings.renderPipelineAsset.name : "BuiltInRenderer")}";

#if URP
            settings.AntiAliasing = GraphicsSettings.renderPipelineAsset != null
                ? ((UniversalRenderPipelineAsset)GraphicsSettings.renderPipelineAsset).msaaSampleCount
                : QualitySettings.antiAliasing;
#else
            settings.AntiAliasing = QualitySettings.antiAliasing;
#endif

#if ENABLE_VR
#if OCULUS_SDK
            // These fields are used by the performance test framework and are an artifact from this class
            // previously using the provider - specific enums before converting to a cross-platform friendly string
            if (BuildTarget == BuildTarget.Android)
            {
                settings.StereoRenderingModeAndroid = StereoRenderingMode;
            }
            else
            {
                settings.StereoRenderingModeDesktop = StereoRenderingMode;
            }

#if OCULUS_SDK_PERF
            settings.PluginVersion = string.Format("OculusPluginVersion|{0}", OculusStats.PluginVersion);
#endif
#endif
#if XR_SDK
            settings.StereoRenderingMode = StereoRenderingMode;
#else
            if (!string.IsNullOrEmpty(StereoRenderingMode))
            {
                // legacy xr has different enum for player settings and runtime settings for stereo rendering mode
                var builtInXrStereoPath = (StereoRenderingPath)Enum.Parse(typeof(StereoRenderingPath), StereoRenderingMode);
                settings.StereoRenderingMode = GetXrStereoRenderingPathMapping(builtInXrStereoPath).ToString();
            }
#endif
#endif
            CustomMetadataManager.SaveSettingsAssetInEditor();
        }