[skia] Update (#36680)

Based on https://github.com/microsoft/vcpkg/pull/36518, credits @abique.

This update makes skia use vcpkg vulkan. There are still vendored
dependencies (abseil, spirv-*, maybe also dawn, graphite), but I don't
want to touch that now.

---------

Co-authored-by: Alexandre Bique <bique.alexandre@gmail.com>
This commit is contained in:
Kai Pastor 2024-02-22 07:42:39 +01:00 committed by GitHub
parent 1580d22385
commit 3302690d7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 179 additions and 103 deletions

View File

@ -1,12 +0,0 @@
diff --git a/src/dawn/common/Mutex.cpp b/src/dawn/common/Mutex.cpp
index b8b891f..84c47af 100644
--- a/src/dawn/common/Mutex.cpp
+++ b/src/dawn/common/Mutex.cpp
@@ -13,6 +13,7 @@
// limitations under the License.
#include "dawn/common/Mutex.h"
+#include <cstdlib>
namespace dawn {
Mutex::~Mutex() = default;

View File

@ -0,0 +1,14 @@
diff --git a/modules/bentleyottmann/BUILD.gn b/modules/bentleyottmann/BUILD.gn
index 8a6725592f..fa0d03334c 100644
--- a/modules/bentleyottmann/BUILD.gn
+++ b/modules/bentleyottmann/BUILD.gn
@@ -31,4 +31,9 @@ if (skia_enable_bentleyottmann) {
]
}
}
+} else {
+ group("bentleyottmann") {
+ }
+ group("tests") {
+ }
}

View File

