зеркало из https://github.com/AvaloniaUI/angle.git
Add support for building in Flutter Windows UWP configuration
Bug: angleproject:5527 Change-Id: Idf5a4cbb6f84b24fa2448157cab1b6a3bce4d8be Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2620580 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
297e1ae196
Коммит
68ac4e43aa
21
BUILD.gn
21
BUILD.gn
|
@ -245,6 +245,12 @@ config("includes_config") {
|
|||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
config("angle_uwp_env") {
|
||||
if (angle_is_winuwp) {
|
||||
defines = [ "WINAPI_FAMILY=WINAPI_FAMILY_PC_APP" ]
|
||||
}
|
||||
}
|
||||
|
||||
angle_source_set("includes") {
|
||||
sources = libangle_includes
|
||||
public_configs = [ ":includes_config" ]
|
||||
|
@ -630,6 +636,10 @@ config("angle_backend_config") {
|
|||
if (angle_enable_vulkan) {
|
||||
configs += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend_config" ]
|
||||
}
|
||||
|
||||
if (angle_is_winuwp) {
|
||||
configs += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("libANGLE_config") {
|
||||
|
@ -736,7 +746,7 @@ angle_source_set("libANGLE_base") {
|
|||
":includes",
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
if (is_win && !angle_is_winuwp) {
|
||||
libs += [
|
||||
"gdi32.lib",
|
||||
"user32.lib",
|
||||
|
@ -763,6 +773,14 @@ angle_source_set("libANGLE_base") {
|
|||
public_deps += [ "src/libANGLE/renderer/vulkan:angle_vulkan_backend" ]
|
||||
}
|
||||
|
||||
if (angle_is_winuwp) {
|
||||
public_deps += [ "src/libANGLE/renderer/d3d:angle_enable_winuwp" ]
|
||||
}
|
||||
|
||||
if (angle_enable_d3d11) {
|
||||
libs += [ "dxguid.lib" ]
|
||||
}
|
||||
|
||||
if (angle_enable_metal) {
|
||||
public_deps += [ "src/libANGLE/renderer/metal:angle_metal_backend" ]
|
||||
}
|
||||
|
@ -1004,6 +1022,7 @@ if (is_win && !angle_is_winuwp) {
|
|||
angle_static_library("libGLESv2_static") {
|
||||
sources = libglesv2_sources
|
||||
configs += [ ":debug_annotations_config" ]
|
||||
|
||||
public_configs += [ ":angle_static" ]
|
||||
deps = [ ":includes" ]
|
||||
public_deps = [ ":libANGLE" ]
|
||||
|
|
|
@ -82,7 +82,7 @@ declare_args() {
|
|||
angle_shared_libvulkan = !is_mac
|
||||
|
||||
# There's no "is_winuwp" helper in BUILDCONFIG.gn, so we define one ourselves
|
||||
angle_is_winuwp = is_win && current_os == "winuwp"
|
||||
angle_is_winuwp = is_win && target_os == "winuwp"
|
||||
|
||||
# Default to using "_angle" suffix on Android
|
||||
if (is_android) {
|
||||
|
@ -185,6 +185,7 @@ angle_common_configs = [
|
|||
angle_root + ":constructor_and_destructor_warnings",
|
||||
angle_root + ":extra_warnings",
|
||||
angle_root + ":internal_config",
|
||||
angle_root + ":angle_uwp_env",
|
||||
]
|
||||
|
||||
angle_remove_configs = []
|
||||
|
|
|
@ -254,6 +254,8 @@ if (angle_enable_d3d11) {
|
|||
|
||||
if (angle_is_winuwp) {
|
||||
_d3d11_backend_sources += [
|
||||
"d3d11/converged/CompositorNativeWindow11.cpp",
|
||||
"d3d11/converged/CompositorNativeWindow11.h",
|
||||
"d3d11/winrt/CoreWindowNativeWindow.cpp",
|
||||
"d3d11/winrt/CoreWindowNativeWindow.h",
|
||||
"d3d11/winrt/InspectableNativeWindow.cpp",
|
||||
|
@ -321,4 +323,12 @@ if (angle_enable_d3d11) {
|
|||
public_deps = [ ":angle_d3d_shared" ]
|
||||
public_configs = [ ":angle_d3d11_backend_config" ]
|
||||
}
|
||||
|
||||
config("angle_enable_winuwp_config") {
|
||||
defines = [ "ANGLE_ENABLE_WINDOWS_UWP 1" ]
|
||||
}
|
||||
|
||||
angle_source_set("angle_enable_winuwp") {
|
||||
public_configs = [ ":angle_enable_winuwp_config" ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "libANGLE/trace.h"
|
||||
|
||||
#ifdef ANGLE_ENABLE_WINDOWS_UWP
|
||||
# include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
|
||||
# include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
|
||||
#else
|
||||
# include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
|
||||
|
@ -1314,13 +1315,11 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions
|
|||
// All D3D feature levels support robust resource init
|
||||
outExtensions->robustResourceInitialization = true;
|
||||
|
||||
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
|
||||
// Compositor Native Window capabilies require WinVer >= 1803
|
||||
if (CompositorNativeWindow11::IsSupportedWinRelease())
|
||||
{
|
||||
outExtensions->windowsUIComposition = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
angle::Result Renderer11::flush(Context11 *context11)
|
||||
|
@ -1379,7 +1378,12 @@ bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
|
|||
"Pointer size must match Window Handle size");
|
||||
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
|
||||
return NativeWindow11WinRT::IsValidNativeWindow(window);
|
||||
bool winrt = NativeWindow11WinRT::IsValidNativeWindow(window);
|
||||
if (!winrt)
|
||||
{
|
||||
return CompositorNativeWindow11::IsValidNativeWindow(window);
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
if (NativeWindow11Win32::IsValidNativeWindow(window))
|
||||
{
|
||||
|
@ -1395,9 +1399,19 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
|
|||
const egl::AttributeMap &attribs) const
|
||||
{
|
||||
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
|
||||
return new NativeWindow11WinRT(window, config->alphaSize > 0);
|
||||
auto useWinUiComp = window != nullptr && CompositorNativeWindow11::IsValidNativeWindow(window);
|
||||
if (useWinUiComp)
|
||||
{
|
||||
return new CompositorNativeWindow11(window, config->alphaSize > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new NativeWindow11WinRT(window, config->alphaSize > 0);
|
||||
}
|
||||
return nullptr;
|
||||
#else
|
||||
auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window);
|
||||
auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window) &&
|
||||
CompositorNativeWindow11::IsValidNativeWindow(window);
|
||||
|
||||
if (useWinUiComp)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,9 @@ HRESULT CompositorNativeWindow11::createSwapChain(ID3D11Device *device,
|
|||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||
swapChainDesc.AlphaMode = mHasAlpha ? DXGI_ALPHA_MODE_PREMULTIPLIED : DXGI_ALPHA_MODE_IGNORE;
|
||||
#ifndef ANGLE_ENABLE_WINDOWS_UWP
|
||||
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG::DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT;
|
||||
#endif
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain1> swapChain1;
|
||||
hr = factory2->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, &swapChain1);
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -237,10 +239,17 @@ RoHelper::RoHelper()
|
|||
mComBaseModule(nullptr),
|
||||
mCoreMessagingModule(nullptr)
|
||||
{
|
||||
if (!IsWindows10OrGreater())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ANGLE_ENABLE_WINDOWS_UWP
|
||||
mFpWindowsCreateStringReference = &::WindowsCreateStringReference;
|
||||
mFpRoInitialize = &::RoInitialize;
|
||||
mFpRoUninitialize = &::RoUninitialize;
|
||||
mFpWindowsDeleteString = &::WindowsDeleteString;
|
||||
mFpGetActivationFactory = &::RoGetActivationFactory;
|
||||
mFpWindowsCompareStringOrdinal = &::WindowsCompareStringOrdinal;
|
||||
mFpCreateDispatcherQueueController = &::CreateDispatcherQueueController;
|
||||
mWinRtAvailable = true;
|
||||
#else
|
||||
|
||||
mComBaseModule = LoadLibraryA("ComBase.dll");
|
||||
|
||||
|
@ -294,14 +303,18 @@ RoHelper::RoHelper()
|
|||
return;
|
||||
}
|
||||
|
||||
if (SUCCEEDED(RoInitialize(RO_INIT_MULTITHREADED)))
|
||||
auto result = RoInitialize(RO_INIT_SINGLETHREADED);
|
||||
|
||||
if (SUCCEEDED(result) || result == S_FALSE || result == RPC_E_CHANGED_MODE)
|
||||
{
|
||||
mWinRtAvailable = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RoHelper::~RoHelper()
|
||||
{
|
||||
#ifndef ANGLE_ENABLE_WINDOWS_UWP
|
||||
if (mWinRtAvailable)
|
||||
{
|
||||
RoUninitialize();
|
||||
|
@ -318,6 +331,7 @@ RoHelper::~RoHelper()
|
|||
FreeLibrary(mComBaseModule);
|
||||
mComBaseModule = nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool RoHelper::WinRtAvailable() const
|
||||
|
@ -327,7 +341,7 @@ bool RoHelper::WinRtAvailable() const
|
|||
|
||||
bool RoHelper::SupportedWindowsRelease()
|
||||
{
|
||||
if (!IsWindows10OrGreater() || !mWinRtAvailable)
|
||||
if (!mWinRtAvailable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <EGL/eglplatform.h>
|
||||
|
||||
#include <windows.applicationmodel.core.h>
|
||||
#undef GetCurrentTime
|
||||
#include <windows.ui.xaml.h>
|
||||
#include <windows.ui.xaml.media.dxinterop.h>
|
||||
#include <wrl.h>
|
||||
|
|
|
@ -95,7 +95,7 @@ if (is_apple) {
|
|||
|
||||
if (is_win) {
|
||||
libangle_common_sources += [ "src/common/system_utils_win.cpp" ]
|
||||
if (current_os == "winuwp") {
|
||||
if (target_os == "winuwp") {
|
||||
libangle_common_sources += [ "src/common/system_utils_winuwp.cpp" ]
|
||||
} else {
|
||||
libangle_common_sources += [ "src/common/system_utils_win32.cpp" ]
|
||||
|
|
Загрузка…
Ссылка в новой задаче