public TargetCpus(TargetCpu single) { Cpus = new List <TargetCpu>(1) { single }; }
private static TargetPlatform?TryGetTargetPlatform(BuildTarget target, out TargetCpu targetCpu) { // TODO: Add support for multi-CPU switch targetCpu = TargetCpu.Auto; switch (target) { case BuildTarget.StandaloneWindows: targetCpu = TargetCpu.X86_SSE4; return(TargetPlatform.Windows); case BuildTarget.StandaloneWindows64: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.Windows); case BuildTarget.StandaloneOSX: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.macOS); #if !UNITY_2019_2_OR_NEWER //32 bit linux support was deprecated case BuildTarget.StandaloneLinux: targetCpu = TargetCpu.X86_SSE4; return(TargetPlatform.Linux); #endif case BuildTarget.StandaloneLinux64: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.Linux); case BuildTarget.WSAPlayer: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.UWP); case BuildTarget.XboxOne: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.XboxOne); case BuildTarget.PS4: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.PS4); case BuildTarget.Android: targetCpu = TargetCpu.ARMV7A_NEON32; return(TargetPlatform.Android); case BuildTarget.iOS: targetCpu = TargetCpu.ARMV7A_NEON32; return(TargetPlatform.iOS); case BuildTarget.Lumin: targetCpu = TargetCpu.ARMV8A_AARCH64; return(TargetPlatform.Lumin); } return(null); }
private static BurstDisassembler.AsmKind FetchAsmKind(TargetCpu cpu) { switch (cpu) { case TargetCpu.ARMV7A_NEON32: case TargetCpu.ARMV8A_AARCH64: case TargetCpu.ARMV8A_AARCH64_HALFFP: case TargetCpu.THUMB2_NEON32: return(BurstDisassembler.AsmKind.ARM); case TargetCpu.WASM32: return(BurstDisassembler.AsmKind.Wasm); } return(BurstDisassembler.AsmKind.Intel); }
public static TargetPlatform?TryGetTargetPlatform(BuildTarget target, out TargetCpu targetCpu) { // TODO: Add support for multi-CPU switch targetCpu = TargetCpu.Auto; switch (target) { case BuildTarget.StandaloneWindows: targetCpu = TargetCpu.X86_SSE4; return(TargetPlatform.Windows); case BuildTarget.StandaloneWindows64: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.Windows); case BuildTarget.StandaloneOSX: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.macOS); case BuildTarget.StandaloneLinux: targetCpu = TargetCpu.X86_SSE4; return(TargetPlatform.Linux); case BuildTarget.StandaloneLinux64: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.Linux); case BuildTarget.WSAPlayer: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.UWP); case BuildTarget.XboxOne: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.XboxOne); case BuildTarget.PS4: targetCpu = TargetCpu.X64_SSE4; return(TargetPlatform.PS4); case BuildTarget.Android: targetCpu = TargetCpu.ARMV7A_NEON32; return(TargetPlatform.Android); case BuildTarget.iOS: targetCpu = TargetCpu.ARMV7A_NEON32; return(TargetPlatform.iOS); } return(null); }
private static bool IsIntel(TargetCpu cpu) { switch (cpu) { case TargetCpu.Auto: case TargetCpu.X86_SSE2: case TargetCpu.X86_SSE4: case TargetCpu.X64_SSE2: case TargetCpu.X64_SSE4: case TargetCpu.AVX: case TargetCpu.AVX2: case TargetCpu.AVX512: return(true); } return(false); }
static Architecture CpuToArchitecture(TargetCpu cpu) { switch (cpu) { case TargetCpu.i286: return(Architecture.I286); case TargetCpu.i386: case TargetCpu.i486: case TargetCpu.Pentium: return(Architecture.I386); case TargetCpu.i860: case TargetCpu.N11: return(Architecture.I860); case TargetCpu.MIPS1: case TargetCpu.MIPS2: return(Architecture.Mips); case TargetCpu.MIPS3: return(Architecture.Mips3); default: return(Architecture.Unknown); } }
private void RenderButtonBars(float width, BurstCompileTarget target, out bool doCopy, out int fontIndex) { float remainingWidth = width; var contentDisasm = new GUIContent("Enhanced Disassembly"); var contentSafety = new GUIContent("Safety Checks"); var contentCodeGenOptions = new GUIContent("Auto"); var contentLabelFontSize = new GUIContent("Font Size"); var contentFontSize = new GUIContent("99"); var contentCopyToClip = new GUIContent("Copy to Clipboard"); GUILayout.BeginHorizontal(); _assemblyKind = EditorGUILayout.Popup(_assemblyKind, AssemblyOptions, EditorStyles.popup); FlowToNewLine(ref remainingWidth, width, EditorStyles.popup, contentDisasm); _safetyChecks = GUILayout.Toggle(_safetyChecks, contentSafety, EditorStyles.toggle); FlowToNewLine(ref remainingWidth, width, EditorStyles.toggle, contentSafety); EditorGUI.BeginDisabledGroup(!target.HasRequiredBurstCompileAttributes); _targetCpu = (TargetCpu)EditorGUILayout.Popup((int)_targetCpu, TargetCpuNames, EditorStyles.popup); FlowToNewLine(ref remainingWidth, width, EditorStyles.popup, contentCodeGenOptions); GUILayout.Label("Font Size", EditorStyles.label); fontIndex = EditorGUILayout.Popup(_fontSizeIndex, _fontSizesText, EditorStyles.popup); FlowToNewLine(ref remainingWidth, width, EditorStyles.label, contentLabelFontSize); FlowToNewLine(ref remainingWidth, width, EditorStyles.popup, contentFontSize); doCopy = GUILayout.Button(contentCopyToClip, EditorStyles.miniButton); FlowToNewLine(ref remainingWidth, width, EditorStyles.miniButton, contentCopyToClip); EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); _disasmKind = (DisassemblyKind)GUILayout.Toolbar((int)_disasmKind, DisassemblyKindNames, GUILayout.ExpandWidth(true), GUILayout.MinWidth(5 * 10)); }
public BurstOutputCombination(string outputPath, TargetCpu targetCpu, string libraryName = DefaultLibraryName) { TargetCpu = targetCpu; OutputPath = outputPath; LibraryName = libraryName; }
private static TargetPlatform GetTargetPlatformAndDefaultCpu(BuildTarget target, out TargetCpu targetCpu) { var platform = TryGetTargetPlatform(target, out targetCpu); if (!platform.HasValue) { throw new NotSupportedException("The target platform " + target + " is not supported by the burst compiler"); } return(platform.Value); }
/// <summary> /// Collect CPU combinations for the specified TargetPlatform and TargetCPU /// </summary> /// <param name="targetPlatform">The target platform (e.g Windows)</param> /// <param name="targetCpu">The target CPU (e.g X64_SSE4)</param> /// <param name="report">Error reporting</param> /// <returns>The list of CPU combinations</returns> private static List <BurstOutputCombination> CollectCombinations(TargetPlatform targetPlatform, TargetCpu targetCpu, BuildReport report) { var combinations = new List <BurstOutputCombination>(); if (targetPlatform == TargetPlatform.macOS) { // NOTE: OSX has a special folder for the plugin // Declared in GetStagingAreaPluginsFolder // PlatformDependent\OSXPlayer\Extensions\Managed\OSXDesktopStandalonePostProcessor.cs #if UNITY_2019_3_OR_NEWER combinations.Add(new BurstOutputCombination(Path.Combine(Path.GetFileName(report.summary.outputPath), "Contents", "Plugins"), targetCpu)); #else combinations.Add(new BurstOutputCombination("UnityPlayer.app/Contents/Plugins", targetCpu)); #endif } else if (targetPlatform == TargetPlatform.iOS) { if (Application.platform != RuntimePlatform.OSXEditor) { Debug.LogWarning("Burst Cross Compilation to iOS for standalone player, is only supported on OSX Editor at this time, burst is disabled for this build."); } else { var targetArchitecture = (IOSArchitecture)UnityEditor.PlayerSettings.GetArchitecture(report.summary.platformGroup); if (targetArchitecture == IOSArchitecture.ARMv7 || targetArchitecture == IOSArchitecture.Universal) { // PlatformDependent\iPhonePlayer\Extensions\Common\BuildPostProcessor.cs combinations.Add(new BurstOutputCombination("StaticLibraries", TargetCpu.ARMV7A_NEON32, DefaultLibraryName + "32")); } if (targetArchitecture == IOSArchitecture.ARM64 || targetArchitecture == IOSArchitecture.Universal) { // PlatformDependent\iPhonePlayer\Extensions\Common\BuildPostProcessor.cs combinations.Add(new BurstOutputCombination("StaticLibraries", TargetCpu.ARMV8A_AARCH64, DefaultLibraryName + "64")); } } } else if (targetPlatform == TargetPlatform.Android) { // TODO: would be better to query AndroidNdkRoot (but thats not exposed from unity) string ndkRoot = null; var targetAPILevel = PlayerSettings.Android.GetMinTargetAPILevel(); #if UNITY_2019_3_OR_NEWER && UNITY_ANDROID ndkRoot = UnityEditor.Android.AndroidExternalToolsSettings.ndkRootPath; #elif UNITY_2019_1_OR_NEWER // 2019.1 now has an embedded ndk if (EditorPrefs.HasKey("NdkUseEmbedded")) { if (EditorPrefs.GetBool("NdkUseEmbedded")) { ndkRoot = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None), "NDK"); } else { ndkRoot = EditorPrefs.GetString("AndroidNdkRootR16b"); } } #endif // If we still don't have a valid root, try the old key if (string.IsNullOrEmpty(ndkRoot)) { ndkRoot = EditorPrefs.GetString("AndroidNdkRoot"); } // Verify the directory at least exists, if not we fall back to ANDROID_NDK_ROOT current setting if (!string.IsNullOrEmpty(ndkRoot) && !Directory.Exists(ndkRoot)) { ndkRoot = null; } // Always set the ANDROID_NDK_ROOT (if we got a valid result from above), so BCL knows where to find the Android toolchain and its the one the user expects if (!string.IsNullOrEmpty(ndkRoot)) { Environment.SetEnvironmentVariable("ANDROID_NDK_ROOT", ndkRoot); } Environment.SetEnvironmentVariable("BURST_ANDROID_MIN_API_LEVEL", $"{targetAPILevel}"); var androidTargetArch = UnityEditor.PlayerSettings.Android.targetArchitectures; if ((androidTargetArch & AndroidArchitecture.ARMv7) != 0) { combinations.Add(new BurstOutputCombination("libs/armeabi-v7a", TargetCpu.ARMV7A_NEON32)); } if ((androidTargetArch & AndroidArchitecture.ARM64) != 0) { combinations.Add(new BurstOutputCombination("libs/arm64-v8a", TargetCpu.ARMV8A_AARCH64)); } #if !UNITY_2019_2_OR_NEWER if ((androidTargetArch & AndroidArchitecture.X86) != 0) { combinations.Add(new BurstOutputCombination("libs/x86", TargetCpu.X86_SSE2)); } #endif } else if (targetPlatform == TargetPlatform.UWP) { // TODO: Make it configurable for x86 (sse2, sse4) combinations.Add(new BurstOutputCombination("Plugins/x64", TargetCpu.X64_SSE4)); combinations.Add(new BurstOutputCombination("Plugins/x86", TargetCpu.X86_SSE2)); combinations.Add(new BurstOutputCombination("Plugins/ARM", TargetCpu.THUMB2_NEON32)); combinations.Add(new BurstOutputCombination("Plugins/ARM64", TargetCpu.ARMV8A_AARCH64)); } else if (targetPlatform == TargetPlatform.Lumin) { // Set the LUMINSDK_UNITY so bcl.exe will be able to find the SDK if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("LUMINSDK_UNITY"))) { var sdkRoot = EditorPrefs.GetString("LuminSDKRoot"); if (!string.IsNullOrEmpty(sdkRoot)) { Environment.SetEnvironmentVariable("LUMINSDK_UNITY", sdkRoot); } } combinations.Add(new BurstOutputCombination("Data/Plugins/", targetCpu)); } else if (targetPlatform == TargetPlatform.Switch) { combinations.Add(new BurstOutputCombination("NativePlugins/", targetCpu)); } #if UNITY_2019_3_OR_NEWER else if (targetPlatform == TargetPlatform.Stadia) { combinations.Add(new BurstOutputCombination("NativePlugins", targetCpu)); } #endif else { combinations.Add(new BurstOutputCombination("Data/Plugins/", targetCpu)); } return(combinations); }
public BurstOutputCombination(string outputPath, TargetCpu targetCpu) { TargetCpu = targetCpu; OutputPath = outputPath; }
public MinMaxTargetCpu(TargetCpu single) { min = single; max = single; }