浏览代码

Merge branch 'master' of github.com:Unity-Technologies/com.unity.uiwidgets into zxw/windows_use_externalTex

/siyaoH-1.17-PlatformMessage
xingweizhu 3 年前
当前提交
d5c55377
共有 15 个文件被更改,包括 123 次插入65 次删除
  1. 4
      README-ZH.md
  2. 6
      README.md
  3. 61
      com.unity.uiwidgets/Runtime/widgets/navigator.cs
  4. 2
      com.unity.uiwidgets/Runtime/widgets/routes.cs
  5. 23
      engine/Build.bee.cs
  6. 72
      engine/README.md
  7. 4
      engine/src/shell/platform/unity/android/uiwidgets_system.h
  8. 4
      engine/src/shell/platform/unity/darwin/ios/uiwidgets_system.h
  9. 4
      engine/src/shell/platform/unity/darwin/macos/uiwidgets_system.h
  10. 4
      engine/src/shell/platform/unity/windows/uiwidgets_system.h
  11. 4
      engine/third_party/Unity/IUnityUIWidgets.h

4
README-ZH.md


### 基于UIWidgets的项目
#### Unity Connect App
Unity Connect App是使用UIWidgets开发的一个移动App产品,您随时可以在Android (https://connect.unity.com/connectApp/download)
Unity Connect App是使用UIWidgets开发的一个移动App产品,您随时可以在Android (https://unity.cn/connectApp/download)
以及iOS (Searching for "Unity Connect" in App Store)端下载到它最新的版本. 本项目的所有代码均开源@https://github.com/UnityTech/ConnectAppCN.
#### Unity中文官方文档

#### Unity
安装 **Unity 2019.1.14f1c1** 及其更高版本。 你可以从[https://unity3d.com/get-unity/download](https://unity3d.com/get-unity/download)下载最新的Unity。
安装 **Unity 2019.4.25f1c2**(_unityhub://2019.4.25f1c2/44dea2b5e6e6_)或 **Unity 2019.4.26f1c1**。 你可以从[https://unity3d.com/get-unity/download](https://unity3d.com/get-unity/download)下载最新的Unity。
#### UIWidgets包

6
README.md


the powerful Unity Engine, it offers developers many new features to improve their Apps
as well as the develop workflow significantly.
As the latest version, UIWidgets 2.0 aims to optmize the overall performance of the package. Specifically, a performance gain around 10% is observed on mobile devices like iPhone 6 after upgrading to UIWidgets 2.0. However, if you still want to use the original UIWidgets 1.0, please download the archived packages from Releases or switch your working branch to uiwidgets_1.0.
As the latest version, UIWidgets 2.0 aims to optimize the overall performance of the package. Specifically, a performance gain around 10% is observed on mobile devices like iPhone 6 after upgrading to UIWidgets 2.0. However, if you still want to use the original UIWidgets 1.0, please download the archived packages from Releases or switch your working branch to uiwidgets_1.0.
#### Efficiency
Using the latest Unity rendering SDKs, a UIWidgets App can run very fast and keep >60fps in most times.

### Projects using UIWidgets
#### Unity Connect App
The Unity Connect App is created using UIWidgets and available for both Android (https://connect.unity.com/connectApp/download)
The Unity Connect App is created using UIWidgets and available for both Android (https://unity.cn/connectApp/download)
and iOS (Searching for "Unity Connect" in App Store). This project is open-sourced @https://github.com/UnityTech/ConnectAppCN.
#### Unity Chinese Doc

#### Unity
Install **Unity 2019.1.14f1c1** and above. You can download the latest Unity on https://unity3d.com/get-unity/download.
Install **Unity 2019.4.25f1c2** (_unityhub://2019.4.25f1c2/44dea2b5e6e6_) or **Unity 2019.4.26f1c1**. You can download the latest Unity on https://unity3d.com/get-unity/download.
#### UIWidgets Package
Visit our Github repository https://github.com/Unity-Technologies/com.unity.uiwidgets

61
com.unity.uiwidgets/Runtime/widgets/navigator.cs


return of(context).pushReplacementNamed<T,TO>(routeName, arguments: arguments,result: result);
}
public static Future pushReplacementNamed(BuildContext context, string routeName,
object result = default , object arguments = null) {
return of(context).pushReplacementNamed(routeName, arguments: arguments,result: result);
}
public static Future<T> popAndPushNamed<T,TO>(BuildContext context, string routeName,
TO result = default,
object arguments = null) {

return route;
}
public Route<T> _routeNamed<T>(string name, object arguments, bool allowNull = false) {
public Route _routeNamed<T>(string name, object arguments, bool allowNull = false) {
D.assert(!_debugLocked);
D.assert(name != null);
if (allowNull && widget.onGenerateRoute == null)

arguments: arguments
);
var routeee = widget.onGenerateRoute(settings);
Route<T> route = routeee as Route<T>;
Route route = widget.onGenerateRoute(settings);
if (route == null && !allowNull) {
D.assert(() => {
if (widget.onUnknownRoute == null) {

return true;
});
route = widget.onUnknownRoute(settings) as Route<T>;
route = widget.onUnknownRoute(settings);
D.assert(() => {
if (route == null) {
throw new UIWidgetsError(

return pushReplacement<T, TO>(_routeNamed<T>(routeName, arguments: arguments), result: result);
}
public Future pushReplacementNamed(
string routeName,
object result = default,
object arguments = null
) {
return pushReplacement(_routeNamed(routeName, arguments: arguments), result: result);
}
public Future<T> popAndPushNamed<T, TO>(
string routeName,
TO result = default,

public Future<T> pushReplacement<T, TO>(Route<T> newRoute, TO result) {
public Future<T> pushReplacement<T, TO>(Route newRoute, TO result) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

return newRoute.popped.to<T>();
}
public Future<T> pushAndRemoveUntil<T>(Route<T> newRoute, RoutePredicate predicate) {
public Future pushReplacement(Route newRoute, object result) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;
return true;
});
D.assert(newRoute != null);
D.assert(newRoute._navigator == null);
D.assert(_history.isNotEmpty());
bool anyEntry = false;
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {
anyEntry = true;
}
}
D.assert(anyEntry,()=> "Navigator has no active routes to replace.");
_RouteEntry lastEntry = null;
foreach (var historyEntry in _history) {
if (_RouteEntry.isPresentPredicate(historyEntry)) {
lastEntry = historyEntry;
}
}
lastEntry.complete(result, isReplaced: true);
_history.Add(new _RouteEntry(newRoute, initialState: _RouteLifecycle.pushReplace));
_flushHistoryUpdates();
D.assert(() => {
_debugLocked = false;
return true;
});
_afterNavigation(newRoute);
return newRoute.popped.to<object>();
}
public Future<T> pushAndRemoveUntil<T>(Route newRoute, RoutePredicate predicate) {
D.assert(!_debugLocked);
D.assert(() => {
_debugLocked = true;

2
com.unity.uiwidgets/Runtime/widgets/routes.cs


}
}
public RoutePredicate withName(string name) {
public static RoutePredicate withName(string name) {
return (Route route) => !route.willHandlePopInternally
&& route is ModalRoute
&& route.settings.name == name;

23
engine/Build.bee.cs


"src/engine.cc",
"src/platform_base.h",
},
OutputName = { c => $"libUIWidgets" },
OutputName = { c => "libUIWidgets" },
};
// include these files for test only

return new PrecompiledLibrary[]
{
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/flutter/third_party/txt/txt_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/third_party/angle/angle_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/third_party/angle/libEGL_static.lib"),
new StaticLibrary(flutterRoot+"/out/host_debug_unopt/obj/third_party/angle/libGLESv2_static.lib"),
new SystemLibrary("dxguid.lib"),
};
});

return new PrecompiledLibrary[]
{
new StaticLibrary(flutterRoot+"/out/host_release/obj/flutter/third_party/txt/txt_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_release/obj/third_party/angle/angle_lib.lib"),
new StaticLibrary(flutterRoot+"/out/host_release/obj/third_party/angle/libEGL_static.lib"),
new StaticLibrary(flutterRoot+"/out/host_release/obj/third_party/angle/libGLESv2_static.lib"),
};
});
np.Libraries.Add(IsWindows, c =>

new StaticLibrary(windowsSkiaBuild+"/libEGL.dll.lib"),
new StaticLibrary(windowsSkiaBuild+"/libGLESv2.dll.lib"),
new SystemLibrary("Opengl32.lib"),
new SystemLibrary("d3d9.lib"),
new SystemLibrary("gdi32.lib"),
np.SupportFiles.Add(c => IsWindows(c), new[] {
new DeployableFile(windowsSkiaBuild + "/libEGL.dll"),
new DeployableFile(windowsSkiaBuild + "/libEGL.dll.pdb"),
new DeployableFile(windowsSkiaBuild + "/libGLESv2.dll"),
new DeployableFile(windowsSkiaBuild + "/libGLESv2.dll.pdb"),
}
);
np.Libraries.Add(IsMac, c =>
{
if(c.CodeGen == CodeGen.Debug){

72
engine/README.md


```
Apply the following diff:
modify flutter/third_party/txt/BUILD.gn
```
--- a/third_party/txt/BUILD.gn
+++ b/third_party/txt/BUILD.gn

+}
```
modify third_party/angnle/BUILD.gn
```
diff --git a/BUILD.gn b/BUILD.gn
index 06bf3bbbe..b4289dfa7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1252,3 +1252,17 @@ if (!is_component_build && is_android &&
]
}
}
+angle_static_library("angle_lib"){
+ complete_static_lib = true
+
+ deps = [
+ ":libANGLE",
+ ":libANGLE_base",
+ ":angle_system_utils",
+ ":angle_version",
+ ]
+
+ public_deps = [
+ ":includes",
+ ]
+}
diff --git a/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp b/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp
index adeeb5aa1..c9677bd8d 100644
--- a/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/ExternalImageSiblingImpl11.cpp
@@ -144,7 +144,7 @@ angle::Result ExternalImageSiblingImpl11::createRenderTarget(const gl::Context *
mRenderTarget = std::make_unique<TextureRenderTarget11>(
std::move(rtv), mTexture, std::move(srv), std::move(blitSrv), formatInfo.internalFormat,
- formatInfo, mSize.width, mSize.height, 1, 1);
+ formatInfo, mSize.width, mSize.height, 1, mSamples);
return angle::Result::Continue;
}
```
update `out\host_debug_unopt\args.gn`
```

cd engine/src
python ./flutter/tools/gn --unoptimized
ninja -C out\host_debug_unopt flutter/third_party/txt:txt_lib
```
### Build Skia
1. Install LLVM
https://clang.llvm.org/get_started.html
2. Build skia
```
cd $FLUTTER_ROOT/third_party/skia
python2 tools/git-sync-deps
bin/gn gen out/Debug
```
Update out/Debug/args.gn with the following content:
```
clang_win = "C:\Program Files\LLVM/third_party/skia"
win_vc = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC"
cc = "clang"
cxx = "clang++"
is_debug = true
skia_use_angle = true
skia_use_egl = true
extra_cflags = [
"/MTd",
"-I../../third_party/externals/angle2/include",
]
ninja -C out\host_debug_unopt third_party/angle:angle_lib
ninja -C out\host_debug_unopt third_party/angle:libEGL_static
```
ninja -C out/Debug -k 0
```
Ignore this error: "lld-link: error: could not open 'EGL': no such file or directory"
convert icudtl.dat to object file in flutter
```

4
engine/src/shell/platform/unity/android/uiwidgets_system.h


void PostTaskToGfxWorker(const fml::closure& task);
void printf_console(const char* log, ...) {
va_list vl;
/*va_list vl;
va_end(vl);
va_end(vl);*/
}
void BindUnityInterfaces(IUnityInterfaces* unity_interfaces);

4
engine/src/shell/platform/unity/darwin/ios/uiwidgets_system.h


void PostTaskToGfxWorker(const fml::closure& task);
void printf_console(const char* log, ...) {
va_list vl;
/*va_list vl;
va_end(vl);
va_end(vl);*/
}
void BindUnityInterfaces(IUnityInterfaces* unity_interfaces);

4
engine/src/shell/platform/unity/darwin/macos/uiwidgets_system.h


void PostTaskToGfxWorker(const fml::closure& task);
void printf_console(const char* log, ...) {
va_list vl;
/*va_list vl;
va_end(vl);
va_end(vl);*/
}
void BindUnityInterfaces(IUnityInterfaces* unity_interfaces);

4
engine/src/shell/platform/unity/windows/uiwidgets_system.h


void PostTaskToGfxWorker(const fml::closure& task);
void printf_console(const char* log, ...) {
va_list vl;
/*va_list vl;
va_end(vl);
va_end(vl);*/
}
void BindUnityInterfaces(IUnityInterfaces* unity_interfaces);

4
engine/third_party/Unity/IUnityUIWidgets.h


virtual void SetWakeUpCallback(VoidCallback callback) = 0;
virtual void IssuePluginEventAndData(UnityRenderingEventAndData callback,
int eventId, void* data) = 0;
virtual void printf_consolev(const char* log, va_list alist) = 0;
//TODO zxw: this API is not provided in 2019.4.26f1c1 due to a mistake :(
//we should consider adding it back later (remember to enable all callers too)
//virtual void printf_consolev(const char* log, va_list alist) = 0;
};
} // namespace UnityUIWidgets

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存