@ -1,26 +0,0 @@
diff --git a/src/dawn/native/BUILD.gn b/src/dawn/native/BUILD.gn
index 24853ced..064b839b 100644
--- a/src/dawn/native/BUILD.gn
+++ b/src/dawn/native/BUILD.gn
@@ -882,6 +882,10 @@ dawn_json_generator("webgpu_dawn_native_proc_gen") {
target = "webgpu_dawn_native_proc"
outputs = [ "src/dawn/native/webgpu_dawn_native_proc.cpp" ]
}
+source_set("webgpu_dawn_native_proc_gen_sources") {
+ sources = get_target_outputs(":webgpu_dawn_native_proc_gen")
+ deps = [ ":webgpu_dawn_native_proc_gen" ]
+}
dawn_component("webgpu_dawn") {
# For a single library - build `webgpu_dawn_shared` with GN args:
@@ -901,9 +905,8 @@ dawn_component("webgpu_dawn") {
DEFINE_PREFIX = "WGPU"
output_name = "webgpu_dawn"
- sources = get_target_outputs(":webgpu_dawn_native_proc_gen")
deps = [
":static",
- ":webgpu_dawn_native_proc_gen",
+ ":webgpu_dawn_native_proc_gen_sources",
]
}

12
ports/skia/graphite.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/include/gpu/graphite/Recorder.h b/include/gpu/graphite/Recorder.h
index 64e9fad..44a9aca 100644
--- a/include/gpu/graphite/Recorder.h
+++ b/include/gpu/graphite/Recorder.h
@@ -11,6 +11,7 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkSize.h"
#include "include/gpu/graphite/GraphiteTypes.h"
+#include "include/gpu/graphite/ImageProvider.h"
#include "include/gpu/graphite/Recording.h"
#include "include/private/base/SingleOwner.h"
#include "include/private/base/SkTArray.h"

View File

@ -3,20 +3,25 @@ include("${CMAKE_CURRENT_LIST_DIR}/skia-functions.cmake")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/skia
REF "canvaskit/${VERSION}"
SHA512 4672cfef8c92f37418e27df30a4e3fd6f7ca6273521e9d6b7755d9285800ad1ea6eff66639a17f591e6921ec8b78aa828500399a83295f9984ab58ebaff0ec24
REF "c3feddb877388498cc9a491e9504268a53607b15"
SHA512 33238a6d8db4d60edd4ca1255d42ce97f084145e3bc7520ae4723a584c8f99bea0404ff505d6a9be077c0a3cc42be557e00dab3ca572b5803a2453ce363cd8f5
PATCHES
disable-msvc-env-setup.patch
uwp.patch
disable-dev-test.patch
skdebug-stdio.patch
skia-include-string.patch
bentleyottmann-build.patch
graphite.patch
vulkan-headers.patch
)
# De-vendor
file(REMOVE_RECURSE "${SOURCE_PATH}/include/third_party/vulkan")
# these following aren't available in vcpkg
# to update, visit the DEPS file in Skia's root directory
declare_external_from_git(abseil-cpp
URL "https://github.com/abseil/abseil-cpp.git"
REF "cb436cf0142b4cbe47aae94223443df7f82e2920"
REF "334aca32051ef6ede2711487acf45d959e9bdffc"
LICENSE_FILE LICENSE
)
declare_external_from_git(d3d12allocator
@ -26,11 +31,8 @@ declare_external_from_git(d3d12allocator
)
declare_external_from_git(dawn
URL "https://dawn.googlesource.com/dawn.git"
REF "6e25bf7674bbcb1d1e613dc0700c958830950037"
REF "5b45794c2c24c3fa40dc480af92c5284a95423ef"
LICENSE_FILE LICENSE
PATCHES
dawn-dedup-native-proc-gen.patch
add-cstdlib.patch
)
declare_external_from_git(dng_sdk
URL "https://android.googlesource.com/platform/external/dng_sdk.git"
@ -39,12 +41,12 @@ declare_external_from_git(dng_sdk
)
declare_external_from_git(jinja2
URL "https://chromium.googlesource.com/chromium/src/third_party/jinja2"
REF "ee69aa00ee8536f61db6a451f3858745cf587de6"
REF "e2d024354e11cc6b041b0cff032d73f0c7e43a07"
LICENSE_FILE LICENSE.rst
)
declare_external_from_git(markupsafe
URL "https://chromium.googlesource.com/chromium/src/third_party/markupsafe"
REF "0944e71f4b2cb9a871bcbe353f95e889b64a611a"
REF "0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794"
LICENSE_FILE LICENSE
)
declare_external_from_git(piex
@ -59,27 +61,22 @@ declare_external_from_git(sfntly
)
declare_external_from_git(spirv-cross
URL "https://github.com/KhronosGroup/SPIRV-Cross"
REF "030d0be28c35bafebd20660c112852b1d8c8c6ca"
REF "b82536766d1b81631b126d1ddbe49baf42929bd3"
LICENSE_FILE LICENSE
)
declare_external_from_git(spirv-headers
URL "https://github.com/KhronosGroup/SPIRV-Headers.git"
REF "8e2ad27488ed2f87c068c01a8f5e8979f7086405"
REF "7b0309708da5126b89e4ce6f19835f36dc912f2f"
LICENSE_FILE LICENSE
)
declare_external_from_git(spirv-tools
URL "https://github.com/KhronosGroup/SPIRV-Tools.git"
REF "93c13345e176f3f8bdb4b07e59c5e3365b3dbf44"
REF "3e6bdd0f99655b1bc6a54aa73e5bfaaa4252198b"
LICENSE_FILE LICENSE
)
declare_external_from_git(vulkan-tools
URL "https://github.com/KhronosGroup/Vulkan-Tools"
REF "2c83dd6cb2ef710bab843b69776997d6f2c12ba4"
LICENSE_FILE LICENSE.txt
)
declare_external_from_git(wuffs
URL "https://github.com/google/wuffs-mirror-release-c.git"
REF "a0041ac0310b3156b963e2f2bea09245f25ec073"
REF "e3f919ccfe3ef542cfc983a82146070258fb57f8"
LICENSE_FILE LICENSE
)
@ -127,6 +124,7 @@ elseif(VCPKG_TARGET_IS_WINDOWS)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(APPEND OPTIONS " skia_enable_skparagraph=false")
string(APPEND OPTIONS " skia_enable_bentleyottmann=false")
endif()
endif()
@ -192,16 +190,8 @@ endif()
if("vulkan" IN_LIST FEATURES)
list(APPEND required_externals
vulkan_headers
vulkan-tools
)
string(APPEND OPTIONS " skia_use_vulkan=true")
find_file(vk_mem_alloc_h "vk_mem_alloc.h" PATHS "${CURRENT_INSTALLED_DIR}/include" PATH_SUFFIXES "vma" REQUIRED)
file(COPY "${vk_mem_alloc_h}" DESTINATION "${SOURCE_PATH}/third_party/externals/vulkanmemoryallocator/include")
# Cf. third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.h:25
vcpkg_replace_string("${SOURCE_PATH}/third_party/externals/vulkanmemoryallocator/include/vk_mem_alloc.h"
"#include <vulkan/vulkan.h>"
"#ifndef VULKAN_H_\n #include <vulkan/vulkan.h>\n#endif"
)
string(APPEND OPTIONS " skia_use_vulkan=true skia_vulkan_memory_allocator_dir=\"${CURRENT_INSTALLED_DIR}\"")
endif()
if("direct3d" IN_LIST FEATURES)
@ -214,6 +204,10 @@ if("direct3d" IN_LIST FEATURES)
string(APPEND OPTIONS " skia_use_direct3d=true")
endif()
if("graphite" IN_LIST FEATURES)
string(APPEND OPTIONS " skia_enable_graphite=true")
endif()
if("dawn" IN_LIST FEATURES)
if (VCPKG_TARGET_IS_LINUX)
message(WARNING
@ -237,13 +231,14 @@ They can be installed on Debian based systems via
markupsafe
vulkan_headers
## Remove
vulkan-tools
abseil-cpp
## REMOVE ^
dawn
)
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/externals/opengl-registry")
file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opengl/" DESTINATION "${SOURCE_PATH}/third_party/externals/opengl-registry/xml")
# cf. external dawn/src/dawn/native/BUILD.gn
string(APPEND OPTIONS " skia_use_dawn=true dawn_use_angle=false dawn_use_swiftshader=false")
string(APPEND OPTIONS " skia_use_dawn=true dawn_use_swiftshader=false")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
string(APPEND OPTIONS " dawn_complete_static_libs=true")
endif()
@ -253,7 +248,7 @@ get_externals(${required_externals})
if(EXISTS "${SOURCE_PATH}/third_party/externals/dawn")
vcpkg_find_acquire_program(GIT)
vcpkg_replace_string("${SOURCE_PATH}/third_party/externals/dawn/generator/dawn_version_generator.py"
"get_git(),"
"get_git(),"
"\"${GIT}\","
)
endif()

View File

@ -1,12 +0,0 @@
diff --git a/src/ports/SkDebug_stdio.cpp b/src/ports/SkDebug_stdio.cpp
index 78c7072b..3d5c134d 100644
--- a/src/ports/SkDebug_stdio.cpp
+++ b/src/ports/SkDebug_stdio.cpp
@@ -7,6 +7,7 @@
#include "include/private/base/SkFeatures.h"
#include "include/private/base/SkLoadUserConfig.h"
+#include "include/private/base/SkDebug.h"
#if !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID)

View File

@ -319,7 +319,7 @@ function(skia_gn_install_build_type)
WORKING_DIRECTORY "${arg_SOURCE_PATH}"
LOGNAME "desc-${arg_LABEL}"
)
# build
set(VCPKG_BUILD_TYPE "${arg_BUILD_TYPE}")
vcpkg_build_ninja(TARGETS ${arg_TARGETS})
@ -333,6 +333,10 @@ function(skia_gn_install_build_type)
list(TRANSFORM arg_TARGETS PREPEND "//")
file(READ "${CURRENT_BUILDTREES_DIR}/desc-${arg_LABEL}-out.log" desc)
string(REGEX REPLACE "^([^{]+)\n{\n" "{\n" desc "${desc}")
if(NOT "${CMAKE_MATCH_1}" STREQUAL "")
message(STATUS "${CMAKE_MATCH_1}")
endif()
expand_gn_targets(arg_TARGETS desc "${arg_SOURCE_PATH}")
string(TOUPPER "${arg_BUILD_TYPE}" cmake_build_type)

View File

@ -0,0 +1,11 @@
--- a/src/gpu/ganesh/d3d/GrD3DUtil.h 2024-01-23 22:09:34
+++ b/src/gpu/ganesh/d3d/GrD3DUtil.h 2024-02-01 18:09:20
@@ -8,6 +8,8 @@
#ifndef GrD3DUtil_DEFINED
#define GrD3DUtil_DEFINED
+#include <string>
+
#include "include/core/SkImage.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/d3d/GrD3DTypes.h"

View File

@ -1,13 +0,0 @@
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 9dacf0c..3365a31 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -6,7 +6,7 @@
*/
#include "include/core/SkTypes.h"
-#if defined(SK_BUILD_FOR_WIN) && !defined(_M_ARM64) && !defined(WINUWP)
+#if defined(SK_BUILD_FOR_WIN) && !defined(_M_ARM64) && !defined(SK_WINUWP)
#include "src/utils/win/SkWGL.h"

View File

@ -1,7 +1,6 @@
{
"name": "skia",
"version": "0.38.2",
"port-version": 4,
"version": "122",
"description": [
"Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.",
"It serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS, and many other products.",
@ -61,7 +60,7 @@
},
{
"name": "harfbuzz",
"platform": "!uwp"
"platform": "!uwp & !(windows & !static)"
},
{
"name": "icu",
@ -72,7 +71,17 @@
"dawn": {
"description": "dawn support for skia",
"dependencies": [
"vulkan-headers"
"egl-registry",
"opengl-registry",
{
"name": "skia",
"default-features": false,
"features": [
"graphite",
"vulkan"
]
},
"vulkan-utility-libraries"
]
},
"direct3d": {
@ -112,10 +121,25 @@
"opengl-registry"
]
},
"graphite": {
"description": "Graphite support",
"dependencies": [
{
"name": "skia",
"default-features": false,
"features": [
"vulkan"
]
}
]
},
"harfbuzz": {
"description": "Harfbuzz support",
"dependencies": [
"harfbuzz"
{
"name": "harfbuzz",
"default-features": false
}
]
},
"icu": {

View File

@ -0,0 +1,50 @@
diff --git a/BUILD.gn b/BUILD.gn
index 04ab422..5ae82e5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -913,6 +913,7 @@ optional("gpu_shared") {
}
if (skia_use_vulkan) {
+ public_deps += [ "//third_party/externals/vulkan-headers:vulkan_headers" ]
public_defines += [ "SK_VULKAN" ]
sources += skia_shared_vk_sources
if (skia_enable_vulkan_debug_layers) {
diff --git a/include/private/gpu/vk/SkiaVulkan.h b/include/private/gpu/vk/SkiaVulkan.h
index ca4bcf1..8a52200 100644
--- a/include/private/gpu/vk/SkiaVulkan.h
+++ b/include/private/gpu/vk/SkiaVulkan.h
@@ -13,7 +13,7 @@
// IWYU pragma: begin_exports
#if SKIA_IMPLEMENTATION || !defined(SK_VULKAN)
-#include "include/third_party/vulkan/vulkan/vulkan_core.h"
+#include "vulkan/vulkan_core.h"
#else
// For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan
// headers stay up to date for our needs
@@ -23,7 +23,7 @@
#ifdef SK_BUILD_FOR_ANDROID
// This is needed to get android extensions for external memory
#if SKIA_IMPLEMENTATION || !defined(SK_VULKAN)
-#include "include/third_party/vulkan/vulkan/vulkan_android.h"
+#include "vulkan/vulkan_android.h"
#else
// For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan
// headers stay up to date for our needs
diff --git a/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h b/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
index 487ea7c..9662c8c 100644
--- a/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
+++ b/src/gpu/vk/vulkanmemoryallocator/VulkanMemoryAllocatorWrapper.h
@@ -39,7 +39,11 @@
// VMA outside of Skia, the client should instead tell Skia not to use VMA.
// Then they should wrap their own instance of VMA into an implementation of
// Skia's VulkanMemoryAllocator interface, and pass that object into context creation.
+#ifdef _WIN32
+#include "vma/vk_mem_alloc.h" // NO_G3_REWRITE
+#else
#include "vk_mem_alloc.h" // NO_G3_REWRITE
+#endif
#ifdef GR_NEEDED_TO_DEFINE_VULKAN_H
#undef VULKAN_H_
#endif

View File

@ -8,6 +8,30 @@
"name": "skia",
"default-features": false
},
{
"name": "skia",
"default-features": false,
"features": [
"metal"
],
"platform": "osx"
},
{
"name": "skia",
"default-features": false,
"features": [
"dawn"
],
"platform": "linux"
},
{
"name": "skia",
"default-features": false,
"features": [
"graphite"
],
"platform": "windows & !uwp"
},
{
"name": "skia",
"default-features": false,

View File

@ -8041,8 +8041,8 @@
"port-version": 0
},
"skia": {
"baseline": "0.38.2",
"port-version": 4
"baseline": "122",
"port-version": 0
},
"skyr-url": {
"baseline": "1.13.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "24ac468e6d009a532784555a2b2cb466683ca914",
"version": "122",
"port-version": 0
},
{
"git-tree": "b33b637ea6bf1d04acc4aac659b0238f9d16a0c1",
"version": "0.38.2",