// Note: If you add new platform in this function, think about adding support in IsSupportedBuildTarget() function below public static bool IsSupportedGraphicDevice(GraphicsDeviceType graphicDevice) { return(SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne || SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOneD3D12 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan || SystemInfo.graphicsDeviceType == (GraphicsDeviceType)22 /*GraphicsDeviceType.Switch*/); }
public PlayFabDataGatherer() { #if UNITY_5 || UNITY_5_3_OR_NEWER // UNITY_5 Application info ProductName = Application.productName; Version = Application.version; Company = Application.companyName; Platform = Application.platform; // UNITY_5 Graphics Abilities GraphicsMultiThreaded = SystemInfo.graphicsMultiThreaded; #endif #if !UNITY_5_0 && (UNITY_5 || UNITY_5_3_OR_NEWER) GraphicsType = SystemInfo.graphicsDeviceType; #endif //Only Used on iOS & Android #if UNITY_5_6_OR_NEWER && UNITY_ANDROID && (UNITY_IOS || UNITY_IPHONE) ProductBundle = Application.identifier; #elif UNITY_ANDROID && (UNITY_IOS || UNITY_IPHONE) ProductBundle = Application.bundleIdentifier; #endif // Application info DataPath = Application.dataPath; PersistentDataPath = Application.persistentDataPath; StreamingAssetsPath = Application.streamingAssetsPath; TargetFrameRate = Application.targetFrameRate; UnityVersion = Application.unityVersion; RunInBackground = Application.runInBackground; //DEVICE & OS DeviceModel = SystemInfo.deviceModel; DeviceName = SystemInfo.deviceName; DeviceType = SystemInfo.deviceType; DeviceUniqueId = PlayFabSettings.DeviceUniqueIdentifier; OperatingSystem = SystemInfo.operatingSystem; //GRAPHICS ABILITIES GraphicsDeviceId = SystemInfo.graphicsDeviceID; GraphicsDeviceName = SystemInfo.graphicsDeviceName; GraphicsMemorySize = SystemInfo.graphicsMemorySize; GraphicsShaderLevel = SystemInfo.graphicsShaderLevel; //SYSTEM INFO SystemMemorySize = SystemInfo.systemMemorySize; ProcessorCount = SystemInfo.processorCount; #if UNITY_5_3_OR_NEWER ProcessorFrequency = SystemInfo.processorFrequency; // Not Supported in PRE Unity 5_2 #endif ProcessorType = SystemInfo.processorType; SupportsAccelerometer = SystemInfo.supportsAccelerometer; SupportsGyroscope = SystemInfo.supportsGyroscope; SupportsLocationService = SystemInfo.supportsLocationService; }
// Note: If you add new platform in this function, think about adding support in IsSupportedBuildTarget() function below public static bool IsSupportedGraphicDevice(GraphicsDeviceType graphicDevice) { return(graphicDevice == GraphicsDeviceType.Direct3D11 || graphicDevice == GraphicsDeviceType.Direct3D12 || graphicDevice == GraphicsDeviceType.PlayStation4 || graphicDevice == GraphicsDeviceType.XboxOne || graphicDevice == GraphicsDeviceType.XboxOneD3D12 || graphicDevice == GraphicsDeviceType.Metal || graphicDevice == GraphicsDeviceType.Vulkan // Switch isn't supported currently (19.3) /* || graphicDevice == GraphicsDeviceType.Switch */); }
public override void Test(GraphicsDeviceType graphicsType) { Time = 0; Console.WriteLine("[{0}_{1}]", Title, graphicsType); var option = new EngineOption { IsFullScreen = false, GraphicsDevice = graphicsType, }; var result = Engine.Initialize(Title, 640, 480, option); if (!result) { throw new Exception("Altseedの初期化に失敗しました。"); } try { OnStart(); while (Engine.DoEvents()) { OnUpdating(); Engine.Update(); OnUpdated(); if (Time == ExitTime) { if (!Directory.Exists(PathOfSS)) { Directory.CreateDirectory(PathOfSS); } var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType); Engine.TakeScreenshot(path); } else if (Time == ExitTime + 2) { break; } ++Time; } OnFinish(); } finally { Engine.Terminate(); } }
public static bool IsSupportedGraphicsDeviceVersion(string deviceVersion) { GraphicsDeviceType gdt = SystemInfo.graphicsDeviceType; string[] version_split = deviceVersion.Split(' '); switch (gdt) { #if !UNITY_5_5_OR_NEWER case GraphicsDeviceType.OpenGL2: #endif case GraphicsDeviceType.OpenGLCore: if (version_split.Count() > 1) { #if UNITY_EDITOR // TODO Add a check to the recommmend project window around emulated graphics if (deviceVersion.ToLower().Contains("emulate") || version_split[1].ToLower().Contains("emulate")) { Debug.LogWarning("Unity Editor Graphics Device Emulation is not fully supported, consider disabling it"); return(true); } #endif string[] driver_version_split = version_split[1].Split('.'); int major = 0; int minor = 0; int.TryParse(driver_version_split[0], out major); int.TryParse(driver_version_split[1], out minor); if (major >= DRIVER_OpenGL_MIN_VERSION_MAJOR && minor >= DRIVER_OpenGL_MIN_VERSION_MINOR) { return(true); } else { return(false); } } // Assume that it's fine in the case we can't check the version number // TODO: Don't assume anything- Tom return(true); default: return(true); } }
private static Exception TestOnTheDevice(Type testType, GraphicsDeviceType device) { try { var target = (TestFramework)Activator.CreateInstance(testType); target.Test(device); return(null); } catch (Exception e) { return(e); } }
public override int GetHashCode() { int hash = 1; if (ClientVersion.Length != 0) { hash ^= ClientVersion.GetHashCode(); } if (DeviceType.Length != 0) { hash ^= DeviceType.GetHashCode(); } if (FirstTime != false) { hash ^= FirstTime.GetHashCode(); } if (LoadToTosLoginTime != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LoadToTosLoginTime); } if (LoadToMapTime != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LoadToMapTime); } if (DeviceOs.Length != 0) { hash ^= DeviceOs.GetHashCode(); } if (GraphicsDeviceVendor.Length != 0) { hash ^= GraphicsDeviceVendor.GetHashCode(); } if (GraphicsDeviceName.Length != 0) { hash ^= GraphicsDeviceName.GetHashCode(); } if (GraphicsDeviceType.Length != 0) { hash ^= GraphicsDeviceType.GetHashCode(); } if (GraphicsShaderLevel != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(GraphicsShaderLevel); } hash ^= subsystemLoadTimes_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static bool AreGraphicsAPIsSupported(UnityEditor.BuildTarget target, out GraphicsDeviceType unsupportedGraphicDevice) { unsupportedGraphicDevice = GraphicsDeviceType.Null; foreach (var graphicAPI in UnityEditor.PlayerSettings.GetGraphicsAPIs(target)) { if (!HDUtils.IsSupportedGraphicDevice(graphicAPI)) { unsupportedGraphicDevice = graphicAPI; return(false); } } return(true); }
private void InitializeViewports() { m_initializedGraphicsDeviceType = SystemInfo.graphicsDeviceType; m_frameBuffer = new HVRFrameBufferInterface(); m_viewports = new HVRViewportInterface [MAXIMUM_VIEWPORTS]; m_viewportIndex = 0; for (int i = 0; i < MAXIMUM_VIEWPORTS; ++i) { HVRViewportInterface viewport = new HVRViewportInterface(); viewport.SetFrameBuffer(m_frameBuffer); m_viewports[i] = viewport; } }
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); }
static int GetGraphicsApiIndex(BuildTarget target, GraphicsDeviceType api) { int result = -1; GraphicsDeviceType[] devices = UnityEditor.PlayerSettings.GetGraphicsAPIs(target); for (int i = 0; i < devices.Length; i++) { if (devices[i] == api) { result = i; break; } } return(result); }
private static void InitializeBuild(string identifier) { PlayerSettings.stereoRenderingPath = StereoRenderingPath.SinglePass; GraphicsDeviceType[] graphicsApis = new GraphicsDeviceType[1]; graphicsApis[0] = GraphicsDeviceType.OpenGLES3; PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, graphicsApis); PlayerSettings.colorSpace = ColorSpace.Linear; //Set ARM64 Requirements PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP); PlayerSettings.SetArchitecture(BuildTargetGroup.Android, 1); //0 - None, 1 - ARM64, 2 - Universal PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64; EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle; QualitySettings.antiAliasing = 4; PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, identifier); }
public override void Test(GraphicsDeviceType graphicsType) { Time = 0; Console.WriteLine("[{0}_{1}]", Title, graphicsType); var option = new EngineOption { IsFullScreen = false, GraphicsDevice = graphicsType, }; var result = Engine.Initialize(Title, 640, 480, option); if (!result) { throw new Exception("ACEの初期化に失敗しました。"); } OnStart(); while (Engine.DoEvents()) { OnUpdating(); Engine.Update(); OnUpdated(); if (Time == ExitTime) { if (!Directory.Exists(PathOfSS)) { Directory.CreateDirectory(PathOfSS); } var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType); Engine.TakeScreenshot(path); } else if (Time == ExitTime + 2) { break; } ++Time; } OnFinish(); Engine.Terminate(); }
public void GatherData() { #if UNITY_5 // UNITY_5 Application info ProductName = Application.productName; ProductBundle = Application.bundleIdentifier; //Only Used on iOS & Android Version = Application.version; Company = Application.companyName; Platform = Application.platform; // UNITY_5 Graphics Abilities GraphicsMultiThreaded = SystemInfo.graphicsMultiThreaded; #endif #if UNITY_5 && !UNITY_5_0 GraphicsType = SystemInfo.graphicsDeviceType; #endif // Application info DataPath = Application.dataPath; PersistentDataPath = Application.persistentDataPath; StreamingAssetsPath = Application.streamingAssetsPath; TargetFrameRate = Application.targetFrameRate; UnityVersion = Application.unityVersion; RunInBackground = Application.runInBackground; //DEVICE & OS DeviceModel = SystemInfo.deviceModel; DeviceName = SystemInfo.deviceName; DeviceType = SystemInfo.deviceType; DeviceUniqueId = PlayFabSettings.DeviceUniqueIdentifier; OperatingSystem = SystemInfo.operatingSystem; //GRAPHICS ABILITIES GraphicsDeviceId = SystemInfo.graphicsDeviceID; GraphicsDeviceName = SystemInfo.graphicsDeviceName; GraphicsMemorySize = SystemInfo.graphicsMemorySize; GraphicsShaderLevel = SystemInfo.graphicsShaderLevel; //SYSTEM INFO SystemMemorySize = SystemInfo.systemMemorySize; ProcessorCount = SystemInfo.processorCount; //ProcessorFrequency = SystemInfo.processorFrequency; //Not Supported in PRE Unity 5_2 ProcessorType = SystemInfo.processorType; SupportsAccelerometer = SystemInfo.supportsAccelerometer; SupportsGyroscope = SystemInfo.supportsGyroscope; SupportsLocationService = SystemInfo.supportsLocationService; }
public void OnPreprocessBuild(BuildReport report) { // Detect if the users forget to assign an HDRP Asset if (GraphicsSettings.renderPipelineAsset == null) { if (!Application.isBatchMode) { if (!EditorUtility.DisplayDialog("Build Player", "There is no HDRP Asset provided in GraphicsSettings.\nAre you sure you want to continue ?\n Build time can be extremely long without it.", "Ok", "Cancel")) { throw new BuildFailedException("Stop build on request."); } } else { Debug.LogWarning("There is no HDRP Asset provided in GraphicsSettings. Build time can be extremely long without it."); } return; } // Don't execute the preprocess if we are not HDRenderPipeline HDRenderPipelineAsset hdPipelineAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset; if (hdPipelineAsset == null) { return; } // If platform is supported all good GraphicsDeviceType unsupportedGraphicDevice = GraphicsDeviceType.Null; if (HDUtils.IsSupportedBuildTarget(report.summary.platform) && HDUtils.IsOperatingSystemSupported(SystemInfo.operatingSystem) && HDUtils.AreGraphicsAPIsSupported(report.summary.platform, out unsupportedGraphicDevice)) { return; } unsupportedGraphicDevice = (unsupportedGraphicDevice == GraphicsDeviceType.Null) ? SystemInfo.graphicsDeviceType : unsupportedGraphicDevice; string msg = "The platform " + report.summary.platform.ToString() + " with the graphic API " + unsupportedGraphicDevice + " is not supported with High Definition Render Pipeline"; // Throw an exception to stop the build throw new BuildFailedException(msg); }
public static int ScenePlayerHandle() { int handle = HVR.Interface.Types.INVALID_HANDLE; UnityInterfaceAPI.Lock(); // Check if a ScenePlayer already exists, use it instead of creating a new one if (UnityInterfaceAPI.Map_Contains(Uniforms.Keys.SCENEPLAYER_NAME) && UnityInterfaceAPI.Map_GetValue(Uniforms.Keys.SCENEPLAYER_NAME) != HVR.Interface.Types.INVALID_HANDLE) { handle = UnityInterfaceAPI.Map_GetValue(Uniforms.Keys.SCENEPLAYER_NAME); if (UnityInterfaceAPI.Map_Contains(Uniforms.Keys.SCENEPLAYER_GRAPHICS_DEVICE_TYPE)) { // Check if the graphics context has changed and recreate the player if it has GraphicsDeviceType deviceType = (GraphicsDeviceType)UnityInterfaceAPI.Map_GetValue(Uniforms.Keys.SCENEPLAYER_GRAPHICS_DEVICE_TYPE); if (deviceType != SystemInfo.graphicsDeviceType) { DeleteScenePlayer(); handle = HVR.Interface.Types.INVALID_HANDLE; } } } // Create a new player if the handle is null, or the player is invalid if (handle == HVR.Interface.Types.INVALID_HANDLE || !HvrPlayerInterfaceAPI.Player_IsValid(handle)) { if (HvrHelper.Support.IsApplicationStateSupported()) { PlayerInterface player = new PlayerInterface(); // In order to get around Unity clearing memory between state changes such // as reloading code or changing the graphics API within the editor, we store // a reference in the memory of a native plugin which we control the state of UnityInterfaceAPI.Map_Add(Uniforms.Keys.SCENEPLAYER_NAME, player.handle); UnityInterfaceAPI.Map_Add(Uniforms.Keys.SCENEPLAYER_GRAPHICS_DEVICE_TYPE, (int)player.graphicsDeviceType); } } UnityInterfaceAPI.Unlock(); return(handle); }
public static GraphicsFormat GetSupportedGraphicsFormat(GraphicsDeviceType type) { if (QualitySettings.activeColorSpace == ColorSpace.Linear) { switch (type) { case GraphicsDeviceType.Direct3D11: case GraphicsDeviceType.Direct3D12: return(GraphicsFormat.B8G8R8A8_SRGB); case GraphicsDeviceType.Vulkan: return(GraphicsFormat.R8G8B8A8_SRGB); case GraphicsDeviceType.OpenGLCore: case GraphicsDeviceType.OpenGLES2: case GraphicsDeviceType.OpenGLES3: return(GraphicsFormat.R8G8B8A8_SRGB); case GraphicsDeviceType.Metal: return(GraphicsFormat.B8G8R8A8_SRGB); } } else { switch (type) { case GraphicsDeviceType.Direct3D11: case GraphicsDeviceType.Direct3D12: return(GraphicsFormat.B8G8R8A8_UNorm); case GraphicsDeviceType.Vulkan: return(GraphicsFormat.R8G8B8A8_UNorm); case GraphicsDeviceType.OpenGLCore: case GraphicsDeviceType.OpenGLES2: case GraphicsDeviceType.OpenGLES3: return(GraphicsFormat.R8G8B8A8_UNorm); case GraphicsDeviceType.Metal: return(GraphicsFormat.B8G8R8A8_UNorm); } } throw new ArgumentException($"Graphics device type {type} not supported"); }
private void setGraphicsDeviceType(GraphicsDeviceType api) { if (javaRecorder != null) { if (GraphicsDeviceType.OpenGLES2.Equals(api)) { javaRecorder.Call("setGraphicsDeviceType", 2); } else if (GraphicsDeviceType.OpenGLES3.Equals(api)) { javaRecorder.Call("setGraphicsDeviceType", 3); } else { javaRecorder.Call("setGraphicsDeviceType", -1); } } }
public static void SetGraphicsAPI() { GraphicsDeviceType[] graphics = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android); List <GraphicsDeviceType> listgraphic = graphics.ToList(); if (listgraphic.Contains(GraphicsDeviceType.OpenGLES3)) { int index = listgraphic.IndexOf(GraphicsDeviceType.OpenGLES3); GraphicsDeviceType temp = listgraphic[0]; listgraphic[0] = GraphicsDeviceType.OpenGLES3; listgraphic[index] = temp; } else { listgraphic.Insert(0, GraphicsDeviceType.OpenGLES3); } PlayerSettings.SetGraphicsAPIs(BuildTarget.Android, listgraphic.ToArray()); }
public override bool IsValid() { if (HvrHelper.Support.IsSupportedBuildTarget(EditorUserBuildSettings.activeBuildTarget)) { GraphicsDeviceType[] graphicsDeviceTypes = PlayerSettings.GetGraphicsAPIs(EditorUserBuildSettings.activeBuildTarget); if (graphicsDeviceTypes.Length != 0) { GraphicsDeviceType firstGraphicsDeviceType = graphicsDeviceTypes[0]; return(HvrHelper.Support.IsBuildTargetGraphicsDeviceTypeSupported(EditorUserBuildSettings.activeBuildTarget, firstGraphicsDeviceType)); } else { return(true); } } return(true); }
public HVRViewportInterface FlipViewport() { HVRViewportInterface viewport = m_viewports[m_viewportIndex]; if (viewport == null || !viewport.IsValid() || m_initializedGraphicsDeviceType != SystemInfo.graphicsDeviceType) { m_initializedGraphicsDeviceType = SystemInfo.graphicsDeviceType; m_viewports = new HVRViewportInterface [MAXIMUM_VIEWPORTS]; m_viewportIndex = 0; for (int i = 0; i < MAXIMUM_VIEWPORTS; ++i) { m_viewports[i] = new HVRViewportInterface(); } viewport = m_viewports[m_viewportIndex]; } m_viewportIndex = (m_viewportIndex + 1) % MAXIMUM_VIEWPORTS; return(viewport); }
public static string PrintSystemInfo() { string deviceName = SystemInfo.deviceName; string deviceModel = SystemInfo.deviceModel; DeviceType deviceType = SystemInfo.deviceType; string id = SystemInfo.deviceUniqueIdentifier; string os = SystemInfo.operatingSystem; OperatingSystemFamily osFamily = SystemInfo.operatingSystemFamily; string ram = (SystemInfo.systemMemorySize / 1024f) + " GiB"; string cpuName = SystemInfo.processorType; int cpuCount = SystemInfo.processorCount; int cpuFrequency = SystemInfo.processorFrequency; GraphicsDeviceType gpuType = SystemInfo.graphicsDeviceType; string gpuName = SystemInfo.graphicsDeviceName; string gpuVendor = SystemInfo.graphicsDeviceVendor; string gpuRam = (SystemInfo.graphicsMemorySize / 1024f) + " GiB"; int padding = 23; StringBuilder text = new StringBuilder(); text.AppendLine("<b>Device</b>"); text.AppendLine("\t<b>OS</b>".PadRight(padding) + os + "(" + osFamily + ")"); text.AppendLine("\t<b>RAM</b>".PadRight(padding) + ram); text.AppendLine("\t<b>Name</b>".PadRight(padding) + deviceName); text.AppendLine("\t<b>Model</b>".PadRight(padding) + deviceModel); text.AppendLine("\t<b>Type</b>".PadRight(padding) + deviceType); text.AppendLine("\t<b>Unique ID</b>".PadRight(padding) + id); text.AppendLine("<b>CPU</b>"); text.AppendLine("\t<b>Name</b>".PadRight(padding) + cpuName); text.AppendLine("\t<b>Processors</b>".PadRight(padding) + cpuCount); text.AppendLine("\t<b>Frequency</b>".PadRight(padding) + cpuFrequency); text.AppendLine("<b>GPU</b>"); text.AppendLine("\t<b>Name</b>".PadRight(padding) + gpuName); text.AppendLine("\t<b>Type</b>".PadRight(padding) + gpuType); text.AppendLine("\t<b>Vendor</b>".PadRight(padding) + gpuVendor); text.AppendLine("\t<b>Memory</b>".PadRight(padding) + gpuRam); return(text.ToString()); }
static SceneViewUpdater() { previousGraphicsDeviceType = SystemInfo.graphicsDeviceType; EditorApplication.update -= Update; EditorApplication.update += Update; #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged -= CheckPlayModeState; EditorApplication.playModeStateChanged += CheckPlayModeState; #else EditorApplication.playmodeStateChanged -= CheckPlayModeState; EditorApplication.playmodeStateChanged += CheckPlayModeState; #endif // Always destroy scene cameras between scene loads while in the editor // This ensures that there are no references to HvrActors being stored between scenes EditorCallbacks.onLoadScene -= DestroySceneCameras; EditorCallbacks.onLoadScene += DestroySceneCameras; }
public void SetupPlayerSettings() { GraphicsDeviceType[] deviceTypes = PlayerSettings.GetGraphicsAPIs(BuildTarget.StandaloneOSX); var oldGfxType = m_PlayerSettingsDeviceType; // If the type we want to check isn't the supported graphics type, then substitute it out // so we can still pass the tests. Semantics are the same regardless of actual devices. if (SystemInfo.graphicsDeviceType != m_PlayerSettingsDeviceType) { m_PlayerSettingsDeviceType = SystemInfo.graphicsDeviceType; for (int i = 0; i < m_LoadersSupporteDeviceTypes.Length; i++) { if (oldGfxType == m_LoadersSupporteDeviceTypes[i]) { m_LoadersSupporteDeviceTypes[i] = m_PlayerSettingsDeviceType; } } } #if UNITY_EDITOR_WIN PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneWindows64, new[] { m_PlayerSettingsDeviceType }); #elif UNITY_EDITOR_OSX PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneOSX, new[] { m_PlayerSettingsDeviceType }); #endif m_Manager = ScriptableObject.CreateInstance <XRManagerSettings>(); m_Manager.automaticLoading = false; m_Loaders = new List <XRLoader>(); for (int i = 0; i < m_LoadersSupporteDeviceTypes.Length; i++) { DummyLoader dl = ScriptableObject.CreateInstance(typeof(DummyLoader)) as DummyLoader; dl.id = i; dl.supportedDeviceType = m_LoadersSupporteDeviceTypes[i]; dl.shouldFail = (i != m_LoaderIndexToWin); m_Loaders.Add(dl); m_Manager.loaders.Add(dl); } }
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); }
public static GraphicsFormat GetSupportedGraphicsFormat(GraphicsDeviceType type) { switch (type) { case UnityEngine.Rendering.GraphicsDeviceType.Direct3D11: case UnityEngine.Rendering.GraphicsDeviceType.Direct3D12: return(GraphicsFormat.B8G8R8A8_SRGB); case UnityEngine.Rendering.GraphicsDeviceType.Vulkan: return(GraphicsFormat.R8G8B8A8_SRGB); case UnityEngine.Rendering.GraphicsDeviceType.OpenGLCore: case UnityEngine.Rendering.GraphicsDeviceType.OpenGLES2: case UnityEngine.Rendering.GraphicsDeviceType.OpenGLES3: return(GraphicsFormat.R8G8B8A8_SRGB); case UnityEngine.Rendering.GraphicsDeviceType.Metal: return(GraphicsFormat.B8G8R8A8_SRGB); } throw new ArgumentException("Graphics device type not supported"); }
public static Dictionary <string, string> CollectReferenceImagePathsFor(ColorSpace colorSpace, RuntimePlatform runtimePlatform, GraphicsDeviceType graphicsApi) { var result = new Dictionary <string, string>(); if (!Directory.Exists(ReferenceImagesRoot)) { return(result); } var fullPathPrefix = string.Format("{0}/{1}/{2}/{3}/", ReferenceImagesRoot, colorSpace, runtimePlatform, graphicsApi); foreach (var assetPath in AssetDatabase.GetAllAssetPaths() .Where(p => p.StartsWith(ReferenceImagesRoot, StringComparison.OrdinalIgnoreCase)) .Where(p => fullPathPrefix.StartsWith(Path.GetDirectoryName(p))) .OrderBy(p => p.Count(ch => ch == '/'))) { // Skip directories if (!File.Exists(assetPath)) { continue; } var fileName = Path.GetFileNameWithoutExtension(assetPath); if (fileName == null) { continue; } var texture = AssetDatabase.LoadAssetAtPath <Texture2D>(assetPath); if (!texture) { continue; } result[fileName] = assetPath; } return(result); }
private bool InitializeCubemapFaceMatrices() { GraphicsDeviceType graphicsDeviceType = SystemInfo.get_graphicsDeviceType(); if (graphicsDeviceType != 2) { switch (graphicsDeviceType - 16) { case 0: this.platformCubemapFaceMatrices = ReflectionProbeEx.cubemapFaceMatricesD3D11; break; case 1: this.platformCubemapFaceMatrices = ReflectionProbeEx.cubemapFaceMatrices; break; case 2: this.platformCubemapFaceMatrices = ReflectionProbeEx.cubemapFaceMatricesD3D11; break; case 5: this.platformCubemapFaceMatrices = ReflectionProbeEx.cubemapFaceMatricesD3D11; break; default: this.platformCubemapFaceMatrices = (ReflectionProbeEx.CubemapFaceMatrices[])null; break; } } else { this.platformCubemapFaceMatrices = ReflectionProbeEx.cubemapFaceMatricesD3D11; } if (this.platformCubemapFaceMatrices != null) { return(true); } Debug.LogError((object)("[ReflectionProbeEx] Initialization failed. No cubemap ortho basis defined for " + (object)SystemInfo.get_graphicsDeviceType())); return(false); }
public static void PrintSystemInfo() { string deviceName = SystemInfo.deviceName; string deviceModel = SystemInfo.deviceModel; DeviceType deviceType = SystemInfo.deviceType; string id = SystemInfo.deviceUniqueIdentifier; string os = SystemInfo.operatingSystem; OperatingSystemFamily osFamily = SystemInfo.operatingSystemFamily; string ram = (SystemInfo.systemMemorySize / 1000f) + " gb"; string cpuName = SystemInfo.processorType; int cpuCount = SystemInfo.processorCount; int cpuFrequency = SystemInfo.processorFrequency; GraphicsDeviceType gpuType = SystemInfo.graphicsDeviceType; string gpuName = SystemInfo.graphicsDeviceName; string gpuVendor = SystemInfo.graphicsDeviceVendor; string gpuRam = (SystemInfo.graphicsMemorySize / 1000f) + " gb"; int padding = 23; Console.Print("<b>Device</b>"); Console.Print("\t<b>OS</b>".PadRight(padding) + os + "(" + osFamily + ")"); Console.Print("\t<b>RAM</b>".PadRight(padding) + ram); Console.Print("\t<b>Name</b>".PadRight(padding) + deviceName); Console.Print("\t<b>Model</b>".PadRight(padding) + deviceModel); Console.Print("\t<b>Type</b>".PadRight(padding) + deviceType); Console.Print("\t<b>Unique ID</b>".PadRight(padding) + id); Console.Print("<b>CPU</b>"); Console.Print("\t<b>Name</b>".PadRight(padding) + cpuName); Console.Print("\t<b>Processors</b>".PadRight(padding) + cpuCount); Console.Print("\t<b>Frequency</b>".PadRight(padding) + SystemInfo.processorFrequency); Console.Print("<b>GPU</b>"); Console.Print("\t<b>Name</b>".PadRight(padding) + gpuName); Console.Print("\t<b>Vendor</b>".PadRight(padding) + gpuVendor); Console.Print("\t<b>Memory</b>".PadRight(padding) + gpuRam); }
public override void Test(GraphicsDeviceType graphicsType) { var option = new EngineOption() { GraphicsDevice = graphicsType }; Engine.Initialize("DisposeOnTerminate", 640, 480, option); var scene = new TestScene(); Engine.ChangeScene(scene); while (Engine.DoEvents()) { Engine.Update(); } Engine.Terminate(); Assert.AreEqual(true, scene.AlreadyDisposed); }
public static GraphicsDeviceType[] GetSupportedGraphicsDeviceTypes_FromRuntimePlatform(RuntimePlatform platform) { GraphicsDeviceType[] types = new GraphicsDeviceType[] { }; switch (platform) { case RuntimePlatform.Android: types = SupportedGraphicsDeviceTypes_android; break; case RuntimePlatform.IPhonePlayer: types = SupportedGraphicsDeviceTypes_ios; break; case RuntimePlatform.WindowsEditor: case RuntimePlatform.WindowsPlayer: types = SupportedGraphicsDeviceTypes_Windows; break; case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: types = SupportedGraphicsDeviceTypes_macOS; break; #if UNITY_EDITOR_LINUX case RuntimePlatform.LinuxEditor: #endif case RuntimePlatform.LinuxPlayer: types = SupportedGraphicsDeviceTypes_linux; break; default: Debug.LogError("Unsupported runtime platform"); break; } return(types); }
private void CheckGraphicsSettings() { GraphicsDeviceType device = SystemInfo.graphicsDeviceType; if (m_CurrentGraphicsAPI != device) { m_CurrentGraphicsAPI = device; if (m_ProcessingNodeStack != null) { m_ProcessingNodeStack.InvalidateAll(); } Repaint(); } ColorSpace colorSpace = QualitySettings.activeColorSpace; if (m_CurrentColorSpace != colorSpace) { m_CurrentColorSpace = colorSpace; if (m_ProcessingNodeStack != null) { m_ProcessingNodeStack.InvalidateAll(); } } }
public static extern void SetGraphicsAPIs(BuildTarget platform, GraphicsDeviceType[] apis);
// protected static void Initialize() { if (initialized) { return; } // Determine graphics device type device = SystemInfo.graphicsDeviceType; // Initialize shader property constants ShaderPropertyID.Initialize(); // Initialize shaders and materials int l = shaderPaths.Length; shaders = new Shader[l]; materials = new Material[l]; for (int i = 0; i < l; i++) { Shader shader = Shader.Find(shaderPaths[i]); shaders[i] = shader; Material material = new Material(shader); materials[i] = material; } // Initialize static RenderTargetIdentifier(s) cameraTargetID = new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget); // Create static quad mesh CreateQuad(); initialized = true; }
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 Debug.LogWarning("EasyAR has not been tested with current Unity version, please consider upgrade your Unity."); #endif #if UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS string title = "Incompatible graphics API detected!"; string message = "Please set graphics API to \"OpenGL ES 2.0\" and rebuild, or EasyAR may not work as expected (e.g. white screen)."; #if UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 // we have tested in Unity 4.6.5+, if API is incompatible with your Unity version, change the below code #if UNITY_IPHONE if (target == BuildTarget.iPhone && PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_2_0){ EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } #endif #if UNITY_ANDROID if (target == BuildTarget.Android && PlayerSettings.targetGlesGraphics != TargetGlesGraphics.OpenGLES_2_0) { EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } #endif #elif UNITY_5_0 #if UNITY_IPHONE if (target == BuildTarget.iOS && PlayerSettings.targetIOSGraphics != TargetIOSGraphics.OpenGLES_2_0) { EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } #endif #if UNITY_ANDROID if (target == BuildTarget.Android && PlayerSettings.targetGlesGraphics != TargetGlesGraphics.OpenGLES_2_0) { EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } #endif #else // suppose it should be unty 5.1+ // we have tested in Unity 5.2.2, if API is incompatible with your Unity version, change the below code if (target != BuildTarget.Android && target != BuildTarget.iOS) return; if (PlayerSettings.GetUseDefaultGraphicsAPIs(target)) { var apis = new GraphicsDeviceType[1]; apis[0] = GraphicsDeviceType.OpenGLES2; PlayerSettings.SetGraphicsAPIs(target, apis); message = "Please uncheck \"Auto Graphics API\" (if not done by EasyAR) and rebuild, or EasyAR may not work as expected (e.g. white screen)."; EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } else { var curapi = PlayerSettings.GetGraphicsAPIs(target); if (curapi.Length > 1 || !curapi.Contains(GraphicsDeviceType.OpenGLES2)) { var apis = new GraphicsDeviceType[1]; apis[0] = GraphicsDeviceType.OpenGLES2; PlayerSettings.SetGraphicsAPIs(target, apis); message = "Graphics API has been set to \"OpenGL ES 2.0\" by EasyAR. Please build again, or EasyAR may not work as expected (e.g. white screen)."; EditorUtility.DisplayDialog(title, message, "OK"); Debug.LogError(title + " " + message); } } #endif #endif }