Commit 11dc1635 by Austin Kinross Committed by Commit Bot

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: 's avatarJamie Madill <jmadill@chromium.org>
parent dd4a00a0
...@@ -25,9 +25,13 @@ declare_args() { ...@@ -25,9 +25,13 @@ declare_args() {
# Defaults to capture building to $root_out_dir/angle_libs/with_capture. # Defaults to capture building to $root_out_dir/angle_libs/with_capture.
# Switch on to build capture to $root_out_dir. # Switch on to build capture to $root_out_dir.
angle_with_capture_by_default = false 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") { group("all") {
testonly = true testonly = true
deps = [ deps = [
...@@ -139,6 +143,10 @@ config("extra_warnings") { ...@@ -139,6 +143,10 @@ config("extra_warnings") {
"-Wshorten-64-to-32", "-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. # This config adds build-ids to the associated library.
...@@ -222,7 +230,7 @@ config("angle_common_config") { ...@@ -222,7 +230,7 @@ config("angle_common_config") {
} }
} }
if (is_win) { if (is_win && !angle_is_winuwp) {
angle_source_set("angle_stack_walker") { angle_source_set("angle_stack_walker") {
sources = [ sources = [
"util/windows/third_party/StackWalker/src/StackWalker.cpp", "util/windows/third_party/StackWalker/src/StackWalker.cpp",
...@@ -338,7 +346,9 @@ angle_static_library("angle_gpu_info_util") { ...@@ -338,7 +346,9 @@ angle_static_library("angle_gpu_info_util") {
if (is_win) { if (is_win) {
sources += libangle_gpu_info_util_win_sources sources += libangle_gpu_info_util_win_sources
libs += [ "setupapi.lib" ] if (!angle_is_winuwp) {
libs += [ "setupapi.lib" ]
}
libs += [ "dxgi.lib" ] libs += [ "dxgi.lib" ]
} }
...@@ -622,7 +632,13 @@ angle_source_set("libANGLE_base") { ...@@ -622,7 +632,13 @@ angle_source_set("libANGLE_base") {
if (angle_enable_d3d11) { if (angle_enable_d3d11) {
sources += libangle_d3d11_sources 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" ] libs += [ "dxguid.lib" ]
import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni") import("src/libANGLE/renderer/d3d/d3d11/d3d11_blit_shaders_autogen.gni")
sources += libangle_d3d11_blit_shaders sources += libangle_d3d11_blit_shaders
...@@ -852,7 +868,7 @@ angle_libGLESv2("libGLESv2_capture_complement") { ...@@ -852,7 +868,7 @@ angle_libGLESv2("libGLESv2_capture_complement") {
} }
} }
if (is_win) { if (is_win && !angle_is_winuwp) {
angle_shared_library("libGL") { angle_shared_library("libGL") {
sources = libgl_sources sources = libgl_sources
...@@ -1006,7 +1022,7 @@ angle_source_set("angle_util_loader_headers") { ...@@ -1006,7 +1022,7 @@ angle_source_set("angle_util_loader_headers") {
"util/util_export.h", "util/util_export.h",
] ]
if (is_win) { if (is_win && !angle_is_winuwp) {
sources += [ "util/windows/wgl_loader_autogen.h" ] sources += [ "util/windows/wgl_loader_autogen.h" ]
} }
...@@ -1023,7 +1039,7 @@ angle_source_set("angle_util_loader") { ...@@ -1023,7 +1039,7 @@ angle_source_set("angle_util_loader") {
"util/gles_loader_autogen.cpp", "util/gles_loader_autogen.cpp",
] ]
if (is_win) { if (is_win && !angle_is_winuwp) {
sources += [ "util/windows/wgl_loader_autogen.cpp" ] sources += [ "util/windows/wgl_loader_autogen.cpp" ]
} }
...@@ -1069,7 +1085,7 @@ foreach(is_shared_library, ...@@ -1069,7 +1085,7 @@ foreach(is_shared_library,
public_deps = [] public_deps = []
libs = [] libs = []
if (is_win) { if (is_win && !angle_is_winuwp) {
sources += util_win_sources sources += util_win_sources
deps += [ ":angle_stack_walker" ] deps += [ ":angle_stack_walker" ]
} }
...@@ -1129,7 +1145,7 @@ foreach(is_shared_library, ...@@ -1129,7 +1145,7 @@ foreach(is_shared_library,
if (is_shared_library) { if (is_shared_library) {
defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ]
if (is_win) { if (is_win && !angle_is_winuwp) {
sources += util_win_shared_sources sources += util_win_shared_sources
} }
......
...@@ -66,6 +66,8 @@ is_debug = true (enable debugging, true is the default) ...@@ -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`. 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`. For more information on GN run `gn help`.
Ninja can be used to compile on all platforms with one of the following commands: Ninja can be used to compile on all platforms with one of the following commands:
......
...@@ -47,6 +47,9 @@ declare_args() { ...@@ -47,6 +47,9 @@ declare_args() {
} }
angle_shared_libvulkan = false 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 # Default to using "_angle" suffix on Android
if (is_android) { if (is_android) {
angle_libs_suffix = "_angle" angle_libs_suffix = "_angle"
...@@ -56,16 +59,18 @@ declare_args() { ...@@ -56,16 +59,18 @@ declare_args() {
} }
declare_args() { declare_args() {
angle_enable_d3d9 = is_win angle_enable_d3d9 = is_win && !angle_is_winuwp
angle_enable_d3d11 = is_win angle_enable_d3d11 = is_win
angle_enable_gl = (ozone_platform_gbm || !is_linux || angle_enable_gl =
(use_x11 && !is_chromeos)) && !is_fuchsia (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 # ANGLE Vulkan backend on Android requires API level 26, i.e. Oreo, due to
# Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714. # Vulkan Validation Layers compatibility issues, see http://crrev/c/1405714.
# Otherwise, API level 24 would have been enough. # Otherwise, API level 24 would have been enough.
angle_enable_vulkan = is_win || (is_linux && use_x11 && !is_chromeos) || angle_enable_vulkan =
(is_android && ndk_api_level_at_least_26) || is_fuchsia (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_null = true
angle_enable_essl = true angle_enable_essl = true
angle_enable_glsl = true angle_enable_glsl = true
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
# include <windows.h> # include <windows.h>
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) # if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
# define ANGLE_ENABLE_WINDOWS_STORE 1 # define ANGLE_ENABLE_WINDOWS_UWP 1
# endif # endif
# if defined(ANGLE_ENABLE_D3D9) # if defined(ANGLE_ENABLE_D3D9)
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
# include <wrl.h> # include <wrl.h>
# endif # endif
# if defined(ANGLE_ENABLE_WINDOWS_STORE) # if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <dxgi1_3.h> # include <dxgi1_3.h>
# if defined(_DEBUG) # if defined(_DEBUG)
# include <DXProgrammableCapture.h> # include <DXProgrammableCapture.h>
......
//
// 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
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <assert.h> #include <assert.h>
#ifdef ANGLE_ENABLE_WINDOWS_STORE #ifdef ANGLE_ENABLE_WINDOWS_UWP
# include <map> # include <map>
# include <mutex> # include <mutex>
# include <set> # include <set>
...@@ -39,7 +39,7 @@ TLSIndex CreateTLSIndex() ...@@ -39,7 +39,7 @@ TLSIndex CreateTLSIndex()
TLSIndex index; TLSIndex index;
#ifdef ANGLE_PLATFORM_WINDOWS #ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE # ifdef ANGLE_ENABLE_WINDOWS_UWP
if (!freeTlsIndices.empty()) if (!freeTlsIndices.empty())
{ {
DWORD result = freeTlsIndices.back(); DWORD result = freeTlsIndices.back();
...@@ -76,7 +76,7 @@ bool DestroyTLSIndex(TLSIndex index) ...@@ -76,7 +76,7 @@ bool DestroyTLSIndex(TLSIndex index)
} }
#ifdef ANGLE_PLATFORM_WINDOWS #ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE # ifdef ANGLE_ENABLE_WINDOWS_UWP
assert(index < nextTlsIndex); assert(index < nextTlsIndex);
assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end()); assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
...@@ -106,7 +106,7 @@ bool SetTLSValue(TLSIndex index, void *value) ...@@ -106,7 +106,7 @@ bool SetTLSValue(TLSIndex index, void *value)
} }
#ifdef ANGLE_PLATFORM_WINDOWS #ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE # ifdef ANGLE_ENABLE_WINDOWS_UWP
ThreadLocalData *threadData = currentThreadData; ThreadLocalData *threadData = currentThreadData;
if (!threadData) if (!threadData)
{ {
...@@ -138,7 +138,7 @@ void *GetTLSValue(TLSIndex index) ...@@ -138,7 +138,7 @@ void *GetTLSValue(TLSIndex index)
} }
#ifdef ANGLE_PLATFORM_WINDOWS #ifdef ANGLE_PLATFORM_WINDOWS
# ifdef ANGLE_ENABLE_WINDOWS_STORE # ifdef ANGLE_ENABLE_WINDOWS_UWP
ThreadLocalData *threadData = currentThreadData; ThreadLocalData *threadData = currentThreadData;
if (threadData && threadData->size() > index) if (threadData && threadData->size() > index)
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#ifdef ANGLE_PLATFORM_WINDOWS #ifdef ANGLE_PLATFORM_WINDOWS
// TLS does not exist for Windows Store and needs to be emulated // 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 # ifndef TLS_OUT_OF_INDEXES
# define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF) # define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF)
# endif # endif
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <set> #include <set>
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <windows.applicationmodel.core.h> # include <windows.applicationmodel.core.h>
# include <windows.graphics.display.h> # include <windows.graphics.display.h>
# include <wrl.h> # include <wrl.h>
...@@ -1078,7 +1078,7 @@ EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle) ...@@ -1078,7 +1078,7 @@ EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle)
} // namespace gl_egl } // namespace gl_egl
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
std::string getTempPath() std::string getTempPath()
{ {
# ifdef ANGLE_PLATFORM_WINDOWS # ifdef ANGLE_PLATFORM_WINDOWS
...@@ -1116,7 +1116,7 @@ void writeFile(const char *path, const void *content, size_t size) ...@@ -1116,7 +1116,7 @@ void writeFile(const char *path, const void *content, size_t size)
fwrite(content, sizeof(char), size, file); fwrite(content, sizeof(char), size, file);
fclose(file); fclose(file);
} }
#endif // !ANGLE_ENABLE_WINDOWS_STORE #endif // !ANGLE_ENABLE_WINDOWS_UWP
#if defined(ANGLE_PLATFORM_WINDOWS) #if defined(ANGLE_PLATFORM_WINDOWS)
......
...@@ -245,7 +245,7 @@ EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType); ...@@ -245,7 +245,7 @@ EGLenum GLComponentTypeToEGLColorComponentType(GLenum glComponentType);
EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle); EGLClientBuffer GLObjectHandleToEGLClientBuffer(GLuint handle);
} // namespace gl_egl } // namespace gl_egl
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
std::string getTempPath(); std::string getTempPath();
void writeFile(const char *path, const void *data, size_t size); void writeFile(const char *path, const void *data, size_t size);
#endif #endif
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
// Windows.h needs to be included first // Windows.h needs to be included first
#include <windows.h> #include <windows.h>
#include <d3d10.h>
#include <dxgi.h> #include <dxgi.h>
#include <array> #include <array>
...@@ -28,11 +27,20 @@ namespace ...@@ -28,11 +27,20 @@ namespace
bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices) 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; IDXGIFactory *factory;
if (!SUCCEEDED(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&factory)))) if (!SUCCEEDED(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&factory))))
{ {
return false; return false;
} }
#endif
UINT i = 0; UINT i = 0;
IDXGIAdapter *adapter = nullptr; IDXGIAdapter *adapter = nullptr;
...@@ -42,7 +50,7 @@ bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices) ...@@ -42,7 +50,7 @@ bool GetDevicesFromDXGI(std::vector<GPUDeviceInfo> *devices)
adapter->GetDesc(&desc); adapter->GetDesc(&desc);
LARGE_INTEGER umdVersion; LARGE_INTEGER umdVersion;
if (adapter->CheckInterfaceSupport(__uuidof(ID3D10Device), &umdVersion) == if (adapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &umdVersion) ==
DXGI_ERROR_UNSUPPORTED) DXGI_ERROR_UNSUPPORTED)
{ {
adapter->Release(); adapter->Release();
...@@ -95,9 +103,11 @@ bool GetSystemInfo(SystemInfo *info) ...@@ -95,9 +103,11 @@ bool GetSystemInfo(SystemInfo *info)
// can override the heuristic to find the active GPU // can override the heuristic to find the active GPU
info->activeGPUIndex = 0; info->activeGPUIndex = 0;
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
// Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled. // Override isOptimus. nvd3d9wrap.dll is loaded into all processes when Optimus is enabled.
HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll"); HMODULE nvd3d9wrap = GetModuleHandleW(L"nvd3d9wrap.dll");
info->isOptimus = nvd3d9wrap != nullptr; info->isOptimus = nvd3d9wrap != nullptr;
#endif
return true; return true;
} }
......
...@@ -1368,7 +1368,7 @@ bool Display::isValidNativeDisplay(EGLNativeDisplayType display) ...@@ -1368,7 +1368,7 @@ bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
return true; 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 || if (display == EGL_SOFTWARE_DISPLAY_ANGLE || display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
display == EGL_D3D11_ONLY_DISPLAY_ANGLE) display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
{ {
......
...@@ -53,8 +53,9 @@ ...@@ -53,8 +53,9 @@
#endif #endif
// Controls if our threading code uses std::async or falls back to single-threaded operations. // 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 # 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_ #endif // LIBANGLE_FEATURES_H_
...@@ -121,7 +121,7 @@ angle::Result HLSLCompiler::ensureInitialized(d3d::Context *context) ...@@ -121,7 +121,7 @@ angle::Result HLSLCompiler::ensureInitialized(d3d::Context *context)
} }
ANGLE_TRACE_EVENT0("gpu.angle", "HLSLCompiler::initialize"); 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) # if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
// Find a D3DCompiler module that had already been loaded based on a predefined list of // Find a D3DCompiler module that had already been loaded based on a predefined list of
// versions. // versions.
...@@ -214,12 +214,12 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context, ...@@ -214,12 +214,12 @@ angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
{ {
ASSERT(mInitialized); ASSERT(mInitialized);
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
ASSERT(mD3DCompilerModule); ASSERT(mD3DCompilerModule);
#endif #endif
ASSERT(mD3DCompileFunc); 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::string sourcePath = getTempPath();
std::ostringstream stream; std::ostringstream stream;
stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl; stream << "#line 2 \"" << sourcePath << "\"\n\n" << hlsl;
......
...@@ -240,7 +240,9 @@ GLenum DefaultGLErrorCode(HRESULT hr) ...@@ -240,7 +240,9 @@ GLenum DefaultGLErrorCode(HRESULT hr)
{ {
switch (hr) switch (hr)
{ {
#ifdef ANGLE_ENABLE_D3D9
case D3DERR_OUTOFVIDEOMEMORY: case D3DERR_OUTOFVIDEOMEMORY:
#endif
case E_OUTOFMEMORY: case E_OUTOFMEMORY:
return GL_OUT_OF_MEMORY; return GL_OUT_OF_MEMORY;
default: default:
......
...@@ -252,7 +252,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderD3D::compile(const gl::Context *cont ...@@ -252,7 +252,7 @@ std::shared_ptr<WaitableCompileEvent> ShaderD3D::compile(const gl::Context *cont
const std::string &source = mData.getSource(); const std::string &source = mData.getSource();
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
if (gl::DebugAnnotationsActive()) if (gl::DebugAnnotationsActive())
{ {
sourcePath = getTempPath(); sourcePath = getTempPath();
......
...@@ -67,12 +67,14 @@ bool DebugAnnotator11::loggingEnabledForThisThread() const ...@@ -67,12 +67,14 @@ bool DebugAnnotator11::loggingEnabledForThisThread() const
void DebugAnnotator11::initialize(ID3D11DeviceContext *context) void DebugAnnotator11::initialize(ID3D11DeviceContext *context)
{ {
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
// ID3DUserDefinedAnnotation.GetStatus only works on Windows10 or greater. // ID3DUserDefinedAnnotation.GetStatus only works on Windows10 or greater.
// Returning true unconditionally from DebugAnnotator11::getStatus() means // Returning true unconditionally from DebugAnnotator11::getStatus() means
// writing out all compiled shaders to temporary files even if debugging // writing out all compiled shaders to temporary files even if debugging
// tools are not attached. See rx::ShaderD3D::prepareSourceAndReturnOptions. // tools are not attached. See rx::ShaderD3D::prepareSourceAndReturnOptions.
// If you want debug annotations, you must use Windows 10. // If you want debug annotations, you must use Windows 10.
if (IsWindows10OrGreater()) if (IsWindows10OrGreater())
#endif
{ {
mAnnotationThread = std::this_thread::get_id(); mAnnotationThread = std::this_thread::get_id();
mUserDefinedAnnotation.Attach( mUserDefinedAnnotation.Attach(
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#include "libANGLE/renderer/renderer_utils.h" #include "libANGLE/renderer/renderer_utils.h"
#include "libANGLE/trace.h" #include "libANGLE/trace.h"
#ifdef ANGLE_ENABLE_WINDOWS_STORE #ifdef ANGLE_ENABLE_WINDOWS_UWP
# include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h" # include "libANGLE/renderer/d3d/d3d11/winrt/NativeWindow11WinRT.h"
#else #else
# include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h" # include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
...@@ -513,7 +513,7 @@ egl::Error Renderer11::initialize() ...@@ -513,7 +513,7 @@ egl::Error Renderer11::initialize()
ANGLE_TRY(initializeD3DDevice()); ANGLE_TRY(initializeD3DDevice());
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
# if !ANGLE_SKIP_DXGI_1_2_CHECK # if !ANGLE_SKIP_DXGI_1_2_CHECK
{ {
ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (DXGICheck)"); ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (DXGICheck)");
...@@ -674,7 +674,7 @@ egl::Error Renderer11::initializeD3DDevice() ...@@ -674,7 +674,7 @@ egl::Error Renderer11::initializeD3DDevice()
if (!mCreatedWithDeviceEXT) if (!mCreatedWithDeviceEXT)
{ {
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = nullptr; PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = nullptr;
{ {
ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (Load DLLs)"); ANGLE_TRACE_EVENT0("gpu.angle", "Renderer11::initialize (Load DLLs)");
...@@ -1140,11 +1140,13 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions ...@@ -1140,11 +1140,13 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions
// All D3D feature levels support robust resource init // All D3D feature levels support robust resource init
outExtensions->robustResourceInitialization = true; outExtensions->robustResourceInitialization = true;
#if !defined(ANGLE_ENABLE_WINDOWS_UWP)
// Compositor Native Window capabilies require WinVer >= 1803 // Compositor Native Window capabilies require WinVer >= 1803
if (CompositorNativeWindow11::IsSupportedWinRelease()) if (CompositorNativeWindow11::IsSupportedWinRelease())
{ {
outExtensions->windowsUIComposition = true; outExtensions->windowsUIComposition = true;
} }
#endif
} }
angle::Result Renderer11::flush(Context11 *context11) angle::Result Renderer11::flush(Context11 *context11)
...@@ -1202,7 +1204,7 @@ bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const ...@@ -1202,7 +1204,7 @@ bool Renderer11::isValidNativeWindow(EGLNativeWindowType window) const
static_assert(sizeof(ABI::Windows::UI::Composition::SpriteVisual *) == sizeof(HWND), static_assert(sizeof(ABI::Windows::UI::Composition::SpriteVisual *) == sizeof(HWND),
"Pointer size must match Window Handle size"); "Pointer size must match Window Handle size");
#ifdef ANGLE_ENABLE_WINDOWS_STORE #if defined(ANGLE_ENABLE_WINDOWS_UWP)
return NativeWindow11WinRT::IsValidNativeWindow(window); return NativeWindow11WinRT::IsValidNativeWindow(window);
#else #else
if (NativeWindow11Win32::IsValidNativeWindow(window)) if (NativeWindow11Win32::IsValidNativeWindow(window))
...@@ -1218,6 +1220,9 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window, ...@@ -1218,6 +1220,9 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
const egl::Config *config, const egl::Config *config,
const egl::AttributeMap &attribs) const 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); auto useWinUiComp = window != nullptr && !NativeWindow11Win32::IsValidNativeWindow(window);
if (useWinUiComp) if (useWinUiComp)
...@@ -1226,15 +1231,11 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window, ...@@ -1226,15 +1231,11 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
} }
else else
{ {
#ifdef ANGLE_ENABLE_WINDOWS_STORE
UNUSED_VARIABLE(attribs);
return new NativeWindow11WinRT(window, config->alphaSize > 0);
#else
return new NativeWindow11Win32( return new NativeWindow11Win32(
window, config->alphaSize > 0, window, config->alphaSize > 0,
attribs.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE); attribs.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE);
#endif
} }
#endif
} }
egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration, egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration,
...@@ -2109,14 +2110,14 @@ bool Renderer11::getShareHandleSupport() const ...@@ -2109,14 +2110,14 @@ bool Renderer11::getShareHandleSupport() const
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP) if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
{ {
#ifndef ANGLE_ENABLE_WINDOWS_STORE #if !defined(ANGLE_ENABLE_WINDOWS_UWP)
if (!IsWindows8OrGreater()) if (!IsWindows8OrGreater())
{ {
// WARP on Windows 7 doesn't support shared handles // WARP on Windows 7 doesn't support shared handles
mSupportsShareHandles = false; mSupportsShareHandles = false;
return 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 // 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, // TODO: allow applications to query for HARDWARE or WARP-specific share handles,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.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 <windows.applicationmodel.core.h>
# include <wrl.h> # include <wrl.h>
# include <wrl/wrappers/corewrappers.h> # include <wrl/wrappers/corewrappers.h>
...@@ -44,7 +44,7 @@ void Trim11::trim() ...@@ -44,7 +44,7 @@ void Trim11::trim()
return; return;
} }
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
ID3D11Device *device = mRenderer->getDevice(); ID3D11Device *device = mRenderer->getDevice();
IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject<IDXGIDevice3>(device); IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject<IDXGIDevice3>(device);
if (dxgiDevice3) if (dxgiDevice3)
...@@ -57,7 +57,7 @@ void Trim11::trim() ...@@ -57,7 +57,7 @@ void Trim11::trim()
bool Trim11::registerForRendererTrimRequest() bool Trim11::registerForRendererTrimRequest()
{ {
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
ICoreApplication *coreApplication = nullptr; ICoreApplication *coreApplication = nullptr;
HRESULT result = GetActivationFactory( HRESULT result = GetActivationFactory(
HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(),
...@@ -84,7 +84,7 @@ bool Trim11::registerForRendererTrimRequest() ...@@ -84,7 +84,7 @@ bool Trim11::registerForRendererTrimRequest()
void Trim11::unregisterForRendererTrimRequest() void Trim11::unregisterForRendererTrimRequest()
{ {
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
if (mApplicationSuspendedEventToken.value != 0) if (mApplicationSuspendedEventToken.value != 0)
{ {
ICoreApplication *coreApplication = nullptr; ICoreApplication *coreApplication = nullptr;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "libANGLE/Error.h" #include "libANGLE/Error.h"
#include "libANGLE/angletypes.h" #include "libANGLE/angletypes.h"
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
# include <EventToken.h> # include <EventToken.h>
#endif #endif
...@@ -29,7 +29,7 @@ class Trim11 : angle::NonCopyable ...@@ -29,7 +29,7 @@ class Trim11 : angle::NonCopyable
private: private:
Renderer11 *mRenderer; Renderer11 *mRenderer;
#if defined(ANGLE_ENABLE_WINDOWS_STORE) #if defined(ANGLE_ENABLE_WINDOWS_UWP)
EventRegistrationToken mApplicationSuspendedEventToken; EventRegistrationToken mApplicationSuspendedEventToken;
#endif #endif
......
...@@ -1693,7 +1693,7 @@ void GenerateCaps(ID3D11Device *device, ...@@ -1693,7 +1693,7 @@ void GenerateCaps(ID3D11Device *device,
// D3D11 does not support vertex attribute aliasing // D3D11 does not support vertex attribute aliasing
limitations->noVertexAttributeAliasing = true; 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 // 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 // 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 // maintain consistency across all Windows devices. We allow non-zero divisors on attribute zero
......
...@@ -49,11 +49,15 @@ class CoreWindowNativeWindow : public InspectableNativeWindow, ...@@ -49,11 +49,15 @@ class CoreWindowNativeWindow : public InspectableNativeWindow,
ComPtr<IMap<HSTRING, IInspectable *>> mPropertyMap; 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< : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
IWindowSizeChangedEventHandler> IWindowSizeChangedEventHandler>
{ {
// clang-format on
public: public:
CoreWindowSizeChangedHandler() {} CoreWindowSizeChangedHandler() {}
HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host) HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
......
...@@ -88,8 +88,15 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device, ...@@ -88,8 +88,15 @@ HRESULT NativeWindow11WinRT::createSwapChain(ID3D11Device *device,
DXGI_FORMAT format, DXGI_FORMAT format,
UINT width, UINT width,
UINT height, UINT height,
UINT samples,
IDXGISwapChain **swapChain) IDXGISwapChain **swapChain)
{ {
if (samples > 1)
{
// Multisample not implemented for WinRT window types
return E_NOTIMPL;
}
if (mImpl) if (mImpl)
{ {
IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory); IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory);
......
...@@ -34,6 +34,7 @@ class NativeWindow11WinRT : public NativeWindow11 ...@@ -34,6 +34,7 @@ class NativeWindow11WinRT : public NativeWindow11
DXGI_FORMAT format, DXGI_FORMAT format,
UINT width, UINT width,
UINT height, UINT height,
UINT samples,
IDXGISwapChain **swapChain) override; IDXGISwapChain **swapChain) override;
void commitChange() override; void commitChange() override;
......
...@@ -43,11 +43,15 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow, ...@@ -43,11 +43,15 @@ class SwapChainPanelNativeWindow : public InspectableNativeWindow,
ComPtr<IDXGISwapChain1> mSwapChain; 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< : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
ABI::Windows::UI::Xaml::ISizeChangedEventHandler> ABI::Windows::UI::Xaml::ISizeChangedEventHandler>
{ {
// clang-format on
public: public:
SwapChainPanelSizeChangedHandler() {} SwapChainPanelSizeChangedHandler() {}
HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host) HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
......
...@@ -88,7 +88,11 @@ if (is_mac) { ...@@ -88,7 +88,11 @@ if (is_mac) {
} }
if (is_win) { 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 = [ libangle_image_util_sources = [
...@@ -669,7 +673,7 @@ libangle_d3d11_win32_sources = [ ...@@ -669,7 +673,7 @@ libangle_d3d11_win32_sources = [
"src/third_party/systeminfo/SystemInfo.h", "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.cpp",
"src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h", "src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h",
"src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp", "src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp",
......
...@@ -37,7 +37,9 @@ util_win_sources = [ ...@@ -37,7 +37,9 @@ util_win_sources = [
"util/windows/WGLWindow.h", "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_sources = [
"util/posix/Posix_crash_handler.cpp", "util/posix/Posix_crash_handler.cpp",
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#if defined(ANGLE_USE_UTIL_LOADER) #if defined(ANGLE_USE_UTIL_LOADER)
# include "util/egl_loader_autogen.h" # include "util/egl_loader_autogen.h"
# include "util/gles_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" # include "util/windows/wgl_loader_autogen.h"
# endif // defined(ANGLE_PLATFORM_WINDOWS) # endif // defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
#else #else
# if !defined(GL_GLES_PROTOTYPES) # if !defined(GL_GLES_PROTOTYPES)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment