Add support for generating UWP (Windows Store) projects again

Until late 2017, ANGLE supported  Windows Store apps on Windows 8.1,
Windows Phone 8.1, and Windows 10 (via the Universal Windows
Platform, aka UWP).

Unfortunately ANGLE deprecated support for Windows Store when it
switched from GYP to GN in 2017. Since then, users have been able
to use Microsoft\angle for their UWP apps but this isn't ideal since
it's based on a 2017 copy of Google\angle.

This PR bring back support for UWPs, so that UWP users can use
Google\angle again. Specifically it:

- Adds support for generating UWP projects via GN
- Adds helper/util functions specific to UWP (they're mostly
similar to the desktop Windows helpers)
- Fixes some existing Windows Store code that's rotted since 2017
- Disables async shader compilation for UWPs, since its
implementation calls wait on the UI thread (which is forbidden
in UWPs)
- Renames 'ANGLE_ENABLE_WINDOWS_STORE' to
'ANGLE_ENABLE_WINDOWS_UWP', since ANGLE only support UWPs now
- Fixes misc other related issues (such as dependencies on D3D9
headers in API-agnostic code)

Note that this doesn't bring back support for Windows/Phone 8.1.

BUG=angleproject:3922

Change-Id: Ia79ae05a5e0e0a0625eb633bf1928722dfd3e85f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811871
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Austin Kinross
2019-09-18 14:46:23 -07:00
committed by Commit Bot
parent dd4a00a06d
commit 11dc16350c
27 changed files with 241 additions and 60 deletions

View File

@@ -25,9 +25,13 @@ declare_args() {
# Defaults to capture building to $root_out_dir/angle_libs/with_capture.
# Switch on to build capture to $root_out_dir.
angle_with_capture_by_default = false
# Don't build extra (test, samples etc) for Windows UWP. We don't have
# infrastructure (e.g. windowing helper functions) in place to run them.
angle_build_all = !angle_is_winuwp
}
if (!build_with_chromium) {
if (!build_with_chromium && angle_build_all) {
group("all") {
testonly = true
deps = [
@@ -139,6 +143,10 @@ config("extra_warnings") {
"-Wshorten-64-to-32",
]
}
if (angle_is_winuwp) {
cflags += [ "/wd4447" ] # 'main' signature found without threading model.
}
}
# This config adds build-ids to the associated library.
@@ -222,7 +230,7 @@ config("angle_common_config") {
}
}
if (is_win) {
if (is_win && !angle_is_winuwp) {
angle_source_set("angle_stack_walker") {
sources = [
"util/windows/third_party/StackWalker/src/StackWalker.cpp",
@@ -338,7 +346,9 @@ angle_static_library("angle_gpu_info_util") {
if (is_win) {
sources += libangle_gpu_info_util_win_sources
libs += [ "setupapi.lib" ]
if (!angle_is_winuwp) {
libs += [ "setupapi.lib" ]
}
libs += [ "dxgi.lib" ]
}
@@ -622,7 +632,13 @@ angle_source_set("libANGLE_base") {
if (angle_enable_d3d11) {
sources += libangle_d3d11_sources
sources += libangle_d3d11_win32_sources
if (angle_is_winuwp) {
sources += libangle_d3d11_winuwp_sources
} else {
sources += libangle_d3d11_win32_sources
}
libs += [ "dxguid.lib" ]
import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni")
sources += libangle_d3d11_blit_shaders
@@ -852,7 +868,7 @@ angle_libGLESv2("libGLESv2_capture_complement") {
}
}
if (is_win) {
if (is_win && !angle_is_winuwp) {
angle_shared_library("libGL") {
sources = libgl_sources
@@ -1006,7 +1022,7 @@ angle_source_set("angle_util_loader_headers") {
"util/util_export.h",
]
if (is_win) {
if (is_win && !angle_is_winuwp) {
sources += [ "util/windows/wgl_loader_autogen.h" ]
}
@@ -1023,7 +1039,7 @@ angle_source_set("angle_util_loader") {
"util/gles_loader_autogen.cpp",
]
if (is_win) {
if (is_win && !angle_is_winuwp) {
sources += [ "util/windows/wgl_loader_autogen.cpp" ]
}
@@ -1069,7 +1085,7 @@ foreach(is_shared_library,
public_deps = []
libs = []
if (is_win) {
if (is_win && !angle_is_winuwp) {
sources += util_win_sources
deps += [ ":angle_stack_walker" ]
}
@@ -1129,7 +1145,7 @@ foreach(is_shared_library,
if (is_shared_library) {
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
if (is_win) {
if (is_win && !angle_is_winuwp) {
sources += util_win_shared_sources
}

View File

@@ -66,6 +66,8 @@ is_debug = true (enable debugging, true is the default)
```
For a release build run `gn args out/Release` and set `is_debug = false`.
On Windows, you can build for the Universal Windows Platform (UWP) by setting `target_os = "winuwp"` in the args.
For more information on GN run `gn help`.
Ninja can be used to compile on all platforms with one of the following commands:

View File

@@ -47,6 +47,9 @@ declare_args() {
}
angle_shared_libvulkan = false
# There's no "is_winuwp" helper in BUILDCONFIG.gn, so we define one ourselves
angle_is_winuwp = is_win && current_os == "winuwp"
# Default to using "_angle" suffix on Android
if (is_android) {
angle_libs_suffix = "_angle"
@@ -56,16 +59,18 @@ declare_args() {
}
declare_args() {
angle_enable_d3d9 = is_win
angle_enable_d3d9 = is_win && !angle_is_winuwp
angle_enable_d3d11 = is_win
angle_enable_gl = (ozone_platform_gbm || !is_linux ||
(use_x11 && !is_chromeos)) && !is_fuchsia
angle_enable_gl =
(ozone_platform_gbm || !is_linux || (use_x11 && !is_chromeos)) &&
!is_fuchsia && !angle_is_winuwp
# ANGLE Vulkan backend on Android requires API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
# Otherwise, API level 24 would have been enough.
angle_enable_vulkan = is_win || (is_linux && use_x11 && !is_chromeos) ||
(is_android && ndk_api_level_at_least_26) || is_fuchsia
angle_enable_vulkan =
(is_win && !angle_is_winuwp) || (is_linux && use_x11 && !is_chromeos) ||
(is_android && ndk_api_level_at_least_26) || is_fuchsia
angle_enable_null = true
angle_enable_essl = true
angle_enable_glsl = true

View File

@@ -46,7 +46,7 @@
# include <windows.h>
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
# define ANGLE_ENABLE_WINDOWS_STORE 1
# define ANGLE_ENABLE_WINDOWS_UWP 1
# endif
# if defined(ANGLE_ENABLE_D3D9)
@@ -68,7 +68,7 @@
# include <wrl.h>
# endif
# if defined(ANGLE_ENABLE_WINDOWS_STORE)
# if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <dxgi1_3.h>
# if defined(_DEBUG)
# include <DXProgrammableCapture.h>

View File

@@ -0,0 +1,120 @@
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// system_utils_winuwp.cpp: Implementation of OS-specific functions for Windows UWP
#include "system_utils.h"
#include <stdarg.h>
#include <windows.h>
#include <array>
#include <codecvt>
#include <locale>
#include <string>
#include <vector>
#include "common/debug.h"
namespace angle
{
bool SetEnvironmentVar(const char *variableName, const char *value)
{
// Not supported for UWP
return false;
}
std::string GetEnvironmentVar(const char *variableName)
{
// Not supported for UWP
return "";
}
const char *GetSharedLibraryExtension()
{
return "dll";
}
const char *GetPathSeparator()
{
return ";";
}
double GetCurrentTime()
{
LARGE_INTEGER frequency = {};
QueryPerformanceFrequency(&frequency);
LARGE_INTEGER curTime;
QueryPerformanceCounter(&curTime);
return static_cast<double>(curTime.QuadPart) / frequency.QuadPart;
}
class UwpLibrary : public Library
{
public:
UwpLibrary(const char *libraryName, SearchType searchType)
{
char buffer[MAX_PATH];
int ret = snprintf(buffer, MAX_PATH, "%s.%s", libraryName, GetSharedLibraryExtension());
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::wstring wideBuffer = converter.from_bytes(buffer);
if (ret > 0 && ret < MAX_PATH)
{
switch (searchType)
{
case SearchType::ApplicationDir:
mModule = LoadPackagedLibrary(wideBuffer.c_str(), 0);
break;
case SearchType::SystemDir:
// Not supported in UWP
break;
}
}
}
~UwpLibrary() override
{
if (mModule)
{
FreeLibrary(mModule);
}
}
void *getSymbol(const char *symbolName) override
{
if (!mModule)
{
return nullptr;
}
return reinterpret_cast<void *>(GetProcAddress(mModule, symbolName));
}
void *getNative() const override { return reinterpret_cast<void *>(mModule); }
private:
HMODULE mModule = nullptr;
};
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
{
return new UwpLibrary(libraryName, searchType);
}
bool IsDebuggerAttached()
{
return !!::IsDebuggerPresent();
}
void BreakDebugger()
{
__debugbreak();
}
} // namespace angle

View File

@@ -10,7 +10,7 @@
#include <assert.h>
#ifdef ANGLE_ENABLE_WINDOWS_STORE
#ifdef ANGLE_ENABLE_WINDOWS_UWP
# include <map>
# include <mutex>
# include <set>
@@ -39,7 +39,7 @@ TLSIndex CreateTLSIndex()
TLSIndex index;
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifdef ANGLE_ENABLE_WINDOWS_UWP
if (!freeTlsIndices.empty())
{
DWORD result = freeTlsIndices.back();
@@ -76,7 +76,7 @@ bool DestroyTLSIndex(TLSIndex index)
}
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifdef ANGLE_ENABLE_WINDOWS_UWP
assert(index < nextTlsIndex);
assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
@@ -106,7 +106,7 @@ bool SetTLSValue(TLSIndex index, void *value)
}
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifdef ANGLE_ENABLE_WINDOWS_UWP
ThreadLocalData *threadData = currentThreadData;
if (!threadData)
{
@@ -138,7 +138,7 @@ void *GetTLSValue(TLSIndex index)
}
#ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifdef ANGLE_ENABLE_WINDOWS_UWP
ThreadLocalData *threadData = currentThreadData;
if (threadData && threadData->size() > index)
{

View File

@@ -14,7 +14,7 @@
#ifdef ANGLE_PLATFORM_WINDOWS
// TLS does not exist for Windows Store and needs to be emulated
# ifdef ANGLE_ENABLE_WINDOWS_STORE
# ifdef ANGLE_ENABLE_WINDOWS_UWP
# ifndef TLS_OUT_OF_INDEXES
# define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF)
# endif

View File

@@ -13,7 +13,7 @@
#include <set>
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <windows.applicationmodel.core.h>
# include <windows.graphics.display.h>
# include <wrl.h>
@@ -1078,7 +1078,7 @@ EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle)
} // namespace gl_egl
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
std::string getTempPath()
{
# ifdef ANGLE_PLATFORM_WINDOWS
@@ -1116,7 +1116,7 @@ void writeFile(const char *path, const void *content, size_t size)
fwrite(content, sizeof(char), size, file);
fclose(file);
}
#endif // !ANGLE_ENABLE_WINDOWS_STORE
#endif // !ANGLE_ENABLE_WINDOWS_UWP
#if defined(ANGLE_PLATFORM_WINDOWS)

View File

@@ -245,7 +245,7 @@ EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType);
EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle);
} // namespace gl_egl
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
std::string getTempPath();
void writeFile(const char *path, const void *data, size_t size);
#endif

View File

@@ -14,7 +14,6 @@
// Windows.h needs to be included first
#include <windows.h>
#include <d3d10.h>
#include <dxgi.h>
#include <array>
@@ -28,11 +27,20 @@ namespace
bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices)
{
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
IDXGIFactory1 *factory;
if (!SUCCEEDED(
CreateDXGIFactory1(__uuidof(IDXGIFactory1), reinterpret_cast<void **>(&factory))))
{
return false;
}
#else
IDXGIFactory *factory;
if (!SUCCEEDED(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&factory))))
{
return false;
}
#endif
UINT i = 0;
IDXGIAdapter *adapter = nullptr;
@@ -42,7 +50,7 @@ bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices)
adapter->GetDesc(&desc);
LARGE_INTEGER umdVersion;
if (adapter->CheckInterfaceSupport(__uuidof(ID3D10Device), &umdVersion) ==
if (adapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &umdVersion) ==
DXGI_ERROR_UNSUPPORTED)
{
adapter->Release();
@@ -95,9 +103,11 @@ bool GetSystemInfo(SystemInfo *info)
// can override the heuristic to find the active GPU
info->activeGPUIndex = 0;
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
// Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled.
HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll");
info->isOptimus = nvd3d9wrap != nullptr;
#endif
return true;
}

View File

@@ -1368,7 +1368,7 @@ bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
return true;
}
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
if (display == EGL_SOFTWARE_DISPLAY_ANGLE || display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
{

View File

@@ -53,8 +53,9 @@
#endif
// Controls if our threading code uses std::async or falls back to single-threaded operations.
#if !defined(ANGLE_STD_ASYNC_WORKERS)
// Note that we can't easily use std::async in UWPs due to UWP threading restrictions.
#if !defined(ANGLE_STD_ASYNC_WORKERS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
# define ANGLE_STD_ASYNC_WORKERS ANGLE_ENABLED
#endif // !defined(ANGLE_STD_ASYNC_WORKERS)
#endif // !defined(ANGLE_STD_ASYNC_WORKERS) && & !defined(ANGLE_ENABLE_WINDOWS_UWP)
#endif // LIBANGLE_FEATURES_H_

View File

@@ -121,7 +121,7 @@ angle::Result HLSLCompiler::ensureInitialized(d3d::Context *context)
}
ANGLE_TRACE_EVENT0("gpu.angle", "HLSLCompiler::initialize");
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
# if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
// Find a D3DCompiler module that had already been loaded based on a predefined list of
// versions.
@@ -214,12 +214,12 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
{
ASSERT(mInitialized);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
ASSERT(mD3DCompilerModule);
#endif
ASSERT(mD3DCompileFunc);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && defined(ANGLE_ENABLE_DEBUG_TRACE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP) && defined(ANGLE_ENABLE_DEBUG_TRACE)
std::string sourcePath = getTempPath();
std::ostringstream stream;
stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;

View File

@@ -240,7 +240,9 @@ GLenum DefaultGLErrorCode(HRESULT hr)
{
switch (hr)
{
#ifdef ANGLE_ENABLE_D3D9
case D3DERR_OUTOFVIDEOMEMORY:
#endif
case E_OUTOFMEMORY:
return GL_OUT_OF_MEMORY;
default:

View File

@@ -252,7 +252,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderD3D::compile(const gl::Context *cont
const std::string &source = mData.getSource();
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
if (gl::DebugAnnotationsActive())
{
sourcePath = getTempPath();

View File

@@ -67,12 +67,14 @@ bool DebugAnnotator11::loggingEnabledForThisThread() const
void DebugAnnotator11::initialize(ID3D11DeviceContext *context)
{
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
// ID3DUserDefinedAnnotation.GetStatus only works on Windows10 or greater.
// Returning true unconditionally from DebugAnnotator11::getStatus() means
// writing out all compiled shaders to temporary files even if debugging
// tools are not attached. See rx::ShaderD3D::prepareSourceAndReturnOptions.
// If you want debug annotations, you must use Windows 10.
if (IsWindows10OrGreater())
#endif
{
mAnnotationThread = std::this_thread::get_id();
mUserDefinedAnnotation.Attach(

View File

@@ -62,7 +62,7 @@
#include "libANGLE/renderer/renderer_utils.h"
#include "libANGLE/trace.h"
#ifdef ANGLE_ENABLE_WINDOWS_STORE
#ifdef ANGLE_ENABLE_WINDOWS_UWP
# include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
#else
# include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
@@ -513,7 +513,7 @@ egl::Error Renderer11::initialize()
ANGLE_TRY(initializeD3DDevice());
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
# if !ANGLE_SKIP_DXGI_1_2_CHECK
{
ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (DXGICheck)");
@@ -674,7 +674,7 @@ egl::Error Renderer11::initializeD3DDevice()
if (!mCreatedWithDeviceEXT)
{
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = nullptr;
{
ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (Load DLLs)");
@@ -1140,11 +1140,13 @@ 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)
@@ -1202,7 +1204,7 @@ bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
static_assert(sizeof(ABI::Windows::UI::Composition::SpriteVisual *) == sizeof(HWND),
"Pointer size must match Window Handle size");
#ifdef ANGLE_ENABLE_WINDOWS_STORE
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
return NativeWindow11WinRT::IsValidNativeWindow(window);
#else
if (NativeWindow11Win32::IsValidNativeWindow(window))
@@ -1218,6 +1220,9 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
const egl::Config *config,
const egl::AttributeMap &attribs) const
{
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
return new NativeWindow11WinRT(window, config->alphaSize > 0);
#else
auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window);
if (useWinUiComp)
@@ -1226,15 +1231,11 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
}
else
{
#ifdef ANGLE_ENABLE_WINDOWS_STORE
UNUSED_VARIABLE(attribs);
return new NativeWindow11WinRT(window, config->alphaSize > 0);
#else
return new NativeWindow11Win32(
window, config->alphaSize > 0,
attribs.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE);
#endif
}
#endif
}
egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration,
@@ -2109,14 +2110,14 @@ bool Renderer11::getShareHandleSupport() const
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
{
#ifndef ANGLE_ENABLE_WINDOWS_STORE
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
if (!IsWindows8OrGreater())
{
// WARP on Windows 7 doesn't support shared handles
mSupportsShareHandles = false;
return false;
}
#endif // ANGLE_ENABLE_WINDOWS_STORE
#endif // !defined(ANGLE_ENABLE_WINDOWS_UWP)
// WARP on Windows 8.0+ supports shared handles when shared with another WARP device
// TODO: allow applications to query for HARDWARE or WARP-specific share handles,

View File

@@ -10,7 +10,7 @@
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <windows.applicationmodel.core.h>
# include <wrl.h>
# include <wrl/wrappers/corewrappers.h>
@@ -44,7 +44,7 @@ void Trim11::trim()
return;
}
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
ID3D11Device *device = mRenderer->getDevice();
IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject<IDXGIDevice3>(device);
if (dxgiDevice3)
@@ -57,7 +57,7 @@ void Trim11::trim()
bool Trim11::registerForRendererTrimRequest()
{
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
ICoreApplication *coreApplication = nullptr;
HRESULT result = GetActivationFactory(
HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
@@ -84,7 +84,7 @@ bool Trim11::registerForRendererTrimRequest()
void Trim11::unregisterForRendererTrimRequest()
{
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
if (mApplicationSuspendedEventToken.value != 0)
{
ICoreApplication *coreApplication = nullptr;

View File

@@ -13,7 +13,7 @@
#include "libANGLE/Error.h"
#include "libANGLE/angletypes.h"
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <EventToken.h>
#endif
@@ -29,7 +29,7 @@ class Trim11 : angle::NonCopyable
private:
Renderer11 *mRenderer;
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
#if defined(ANGLE_ENABLE_WINDOWS_UWP)
EventRegistrationToken mApplicationSuspendedEventToken;
#endif

View File

@@ -1693,7 +1693,7 @@ void GenerateCaps(ID3D11Device *device,
// D3D11 does not support vertex attribute aliasing
limitations->noVertexAttributeAliasing = true;
#ifdef ANGLE_ENABLE_WINDOWS_STORE
#ifdef ANGLE_ENABLE_WINDOWS_UWP
// Setting a non-zero divisor on attribute zero doesn't work on certain Windows Phone 8-era
// devices. We should prevent developers from doing this on ALL Windows Store devices. This will
// maintain consistency across all Windows devices. We allow non-zero divisors on attribute zero

View File

@@ -49,11 +49,15 @@ class CoreWindowNativeWindow : public InspectableNativeWindow,
ComPtr<IMap<HSTRING, IInspectable *>> mPropertyMap;
};
[uuid(7F924F66 - EBAE - 40E5 - A10B - B8F35E245190)] class CoreWindowSizeChangedHandler
// clang format would break the uuid below
// clang-format off
[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)] class CoreWindowSizeChangedHandler
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
IWindowSizeChangedEventHandler>
{
// clang-format on
public:
CoreWindowSizeChangedHandler() {}
HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)

View File

@@ -88,8 +88,15 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device,
DXGI_FORMAT format,
UINT width,
UINT height,
UINT samples,
IDXGISwapChain **swapChain)
{
if (samples > 1)
{
// Multisample not implemented for WinRT window types
return E_NOTIMPL;
}
if (mImpl)
{
IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);

View File

@@ -34,6 +34,7 @@ class NativeWindow11WinRT : public NativeWindow11
DXGI_FORMAT format,
UINT width,
UINT height,
UINT samples,
IDXGISwapChain **swapChain) override;
void commitChange() override;

View File

@@ -43,11 +43,15 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow,
ComPtr<IDXGISwapChain1> mSwapChain;
};
[uuid(8ACBD974 - 8187 - 4508 - AD80 - AEC77F93CF36)] class SwapChainPanelSizeChangedHandler
// clang format would break the uuid below
// clang-format off
[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)] class SwapChainPanelSizeChangedHandler
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
ABI::Windows::UI::Xaml::ISizeChangedEventHandler>
{
// clang-format on
public:
SwapChainPanelSizeChangedHandler() {}
HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)

View File

@@ -88,7 +88,11 @@ if (is_mac) {
}
if (is_win) {
angle_system_utils_sources += [ "src/common/system_utils_win.cpp" ]
if (current_os == "winuwp") {
angle_system_utils_sources += [ "src/common/system_utils_winuwp.cpp" ]
} else {
angle_system_utils_sources += [ "src/common/system_utils_win.cpp" ]
}
}
libangle_image_util_sources = [
@@ -669,7 +673,7 @@ libangle_d3d11_win32_sources = [
"src/third_party/systeminfo/SystemInfo.h",
]
libangle_d3d11_winrt_sources = [
libangle_d3d11_winuwp_sources = [
"src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp",
"src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h",
"src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp",

View File

@@ -37,7 +37,9 @@ util_win_sources = [
"util/windows/WGLWindow.h",
]
util_win_shared_sources = [ "util/windows/WGLWindow.cpp" ]
if (current_os != "winuwp") {
util_win_shared_sources = [ "util/windows/WGLWindow.cpp" ]
}
util_posix_sources = [
"util/posix/Posix_crash_handler.cpp",

View File

@@ -13,9 +13,9 @@
#if defined(ANGLE_USE_UTIL_LOADER)
# include "util/egl_loader_autogen.h"
# include "util/gles_loader_autogen.h"
# if defined(ANGLE_PLATFORM_WINDOWS)
# if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
# include "util/windows/wgl_loader_autogen.h"
# endif // defined(ANGLE_PLATFORM_WINDOWS)
# endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
#else
# if !defined(GL_GLES_PROTOTYPES)