Skip to content

[angle] Update to chromium_7258, add metal support, fix Linux/Windows build #46841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions ports/angle/001-fix-builder-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/src/gpu_info_util/SystemInfo_win.cpp b/src/gpu_info_util/SystemInfo_win.cpp
index f4bb137f2..86495013b 100644
--- a/src/gpu_info_util/SystemInfo_win.cpp
+++ b/src/gpu_info_util/SystemInfo_win.cpp
@@ -6,11 +6,6 @@

// SystemInfo_win.cpp: implementation of the Windows-specific parts of SystemInfo.h

-#include "gpu_info_util/SystemInfo_internal.h"
-
-#include "common/debug.h"
-#include "common/string_utils.h"
-
// Windows.h needs to be included first
#include <windows.h>

@@ -19,6 +14,11 @@
#include <array>
#include <sstream>

+#include "gpu_info_util/SystemInfo_internal.h"
+
+#include "common/debug.h"
+#include "common/string_utils.h"
+
namespace angle
{

2 changes: 2 additions & 0 deletions ports/angle/ANGLEShaderProgramVersion.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#cmakedefine ANGLE_PROGRAM_VERSION "@ANGLE_PROGRAM_VERSION@"
#cmakedefine ANGLE_PROGRAM_VERSION_HASH_SIZE @ANGLE_PROGRAM_VERSION_HASH_SIZE@
8 changes: 4 additions & 4 deletions ports/angle/angle_commit.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#cmakedefine ANGLE_COMMIT_HASH "@ANGLE_COMMIT_HASH@"
#cmakedefine ANGLE_COMMIT_HASH_SIZE @ANGLE_COMMIT_HASH_SIZE@
#cmakedefine ANGLE_COMMIT_DATE "@ANGLE_COMMIT_DATE@"
#cmakedefine ANGLE_REVISION @ANGLE_REVISION@
#cmakedefine ANGLE_COMMIT_HASH "@ANGLE_COMMIT_HASH@"
#cmakedefine ANGLE_COMMIT_HASH_SIZE @ANGLE_COMMIT_HASH_SIZE@
#cmakedefine ANGLE_COMMIT_DATE "@ANGLE_COMMIT_DATE@"
#cmakedefine ANGLE_REVISION @ANGLE_REVISION@
24 changes: 2 additions & 22 deletions ports/angle/cmake-buildsystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include(WebKitCommon-minimal)
set(ANGLE_FRAMEWORK_HEADERS_DIR "${CMAKE_BINARY_DIR}/ANGLE/headers")

set(USE_ANGLE_EGL ON)
if (NOT WINDOWS_STORE)
if (NOT WINDOWS_STORE AND NOT USE_METAL)
set(USE_OPENGL ON)
endif()

Expand Down Expand Up @@ -106,9 +106,6 @@ elseif (WIN32)
set(angle_enable_d3d11 TRUE)
elseif (UNIX)
set(is_linux TRUE)
if(LINUX)
set(angle_use_x11 TRUE)
endif()
endif ()
# VCPKG EDIT: end vcpkg modified block

Expand Down Expand Up @@ -235,13 +232,6 @@ set(angle_gl_enum_utils # VCPKG EDIT: Update paths
"src/common/gl_enum_utils_autogen.h"
)

set(angle_glslang_wrapper
"src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.cpp"
"src/libANGLE/renderer/ShaderInterfaceVariableInfoMap.h"
"src/libANGLE/renderer/glslang_wrapper_utils.cpp"
"src/libANGLE/renderer/glslang_wrapper_utils.h"
)

WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()

add_subdirectory(include)
Expand Down Expand Up @@ -271,6 +261,7 @@ if (USE_ANGLE_EGL OR ENABLE_WEBGL)
target_compile_definitions(ANGLEFramework INTERFACE ${gl_prototypes})

add_library(GLESv2 ${GLESv2_LIBRARY_TYPE}
${libglesv2_entry_point_sources}
${libglesv2_sources}
)
target_include_directories(GLESv2 PRIVATE ${ANGLE_PRIVATE_INCLUDE_DIRECTORIES})
Expand Down Expand Up @@ -391,16 +382,6 @@ add_library(ANGLE::ANGLE ALIAS ANGLEFramework)
#### VCPKG EDIT:
#### various vcpkg additions and install commands

# X11 support
if (angle_use_x11)
find_package(X11 COMPONENTS Xext Xi REQUIRED)
target_include_directories(ANGLE PRIVATE ${X11_INCLUDE_DIR})
target_sources(ANGLE PRIVATE ${libangle_gpu_info_util_x11_sources})
target_sources(ANGLE PRIVATE "src/gpu_info_util/SystemInfo_x11.cpp")
target_compile_definitions(ANGLE PRIVATE ANGLE_USE_X11 GPU_INFO_USE_X11)
target_link_libraries(ANGLE PRIVATE ${X11_LIBRARIES} X11::X11 X11::Xi X11::Xext)
endif()

# set export names of some targets to match prior vcpkg port buildsystem
if(TARGET EGL)
set_target_properties(EGL PROPERTIES EXPORT_NAME libEGL)
Expand All @@ -414,7 +395,6 @@ set(_possibleTargets EGL GLESv2 ANGLE)
foreach(_target IN LISTS _possibleTargets)
if(TARGET ${_target})
list(APPEND _installableTargets "${_target}")
target_include_directories(${_target} INTERFACE $<INSTALL_INTERFACE:include>)
endif()
endforeach()

Expand Down
2 changes: 1 addition & 1 deletion ports/angle/cmake-buildsystem/PlatformLinux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif ()

if (USE_ANGLE_EGL OR ENABLE_WEBGL)
list(APPEND ANGLE_SOURCES
${_gl_backend_sources}
${gl_backend_sources}

${angle_system_utils_sources_linux}
${angle_system_utils_sources_posix}
Expand Down
15 changes: 7 additions & 8 deletions ports/angle/cmake-buildsystem/PlatformMac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ list(APPEND ANGLEGLESv2_LIBRARIES
# Metal backend
if(USE_METAL)
list(APPEND ANGLE_SOURCES
${_metal_backend_sources}
${metal_backend_sources}

${angle_translator_lib_metal_sources}
${angle_glslang_wrapper}
${angle_translator_lib_msl_sources}

${angle_translator_glsl_apple_sources}
)

list(APPEND ANGLE_DEFINITIONS
Expand All @@ -38,15 +38,14 @@ if(USE_OPENGL)
list(APPEND ANGLE_SOURCES
${angle_translator_glsl_base_sources}
${angle_translator_glsl_sources}
${angle_translator_apple_sources}
)
# Enable GLSL compiler output.
list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL ANGLE_ENABLE_GL_DESKTOP_BACKEND ANGLE_ENABLE_APPLE_WORKAROUNDS)
list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_GLSL ANGLE_ENABLE_GL_DESKTOP_BACKEND ANGLE_ENABLE_APPLE_WORKAROUNDS ANGLE_ENABLE_CGL)
endif()

if(USE_ANGLE_EGL OR ENABLE_WEBGL)
if(USE_OPENGL OR ENABLE_WEBGL)
list(APPEND ANGLE_SOURCES
${_gl_backend_sources}
${gl_backend_sources}

${libangle_gl_egl_dl_sources}
${libangle_gl_egl_sources}
Expand Down
11 changes: 6 additions & 5 deletions ports/angle/cmake-buildsystem/PlatformWin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ list(APPEND ANGLE_DEFINITIONS

# We're targeting Windows 10 which will have DirectX 11
list(APPEND ANGLE_SOURCES
${_d3d11_backend_sources}
${_d3d_shared_sources}
${d3d11_backend_sources}
${d3d_shared_sources}

${angle_translator_hlsl_sources}

Expand All @@ -25,11 +25,12 @@ list(APPEND ANGLE_DEFINITIONS
"-DANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ \"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }"
)

list(APPEND ANGLEGLESv2_LIBRARIES dxguid dxgi)
# https://issues.angleproject.org/issues/345274916
list(APPEND ANGLEGLESv2_LIBRARIES dxguid dxgi synchronization)

if(NOT angle_is_winuwp) # vcpkg EDIT: Exclude DirectX 9 on UWP
# DirectX 9 support should be optional but ANGLE will not compile without it
list(APPEND ANGLE_SOURCES ${_d3d9_backend_sources})
list(APPEND ANGLE_SOURCES ${d3d9_backend_sources})
list(APPEND ANGLE_DEFINITIONS ANGLE_ENABLE_D3D9)
list(APPEND ANGLEGLESv2_LIBRARIES d3d9)
endif()
Expand All @@ -52,7 +53,7 @@ if(USE_OPENGL)

if(USE_ANGLE_EGL OR ENABLE_WEBGL)
list(APPEND ANGLE_SOURCES
${_gl_backend_sources}
${gl_backend_sources}

${libangle_gl_egl_dl_sources}
${libangle_gl_egl_sources}
Expand Down
52 changes: 33 additions & 19 deletions ports/angle/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if (VCPKG_TARGET_IS_LINUX)
message(WARNING "Building with a gcc version less than 6.1 is not supported.")
message(WARNING "${PORT} currently requires the following libraries from the system package manager:\n libx11-dev\n mesa-common-dev\n libxi-dev\n libxext-dev\n\nThese can be installed on Ubuntu systems via apt-get install libx11-dev mesa-common-dev libxi-dev libxext-dev.")
message(WARNING "${PORT} currently requires the following libraries from the system package manager:\n mesa-common-dev\n\nThese can be installed on Ubuntu systems via apt-get install mesa-common-dev.")
endif()

if (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
Expand Down Expand Up @@ -30,11 +30,16 @@ else()
set(ANGLE_BUILDSYSTEM_PORT "Linux")
endif()

# chromium/5414
set(ANGLE_COMMIT aa63ea230e0c507e7b4b164a30e502fb17168c17)
set(ANGLE_VERSION 5414)
set(ANGLE_SHA512 a3b55d4b484e1e9ece515d60af1d47a80a0576b198d9a2397e4e68b16efd83468dcdfadc98dae57ff17f01d02d74526f8b59fdf00661b70a45b6dd266e5ffe38)
set(ANGLE_THIRDPARTY_ZLIB_COMMIT 44d9b490c721abdb923d5c6c23ac211e45ffb1a5)
set(USE_METAL OFF)
if ("metal" IN_LIST FEATURES)
set(USE_METAL ON)
endif()

# chromium/7258
set(ANGLE_COMMIT 79ac1a8cd767a32cce6401203e20c4bd4ca4d539)
set(ANGLE_VERSION 7258)
set(ANGLE_SHA512 a3d5d09460f05f1f1c081411bf15f585bb8add5f3db7c4854dc2cf2ef1fd22dd5b2dd5d3de78bfb8bcdae8459dd9581f7dce331acd34053c87c84cfe6c3d134c)
set(ANGLE_THIRDPARTY_ZLIB_COMMIT 4028ebf8710ee39d2286cb0f847f9b95c59f84d8)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -43,9 +48,7 @@ vcpkg_from_github(
SHA512 ${ANGLE_SHA512}
# On update check headers against opengl-registry
PATCHES
001-fix-uwp.patch
002-fix-builder-error.patch
003-fix-mingw.patch
001-fix-builder-error.patch
)

# Generate angle_commit.h
Expand All @@ -55,19 +58,29 @@ set(ANGLE_COMMIT_DATE "invalid-date")
set(ANGLE_REVISION "${ANGLE_VERSION}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/angle_commit.h.in" "${SOURCE_PATH}/angle_commit.h" @ONLY)
configure_file("${CMAKE_CURRENT_LIST_DIR}/angle_commit.h.in" "${SOURCE_PATH}/src/common/angle_commit.h" @ONLY)

# Generate ANGLEShaderProgramVersion.h.in
# FIXME: ANGLE's build system hashes the renderer files to determine the program version hash.
# For now, we'll just use the ANGLE commit hash.
# See: https://github.com/google/angle/commit/82826be01fcc4d02a637312f4df3ba97e74f7226#diff-81195814d06b98e6258a63901769078f42c522448b2847a33bd51e24ac9faef6
set(ANGLE_PROGRAM_VERSION_HASH_SIZE 12)
string(SUBSTRING "${ANGLE_COMMIT}" 0 ${ANGLE_PROGRAM_VERSION_HASH_SIZE} ANGLE_PROGRAM_VERSION)
configure_file("${CMAKE_CURRENT_LIST_DIR}/ANGLEShaderProgramVersion.h.in" "${SOURCE_PATH}/ANGLEShaderProgramVersion.h" @ONLY)
configure_file("${CMAKE_CURRENT_LIST_DIR}/ANGLEShaderProgramVersion.h.in" "${SOURCE_PATH}/src/common/ANGLEShaderProgramVersion.h" @ONLY)

file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-angle-config.cmake" DESTINATION "${SOURCE_PATH}")

set(ANGLE_WEBKIT_BUILDSYSTEM_COMMIT "bb1da00b9ba878d228a5e9834a0767dbca2fee43")
set(ANGLE_WEBKIT_BUILDSYSTEM_COMMIT "0742522b24152262b04913242cb0b3c48de92ba0")

# Download WebKit gni-to-cmake.py conversion script
vcpkg_download_distfile(GNI_TO_CMAKE_PY
URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/ThirdParty/ANGLE/gni-to-cmake.py"
FILENAME "gni-to-cmake.py"
SHA512 9da35caf2db2e849d6cc85721ba0b77eee06b6f65a7c5314fb80483db4949b0b6e9bf4b2d4fc63613665629b24e9b052e03fb1451b09313d881297771a4f2736
SHA512 cf9dab1b59cd44b9ce05a2dc4636115e770dfe7d5cfbd90c3fef659628ac8155c57b866480f7cfe9a0afeb31ff5ce5eed74473f386120a7fc5910e8b032bd61d
)

# Generate CMake files from GN / GNI files
vcpkg_find_acquire_program(PYTHON3)
x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES ply)

set(_root_gni_files_to_convert
"compiler.gni Compiler.cmake"
Expand Down Expand Up @@ -113,7 +126,7 @@ configure_file("${WK_ANGLE_INCLUDE_CMAKELISTS}" "${SOURCE_PATH}/include/CMakeLis
vcpkg_download_distfile(WK_ANGLE_CMAKE_WEBKITCOMPILERFLAGS
URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/cmake/WebKitCompilerFlags.cmake"
FILENAME "WebKitCompilerFlags.cmake"
SHA512 63f981694ae37d4c4ca4c34e2bf62b4d4602b6a1a660851304fa7a6ee834fc58fa6730eeb41ef4e075550f3c8b675823d4d00bdcd72ca869c6d5ab11196b33bb
SHA512 8b281ffcf9209c845a5fdae48a4e05f08ca677c37a7fb00d9270de81bd103160d26e091724ce8df8d428ad604900b5202b221fed5bafffd4bf00025718ef9d8e
)
file(COPY "${WK_ANGLE_CMAKE_WEBKITCOMPILERFLAGS}" DESTINATION "${SOURCE_PATH}/cmake")

Expand All @@ -127,7 +140,7 @@ file(COPY "${WK_ANGLE_CMAKE_DETECTSSE2}" DESTINATION "${SOURCE_PATH}/cmake")
vcpkg_download_distfile(WK_ANGLE_CMAKE_WEBKITMACROS
URLS "https://github.com/WebKit/WebKit/raw/${ANGLE_WEBKIT_BUILDSYSTEM_COMMIT}/Source/cmake/WebKitMacros.cmake"
FILENAME "WebKitMacros.cmake"
SHA512 0d126b1d1b0ca995c2ea6e51c73326db363f560f3f07912ce58c7c022d9257d27b963dac56aee0e9604ca7a3d74c5aa9f0451c243fec922fb485dd2253685ab6
SHA512 565175443d5d1b8119af504164bf93840e8c786fc479e45feb98ca542351b91d2ea00265d7f8dfa6960975de81802bc43b2a2af2c90fc44bda1ae46d96c89247
)
file(COPY "${WK_ANGLE_CMAKE_WEBKITMACROS}" DESTINATION "${SOURCE_PATH}/cmake")

Expand All @@ -138,16 +151,16 @@ file(GLOB MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake-buildsystem/cmake/*.cmake")
file(COPY ${MODULES} DESTINATION "${SOURCE_PATH}/cmake")

function(checkout_in_path PATH URL REF)
if(EXISTS "${PATH}")
return()
endif()

vcpkg_from_git(
OUT_SOURCE_PATH DEP_SOURCE_PATH
URL "${URL}"
REF "${REF}"
)
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
if (CMAKE_HOST_WIN32)
file(COPY "${DEP_SOURCE_PATH}/" DESTINATION "${PATH}")
else()
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
endif()
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
endfunction()

Expand All @@ -165,6 +178,7 @@ vcpkg_cmake_configure(
"-DPORT=${ANGLE_BUILDSYSTEM_PORT}"
"-DANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW=${ANGLE_USE_D3D11_COMPOSITOR_NATIVE_WINDOW}"
"-DVCPKG_TARGET_IS_WINDOWS=${VCPKG_TARGET_IS_WINDOWS}"
"-DUSE_METAL=${USE_METAL}"
)

vcpkg_cmake_install()
Expand Down
3 changes: 0 additions & 3 deletions ports/angle/unofficial-angle-config.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(ZLIB)
if(UNIX AND NOT APPLE)
find_dependency(X11 COMPONENTS Xext Xi)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/unofficial-angle-targets.cmake")
27 changes: 12 additions & 15 deletions ports/angle/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "angle",
"version-string": "chromium_5414",
"port-version": 10,
"version-string": "chromium_7258",
"description": [
"A conformant OpenGL ES implementation for Windows, Mac and Linux.",
"The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is underway, and future plans include compute shader support (ES 3.1) and MacOS support."
Expand All @@ -10,18 +9,6 @@
"license": "BSD-3-Clause",
"dependencies": [
"egl-registry",
{
"name": "libx11",
"platform": "linux"
},
{
"name": "libxext",
"platform": "linux"
},
{
"name": "libxi",
"platform": "linux"
},
"opengl-registry",
{
"name": "vcpkg-cmake",
Expand All @@ -31,6 +18,16 @@
"name": "vcpkg-cmake-config",
"host": true
},
{
"name": "vcpkg-get-python-packages",
"host": true
},
"zlib"
]
],
"features": {
"metal": {
"description": "Metal support for angle",
"supports": "osx | ios"
}
}
}
5 changes: 5 additions & 0 deletions versions/a-/angle.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a24a04e9890dbb133aafb496616c15e074aac316",
"version-string": "chromium_7258",
"port-version": 0
},
{
"git-tree": "025eefba308651be2ae69502477d1201dfdf04ea",
"version-string": "chromium_5414",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
"port-version": 0
},
"angle": {
"baseline": "chromium_5414",
"port-version": 10
"baseline": "chromium_7258",
"port-version": 0
},
"ankurvdev-embedresource": {
"baseline": "0.0.12",
Expand Down
Loading