From 0c69c481816c25986c17b5755404d7dbca21b478 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 1 Jun 2024 07:13:40 +0100 Subject: [PATCH 01/26] Adding references and code snipplets to OpenGL settings for Apple users fixes #214 --- docs/tutorial/canvas.rst | 10 ++++++++++ relnotes/README.m116.md | 30 ++++++++++++++++++++++++++++++ tests/conftest.py | 5 +++++ 3 files changed, 45 insertions(+) diff --git a/docs/tutorial/canvas.rst b/docs/tutorial/canvas.rst index 995e25b3..16eb1791 100644 --- a/docs/tutorial/canvas.rst +++ b/docs/tutorial/canvas.rst @@ -90,6 +90,11 @@ The following example uses glfw package to create an OpenGL context. Install raise RuntimeError('glfw.init() failed') glfw.window_hint(glfw.VISIBLE, glfw.FALSE) glfw.window_hint(glfw.STENCIL_BITS, 8) + # see https://www.glfw.org/faq#macos + glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3) + glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2) + glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) + glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) window = glfw.create_window(640, 480, '', None, None) glfw.make_context_current(window) yield window @@ -138,6 +143,11 @@ Here's a complete example: if not glfw.init(): raise RuntimeError('glfw.init() failed') glfw.window_hint(glfw.STENCIL_BITS, 8) + # see https://www.glfw.org/faq#macos + glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3) + glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2) + glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) + glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) window = glfw.create_window(WIDTH, HEIGHT, '', None, None) glfw.make_context_current(window) yield window diff --git a/relnotes/README.m116.md b/relnotes/README.m116.md index 78b5a237..a4a16c5d 100644 --- a/relnotes/README.m116.md +++ b/relnotes/README.m116.md @@ -21,6 +21,9 @@ of this update had taken from. * TL;DR - `m87` users would likely find most existing python scripts work. Some routines need a new `skia.SamplingOptions()` argument, or switch from `skia.FilterQuality` to `skia.SamplingOptions()`. + OpenGL users, especially on Apple Mac OS, may now need to specify + a compatible OpenGL profile for their GPU hardware/software combination + to avoid shader-compilation related errors (See more about this below). Please report `AttributeError: 'skia.AAA' object has no attribute 'BBB'` errors, to prioritize fixing remaining differences between `m87` and `m116`. @@ -38,6 +41,33 @@ of this update had taken from. are removed/disabled when there are no obvious new-equivalents, or not-too-troblesome emulations with `m116`. The "AttributeError" error mentioned above. +* Be **WARN**'ed on OpenGL usage: Google folks added subtantial GPU/driver + detection code in upsteam Skia between m87 and m116, to optimize for speed and + work-around driver bugs. If you use a non-open-source GPU driver, i.e. + everybody except Mesa on Linux, and especially Apple Mac users, + you may need to request compatible OpenGL profile to match the your + GPU/driver's capability. For Apple Mac users, with `glfw`, adds the following: + +``` +# see https://www.glfw.org/faq#macos +glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3) +glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2) +glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) +glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) +``` + + OSX OpenGL users may need to add `GLUT_3_2_CORE_PROFILE` to their `glutInitDisplayMode()` + invocation e.g. `glutInitDisplayMode(... | GLUT_3_2_CORE_PROFILE)`. `pysdl2` users + need: + +``` +sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MAJOR_VERSION, 3) +sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_MINOR_VERSION, 2) +sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG, True) +sdl2.SDL_GL_SetAttribute(sdl2.SDL_GL_CONTEXT_PROFILE_MASK, + sdl2.SDL_GL_CONTEXT_PROFILE_CORE) +``` + * Where it is possible, when `m87` APIs disappear, emulations with `m116` is done. So these are "new emulations of old APIs". While they work, they might be withdrawn/changed later: diff --git a/tests/conftest.py b/tests/conftest.py index 32f07936..a8b40518 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,11 @@ def glfw_context(): raise RuntimeError('glfw.init() failed') glfw.window_hint(glfw.VISIBLE, glfw.FALSE) glfw.window_hint(glfw.STENCIL_BITS, 8) + # see https://www.glfw.org/faq#macos + glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3) + glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2) + glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) + glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) context = glfw.create_window(640, 480, '', None, None) glfw.make_context_current(context) logger.debug('glfw context created') From 79e0b3370330030f99fe83d8c39315d8524807ff Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 27 Jun 2024 00:43:11 +0100 Subject: [PATCH 02/26] Roll skia from canvaskit/0.38.2-4873-g9097d768e8 to canvaskit/0.38.2-4875-gbe621ea042 on m126 --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 9097d768..be621ea0 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 9097d768e80c83cd38697be2f194aff4d1f7e488 +Subproject commit be621ea04206d8fae23952783d1d588d6ce0d9b3 From d3977e47121fb952946357ed80036eb3b77ad34f Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 27 Jun 2024 00:45:56 +0100 Subject: [PATCH 03/26] update skia from m126 to m127 (canvaskit/0.38.2-4875-gbe621ea042 to canvaskit/0.38.2-5214-g1c8089adff) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index be621ea0..1c8089ad 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit be621ea04206d8fae23952783d1d588d6ce0d9b3 +Subproject commit 1c8089adffdabe3790cc4ca4fb36e24c2f6ab792 From 5ce9a00462f128263ba54710f94a93e227d54774 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 28 Jun 2024 23:41:32 +0100 Subject: [PATCH 04/26] m127 patch + adjustments --- .github/workflows/ci.yml | 2 +- patch/skia-m127-minimize-download.patch | 69 +++++++++++++++++++++++++ scripts/build_Linux.sh | 2 +- scripts/build_Windows.sh | 2 +- scripts/build_macOS.sh | 2 +- 5 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 patch/skia-m127-minimize-download.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e284f9d..02f8485f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: skia key: linux-aarch64-skia-${{ github.sha }}-3rd-party - name: Pre-fetch skia deps - run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m126-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m126-minimize-download.patch + run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m127-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m127-minimize-download.patch - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Build skia 3rd-Party diff --git a/patch/skia-m127-minimize-download.patch b/patch/skia-m127-minimize-download.patch new file mode 100644 index 00000000..a448a369 --- /dev/null +++ b/patch/skia-m127-minimize-download.patch @@ -0,0 +1,69 @@ +diff --git a/DEPS b/DEPS +index 007d053..17e50d8 100644 +--- a/DEPS ++++ b/DEPS +@@ -23,52 +23,18 @@ vars = { + # ./tools/git-sync-deps + deps = { + "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@3a3b55f7ac9bee70e875e7cfb9b0c05b2ed9b7cf", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", +- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. +- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. +- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@51d873f3e0d0e0dcc5c3a6b56019983a5a4cd155", +- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794", +- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@65a55c2ba891f6d2492477707f4a2e327a0b40dc", + "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe", +- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57", + "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@441f98d02deafd9b090aea568282b28f66a50e36", + "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@a46424228f0998a72c715f32e18dca8a7a764c1f", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@b74a7ecc93e283d059df51ee4f46961a782bcdb8", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", + "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4", +- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1", +- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0", + "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@ccfbe1c82a3b6dbe8647ceb36a3f9ee711fba3cf", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", + "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429", + "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", +- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", + "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@2ff3212615da62f591be15eef78721c29c5c0b31", + "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191", +- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. +- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. + "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@62eb765e42dd2ab2ca58f6c95fac89de123978e7", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3", + "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@eb49bb7b1136298b77945c52b4bbbc433f7885de", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@ce46482db7ab3ea9c52fce832d27ca40b14f8e87", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@6938a2893d6a2ba658709d1d04720f6c6033700f", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@d192041a2fc9c9fd8ae67d8ae3f32c5511541f04", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@a9a1bcd709e185700847268eb4310f6484b027bc", +- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@741921e408442b0370047b5eaf16cbc2b5d381e5", +- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095", +- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", + "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596", + +diff --git a/bin/activate-emsdk b/bin/activate-emsdk +index 687ca9f..7167d8d 100755 +--- a/bin/activate-emsdk ++++ b/bin/activate-emsdk +@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') + EMSDK_VERSION = '3.1.44' + + def main(): ++ return + if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']: + # This platform cannot install emsdk at the provided version. See + # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5 diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index 96b406a3..c8a6a379 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -60,7 +60,7 @@ git clone https://gn.googlesource.com/gn && \ # Build skia cd skia && \ - patch -p1 < ../patch/skia-m126-minimize-download.patch && \ + patch -p1 < ../patch/skia-m127-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ cp -f ../gn/out/gn bin/gn && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 7531b997..e1b585cb 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -4,7 +4,7 @@ export PATH="${PWD}/depot_tools:$PATH" # Build skia cd skia && \ - patch -p1 < ../patch/skia-m126-minimize-download.patch && \ + patch -p1 < ../patch/skia-m127-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=' diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 8ac6077a..83859bb1 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,7 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m126-minimize-download.patch && \ + patch -p1 < ../patch/skia-m127-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From 3415fb361f947dd70478781b7d3e0bcf4500f82e Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 28 Jun 2024 23:42:27 +0100 Subject: [PATCH 05/26] bump version to 127.0b8 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d6c6eff9..0c12a1e0 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ pass NAME = 'skia-python' -__version__ = '126.0b8' +__version__ = '127.0b8' SKIA_PATH = os.getenv('SKIA_PATH', 'skia') SKIA_OUT_PATH = os.getenv( From 406bb176aaef565c9ed15f80b381b35e90afe1d4 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 16 Jun 2024 23:24:53 +0100 Subject: [PATCH 06/26] m127: GrVkBackendContext -> skgpu::VulkanBackendContext one too many m127: GrVkBackendContext -> skgpu::VulkanBackendContext --- src/skia/GrContext.cpp | 4 ++-- src/skia/GrContext_vk.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/skia/GrContext.cpp b/src/skia/GrContext.cpp index b032d775..1ce5ab68 100644 --- a/src/skia/GrContext.cpp +++ b/src/skia/GrContext.cpp @@ -1231,7 +1231,7 @@ py::class_, GrRecordingContext>(m, "GrDi #ifdef SK_VULKAN .def_static("MakeVulkan", - py::overload_cast( + py::overload_cast( &GrDirectContexts::MakeVulkan), R"docstring( The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive @@ -1243,7 +1243,7 @@ py::class_, GrRecordingContext>(m, "GrDi )docstring", py::arg("backendContext"), py::arg("options")) .def_static("MakeVulkan", - py::overload_cast( + py::overload_cast( &GrDirectContexts::MakeVulkan), py::arg("backendContext")) #endif diff --git a/src/skia/GrContext_vk.cpp b/src/skia/GrContext_vk.cpp index 7470bde7..2779b397 100644 --- a/src/skia/GrContext_vk.cpp +++ b/src/skia/GrContext_vk.cpp @@ -96,7 +96,7 @@ py::enum_(m, "GrVkFeatureFlags", py::arithmetic()) GrVkFeatureFlags::kSampleRateShading_GrVkFeatureFlag) .export_values(); -py::class_(m, "GrVkBackendContext", +py::class_(m, "GrVkBackendContext", R"docstring( The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption is that the client will set these up and pass them From 038ca539d1b323ed89c124f3e979eab794200ea6 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 16 Jun 2024 23:34:24 +0100 Subject: [PATCH 07/26] m127: GrVkExtensionFlags & GrVkFeatureFlags removed --- src/skia/GrContext_vk.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/skia/GrContext_vk.cpp b/src/skia/GrContext_vk.cpp index 2779b397..a5226df3 100644 --- a/src/skia/GrContext_vk.cpp +++ b/src/skia/GrContext_vk.cpp @@ -70,6 +70,8 @@ py::class_(m, "GrVkDrawableInfo") ; // GrVkBackendContext.h +/* GrVkExtensionFlags & GrVkFeatureFlags removed in m127 */ +/* py::enum_(m, "GrVkExtensionFlags", py::arithmetic()) .value("kEXT_debug_report_GrVkExtensionFlag", GrVkExtensionFlags::kEXT_debug_report_GrVkExtensionFlag) @@ -95,6 +97,7 @@ py::enum_(m, "GrVkFeatureFlags", py::arithmetic()) .value("kSampleRateShading_GrVkFeatureFlag", GrVkFeatureFlags::kSampleRateShading_GrVkFeatureFlag) .export_values(); +*/ py::class_(m, "GrVkBackendContext", R"docstring( From 436547ae723e4e49c2c0a5e9923509ad398baee6 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 31 May 2024 00:36:25 +0100 Subject: [PATCH 08/26] m116+: There is a SkSurfaceProps(); Used by the m92 SkiaSDL example. --- src/skia/Surface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/skia/Surface.cpp b/src/skia/Surface.cpp index fa2d5a32..81cb64c8 100644 --- a/src/skia/Surface.cpp +++ b/src/skia/Surface.cpp @@ -70,6 +70,7 @@ py::enum_(surfaceprops, "Flags", py::arithmetic()) /* SkSurfaceProps::kLegacyFontHost_InitType was removed in m88 */ surfaceprops + .def(py::init<>()) .def(py::init(), py::arg("flags"), py::arg("geometry")) /* From 800df65cdafe1d15236852218646d8aec73d26bc Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:11:54 +0100 Subject: [PATCH 09/26] m87->m116: New SkSurfaceProps::Flags --- src/skia/Surface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/skia/Surface.cpp b/src/skia/Surface.cpp index 81cb64c8..715c7c9b 100644 --- a/src/skia/Surface.cpp +++ b/src/skia/Surface.cpp @@ -65,6 +65,10 @@ py::class_ surfaceprops(m, "SurfaceProps", R"docstring( py::enum_(surfaceprops, "Flags", py::arithmetic()) .value("kUseDeviceIndependentFonts_Flag", SkSurfaceProps::Flags::kUseDeviceIndependentFonts_Flag) + .value("kDynamicMSAA_Flag", + SkSurfaceProps::Flags::kDynamicMSAA_Flag) + .value("kAlwaysDither_Flag", + SkSurfaceProps::Flags::kAlwaysDither_Flag) .export_values(); /* SkSurfaceProps::kLegacyFontHost_InitType was removed in m88 */ From 1634e33aad86db7aa46671f259be991598dfe360 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:22:56 +0100 Subject: [PATCH 10/26] Expanding comments from "git diff chrome/m87 chrome/m88 -- example/SkiaSDLExample.cpp" --- src/skia/Surface.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/skia/Surface.cpp b/src/skia/Surface.cpp index 715c7c9b..fb0fc133 100644 --- a/src/skia/Surface.cpp +++ b/src/skia/Surface.cpp @@ -71,7 +71,15 @@ py::enum_(surfaceprops, "Flags", py::arithmetic()) SkSurfaceProps::Flags::kAlwaysDither_Flag) .export_values(); -/* SkSurfaceProps::kLegacyFontHost_InitType was removed in m88 */ +/* SkSurfaceProps::kLegacyFontHost_InitType was removed in m88. + Its usage was replaced by: + SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) + -> SkSurfaceProps() - private in m87 to public in m88 + SkSurfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, + SkSurfaceProps::kLegacyFontHost_InitType) + -> SkSurfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, + SkSurfaceProps::kUnknown_SkPixelGeometry) - different constructor + */ surfaceprops .def(py::init<>()) From b65ad58f9dc9e0d143b2a706554cdf9ed099d096 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:26:35 +0100 Subject: [PATCH 11/26] Adding back removed tests during m87->m116 --- tests/test_surface.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_surface.py b/tests/test_surface.py index 799601d0..002eb971 100644 --- a/tests/test_surface.py +++ b/tests/test_surface.py @@ -176,6 +176,10 @@ def test_Surface_ref_unref(surface): @pytest.mark.parametrize('args', [ (skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4)), (skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4), 16 * 4), + ( + skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4), + 16 * 4, + skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), ]) def test_Surface_MakeRasterDirect(args): check_surface(skia.Surface.MakeRasterDirect(*args)) @@ -184,6 +188,10 @@ def test_Surface_MakeRasterDirect(args): @pytest.mark.parametrize('args', [ (skia.ImageInfo.MakeN32Premul(16, 16),), (skia.ImageInfo.MakeN32Premul(16, 16), 16 * 4), + ( + skia.ImageInfo.MakeN32Premul(16, 16), + 16 * 4, + skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), ]) def test_Surface_MakeRaster(args): check_surface(skia.Surface.MakeRaster(*args)) @@ -191,6 +199,7 @@ def test_Surface_MakeRaster(args): @pytest.mark.parametrize('args', [ (320, 240), + (320, 240, skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType)), ]) def test_Surface_MakeRasterN32Premul(args): check_surface(skia.Surface.MakeRasterN32Premul(*args)) From 47bdc5277157c73258e678dc2a1ab1ea4e63a43b Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:28:04 +0100 Subject: [PATCH 12/26] Adjusting re-added Surface tests to m88+ APIs --- tests/test_surface.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_surface.py b/tests/test_surface.py index 002eb971..3bb40cc3 100644 --- a/tests/test_surface.py +++ b/tests/test_surface.py @@ -179,7 +179,7 @@ def test_Surface_ref_unref(surface): ( skia.ImageInfo.MakeN32Premul(16, 16), bytearray(16 * 16 * 4), 16 * 4, - skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), + skia.SurfaceProps(),), ]) def test_Surface_MakeRasterDirect(args): check_surface(skia.Surface.MakeRasterDirect(*args)) @@ -191,7 +191,7 @@ def test_Surface_MakeRasterDirect(args): ( skia.ImageInfo.MakeN32Premul(16, 16), 16 * 4, - skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType),), + skia.SurfaceProps(),), ]) def test_Surface_MakeRaster(args): check_surface(skia.Surface.MakeRaster(*args)) @@ -199,7 +199,7 @@ def test_Surface_MakeRaster(args): @pytest.mark.parametrize('args', [ (320, 240), - (320, 240, skia.SurfaceProps(skia.SurfaceProps.kLegacyFontHost_InitType)), + (320, 240, skia.SurfaceProps()), ]) def test_Surface_MakeRasterN32Premul(args): check_surface(skia.Surface.MakeRasterN32Premul(*args)) From adf6e3f524b866761ff9134d1746eddd9ca3cbd0 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:36:03 +0100 Subject: [PATCH 13/26] m88->m116: Allow some m1xx APIs in GrContext Make skia.GrDirectContexts (namespace) an alias to skia.GrDirectContext Make GrBackendRenderTargets (namespace) an alias to GrBackendRenderTarget Allow direct call to GrBackendRenderTargets::MakeGL --- src/skia/GrContext.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/skia/GrContext.cpp b/src/skia/GrContext.cpp index 1ce5ab68..04afcb1c 100644 --- a/src/skia/GrContext.cpp +++ b/src/skia/GrContext.cpp @@ -447,6 +447,9 @@ py::class_(m, "GrBackendRenderTarget") }), py::arg("width"), py::arg("height"), py::arg("sampleCnt"), py::arg("stencilBits"), py::arg("glInfo")) + .def_static("MakeGL", &GrBackendRenderTargets::MakeGL, + py::arg("width"), py::arg("height"), py::arg("sampleCnt"), + py::arg("stencilBits"), py::arg("glInfo")) #ifdef SK_VULKAN .def(py::init( [] (int width, int height, const GrVkImageInfo& vkInfo) { @@ -1321,6 +1324,10 @@ py::class_, GrRecordingContext>(m, "GrDi m.attr("GrContext") = m.attr("GrDirectContext"); +// GrDirectContexts and GrBackendRenderTargets are namespaces +m.attr("GrDirectContexts") = m.attr("GrDirectContext"); +m.attr("GrBackendRenderTargets") = m.attr("GrBackendRenderTarget"); + initGrContext_gl(m); initGrContext_vk(m); initGrContext_mock(m); From d2bf301acc7976cb70568480f8f36468702b5a84 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 15 Jul 2024 01:56:31 +0100 Subject: [PATCH 14/26] m88->m116: Allow some m1xx APIs in Surface Adding direct call to SkSurfaces::WrapBackendRenderTarget Make Surface.Raster the same as Surface.MakeRaster --- src/skia/Surface.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/skia/Surface.cpp b/src/skia/Surface.cpp index fb0fc133..e9101e85 100644 --- a/src/skia/Surface.cpp +++ b/src/skia/Surface.cpp @@ -1106,6 +1106,39 @@ surface py::arg("context"), py::arg("backendRenderTarget"), py::arg("origin"), py::arg("colorType"), py::arg("colorSpace"), py::arg("surfaceProps") = nullptr) + .def_static("WrapBackendRenderTarget", &SkSurfaces::WrapBackendRenderTarget, + R"docstring( + Wraps a GPU-backed buffer into :py:class:`Surface`. + + Caller must ensure backendRenderTarget is valid for the lifetime of + returned :py:class:`Surface`. + + :py:class:`Surface` is returned if all parameters are valid. + backendRenderTarget is valid if its pixel configuration agrees with + colorSpace and context; for instance, if backendRenderTarget has an sRGB + configuration, then context must support sRGB, and colorSpace must be + present. Further, backendRenderTarget width and height must not exceed + context capabilities, and the context must be able to support back-end + render targets. + + Upon success releaseProc is called when it is safe to delete the render + target in the backend API (accounting only for use of the render target + by this surface). If :py:class:`Surface` creation fails releaseProc is + called before this function returns. + + If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. + + :param context: GPU context + :param backendRenderTarget: GPU intermediate memory buffer + :param colorSpace: range of colors + :param surfaceProps: LCD striping orientation and setting for device + independent fonts; may be nullptr + :return: :py:class:`Surface` if all parameters are valid; otherwise, + nullptr + )docstring", + py::arg("context"), py::arg("backendRenderTarget"), py::arg("origin"), + py::arg("colorType"), py::arg("colorSpace"), + py::arg("surfaceProps") = nullptr, py::arg("releaseProc") = nullptr, py::arg("releaseContext") = nullptr) .def_static("MakeRenderTarget", py::overload_cast( @@ -1237,4 +1270,8 @@ surface )docstring", py::arg("width"), py::arg("height")) ; + +// Surfaces is a namespace +m.attr("Surfaces") = m.attr("Surface"); +m.attr("Surface").attr("Raster") = m.attr("Surface").attr("MakeRaster"); } From f4668843d10be25bfea5f486a4efb3e016f761f6 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 19 Jul 2024 22:07:44 +0100 Subject: [PATCH 15/26] Update cibuildwheel aarch64 docker image to to v2.19.2, to fix CentOS 7 EOL on 1 Jul 2024 Upstream pull and issue: https://github.com/pypa/cibuildwheel/pull/1917 https://github.com/pypa/cibuildwheel/issues/1915 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02f8485f..85be73cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,8 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Build skia 3rd-Party - # Taken from https://github.com/pypa/cibuildwheel/blob/v2.16.2/cibuildwheel/resources/pinned_docker_images.cfg - uses: docker://quay.io/pypa/manylinux2014_aarch64:2023-10-03-72cdc42 + # Taken from https://github.com/pypa/cibuildwheel/blob/v2.19.2/cibuildwheel/resources/pinned_docker_images.cfg + uses: docker://quay.io/pypa/manylinux2014_aarch64:2024.07.02-0 if: ${{ steps.cache-skia.outputs.cache-hit != 'true' }} with: args: bash -c "git config --global --add safe.directory '*' && @@ -60,7 +60,7 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Build Skia Proper - uses: docker://quay.io/pypa/manylinux2014_aarch64:2023-10-03-72cdc42 + uses: docker://quay.io/pypa/manylinux2014_aarch64:2024.07.02-0 with: args: bash -c "git config --global --add safe.directory '*' && bash scripts/build_Linux.sh From 938f12eeb8619a10d514471082b79e7c9f0aa02b Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 19 Jul 2024 22:12:02 +0100 Subject: [PATCH 16/26] Missed a reference to pypa/cibuildwheel@v2.19.2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85be73cd..bd58e4d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,7 +116,7 @@ jobs: platforms: ${{ matrix.arch }} - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 + uses: pypa/cibuildwheel@v2.19.2 env: CIBW_BUILD: "${{ matrix.cp }}-*" CIBW_SKIP: "*musllinux*" From 6de2dce062a9be6c0bbfd5e41fe51370530f3b4f Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 20 Jul 2024 03:01:55 +0100 Subject: [PATCH 17/26] The newer pypa/cibuildwheel@v2.19.2 also checks that the mac os deployment target matches. We need and build for 10.13 in Skia. The default is 10.9, too low for us. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd58e4d0..e6edeb8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: CIBW_BUILD: "${{ matrix.cp }}-*" CIBW_SKIP: "*musllinux*" CIBW_ARCHS: ${{ matrix.arch }} - CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} + CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=10.13 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh CIBW_BEFORE_BUILD: pip install pybind11 numpy CIBW_TEST_REQUIRES: pytest pillow glfw From 984e63e87222c0632c73d9eacf98f3ff9a4c20f2 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 26 Jul 2024 22:03:41 +0100 Subject: [PATCH 18/26] move skia m127 to m128 (canvaskit/0.38.2-5214-g1c8089adff to canvaskit/0.38.2-5694-g5f2abc61e2) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 1c8089ad..5f2abc61 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 1c8089adffdabe3790cc4ca4fb36e24c2f6ab792 +Subproject commit 5f2abc61e21e9668fa48221d2e5e8c6f09bd929b From c256250fc10878b928af514806fe89f05c8d7247 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 17:54:18 +0100 Subject: [PATCH 19/26] Bump version up to 128b9, for the next beta release --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0c12a1e0..9bcd5797 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ pass NAME = 'skia-python' -__version__ = '127.0b8' +__version__ = '128.0b9' SKIA_PATH = os.getenv('SKIA_PATH', 'skia') SKIA_OUT_PATH = os.getenv( From d061735c05424d6a6dd2bc1573d11b39ec31d9f8 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 01:38:12 +0100 Subject: [PATCH 20/26] m128: Vulkan symbols are renamed to skgpu::* Milestone 128 ------------- * The following symbols (and their files) have been deleted in favor of their GPU-backend-agnostic form: - `GrVkBackendContext` -> `skgpu::VulkanBackendContext` - `GrVkExtensions` -> `skgpu::VulkanExtensions` - `GrVkMemoryAllocator` = `skgpu::VulkanMemoryAllocator` - `GrVkBackendMemory` = `skgpu::VulkanBackendMemory` - `GrVkAlloc` = `skgpu::VulkanAlloc` - `GrVkYcbcrConversionInfo` = `skgpu::VulkanYcbcrConversionInfo` - `GrVkGetProc` = `skgpu::VulkanGetProc` --- src/skia/GrContext.cpp | 4 ++-- src/skia/GrContext_vk.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/skia/GrContext.cpp b/src/skia/GrContext.cpp index 04afcb1c..62901bec 100644 --- a/src/skia/GrContext.cpp +++ b/src/skia/GrContext.cpp @@ -17,7 +17,7 @@ #include #include #endif -#include +#include #include #include #include @@ -306,7 +306,7 @@ py::class_(m, "GrBackendFormat") .def_static("MakeVk", py::overload_cast(&GrBackendFormats::MakeVk), py::arg("format"), py::arg("willUseDRMFormatModifiers") = false) .def_static("MakeVk", - py::overload_cast( + py::overload_cast( &GrBackendFormats::MakeVk), py::arg("ycbcrInfo"), py::arg("willUseDRMFormatModifiers") = false) #endif diff --git a/src/skia/GrContext_vk.cpp b/src/skia/GrContext_vk.cpp index a5226df3..c9c445ae 100644 --- a/src/skia/GrContext_vk.cpp +++ b/src/skia/GrContext_vk.cpp @@ -1,5 +1,6 @@ #include "common.h" -#include +#include +#include void initGrContext_vk(py::module &m) { @@ -13,12 +14,12 @@ py::enum_(m, "VkImageLayout", py::arithmetic()) py::implicitly_convertible(); -py::class_(m, "GrVkAlloc") +py::class_(m, "GrVkAlloc") .def(py::init<>()) // TODO: Implement me! ; -py::class_(m, "GrVkYcbcrConversionInfo") +py::class_(m, "GrVkYcbcrConversionInfo") .def(py::init<>()) // TODO: Implement me! ; @@ -34,19 +35,19 @@ py::class_(m, "GrVkImageInfo", .def(py::init<>()) // .def(py::init( // [] (VkImage image, - // GrVkAlloc alloc, + // skgpu::VulkanAlloc alloc, // VkImageTiling imageTiling, // VkImageLayout layout, // VkFormat format, // uint32_t levelCount, // uint32_t currentQueueFamily, // GrProtected isProtected, - // const GrVkYcbcrConversionInfo* ycbcrConversionInfo) { + // const skgpu::VulkanYcbcrConversionInfo* ycbcrConversionInfo) { // return GrVkImageInfo( // image, alloc, imageTiling, layout, format, levelCount, // currentQueueFamily, isProtected, // (ycbcrConversionInfo) ? - // *ycbcrConversionInfo : GrVkYcbcrConversionInfo()); + // *ycbcrConversionInfo : skgpu::VulkanYcbcrConversionInfo()); // }), // py::arg("image"), py::arg("alloc"), py::arg("imageTiling"), // py::arg("layout"), py::arg("format"), py::arg("levelCount"), From c3052ad5d272dd1396dd5af7b48f5a7a4b0d668d Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 01:55:06 +0100 Subject: [PATCH 21/26] m128: SkRRect::radii now needs overload_cast() as a 2nd method is added. --- skia-m127/include/core/SkRRect.h 2024-06-14 23:04:43.000000000 +0100 +++ skia-m128/include/core/SkRRect.h 2024-07-26 22:23:05.000000000 +0100 @@ -269,6 +270,10 @@ @return x-axis and y-axis radii for one corner */ SkVector radii(Corner corner) const { return fRadii[corner]; } + /** + * Returns the corner radii for all four corners, in the same order as `Corner`. + */ + SkSpan radii() const { return SkSpan(fRadii, 4); } /** Returns bounds. Bounds may have zero width or zero height. Bounds right is greater than or equal to left; bounds bottom is greater than or equal to top. --- src/skia/Rect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skia/Rect.cpp b/src/skia/Rect.cpp index ff754f0a..4585eaf5 100644 --- a/src/skia/Rect.cpp +++ b/src/skia/Rect.cpp @@ -1665,7 +1665,7 @@ rrect :return: bounding box )docstring") - .def("radii", &SkRRect::radii, + .def("radii", py::overload_cast(&SkRRect::radii, py::const_), R"docstring( Returns scalar pair for radius of curve on x-axis and y-axis for one corner. From 14c6d68aeca8a6b113f5988cc9926b2beb8666ca Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 18:06:58 +0100 Subject: [PATCH 22/26] skia m128 patch plus adjustments --- .github/workflows/ci.yml | 2 +- patch/skia-m128-minimize-download.patch | 69 +++++++++++++++++++++++++ scripts/build_Linux.sh | 2 +- scripts/build_Windows.sh | 2 +- scripts/build_macOS.sh | 2 +- 5 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 patch/skia-m128-minimize-download.patch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6edeb8d..ac293ce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: skia key: linux-aarch64-skia-${{ github.sha }}-3rd-party - name: Pre-fetch skia deps - run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m127-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m127-minimize-download.patch + run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m128-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m128-minimize-download.patch - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Build skia 3rd-Party diff --git a/patch/skia-m128-minimize-download.patch b/patch/skia-m128-minimize-download.patch new file mode 100644 index 00000000..45480e9b --- /dev/null +++ b/patch/skia-m128-minimize-download.patch @@ -0,0 +1,69 @@ +diff --git a/DEPS b/DEPS +index c5f8974..70ec737 100644 +--- a/DEPS ++++ b/DEPS +@@ -23,52 +23,18 @@ vars = { + # ./tools/git-sync-deps + deps = { + "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@85edb907199e7a15e4ac30ea3fd0bbed021880ad", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", +- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. +- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. +- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@74e2fbfd1765df54bf285b5ff2ab763de802db37", +- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794", +- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@65a55c2ba891f6d2492477707f4a2e327a0b40dc", + "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe", +- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57", + "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@441f98d02deafd9b090aea568282b28f66a50e36", + "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@73720c7c9958e87b3d134a7574d1720ad2d24442", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@b74a7ecc93e283d059df51ee4f46961a782bcdb8", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", + "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4", +- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1", +- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0", + "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@ccfbe1c82a3b6dbe8647ceb36a3f9ee711fba3cf", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", + "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429", + "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", +- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", + "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@c4dfa69de7deecf52c6b53badbc8bb7be1a05e8c", + "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191", +- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. +- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. + "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@2b33822c849c05d9aa2effd4b182f4b64eebf962", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3", + "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@db5a00f8cebe81146cafabf89019674a3c4bf03d", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@d1b35bb1712e90fd0d341b7b56fa27984c7b3b0f", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@fabe9e2672334fdb9a622d42a2e8f94578952082", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@2cee0d5b1d8c34e26fd6d9992d3d428ac4c5139d", +- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@67522b34edde86dbb97e164280291f387ade55fc", +- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095", +- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", + "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596", + +diff --git a/bin/activate-emsdk b/bin/activate-emsdk +index 687ca9f..7167d8d 100755 +--- a/bin/activate-emsdk ++++ b/bin/activate-emsdk +@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') + EMSDK_VERSION = '3.1.44' + + def main(): ++ return + if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']: + # This platform cannot install emsdk at the provided version. See + # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5 diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index c8a6a379..eb04a210 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -60,7 +60,7 @@ git clone https://gn.googlesource.com/gn && \ # Build skia cd skia && \ - patch -p1 < ../patch/skia-m127-minimize-download.patch && \ + patch -p1 < ../patch/skia-m128-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ cp -f ../gn/out/gn bin/gn && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index e1b585cb..b36fd733 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -4,7 +4,7 @@ export PATH="${PWD}/depot_tools:$PATH" # Build skia cd skia && \ - patch -p1 < ../patch/skia-m127-minimize-download.patch && \ + patch -p1 < ../patch/skia-m128-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=' diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 83859bb1..2c9afa38 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,7 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m127-minimize-download.patch && \ + patch -p1 < ../patch/skia-m128-minimize-download.patch && \ patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From 667ee2b922f00c6a624cb6427d27faf942d6c138 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 18:41:06 +0100 Subject: [PATCH 23/26] Update README.md with README.m127.md and README.m128.md --- README.md | 2 +- relnotes/README.m127.md | 14 ++++++++++++++ relnotes/README.m128.md | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 relnotes/README.m127.md create mode 100644 relnotes/README.m128.md diff --git a/README.md b/README.md index e2a9a918..5bee0519 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ https://kyamagu.github.io/skia-python [README.m117](relnotes/README.m117.md), [README.m118](relnotes/README.m118.md), [README.m119](relnotes/README.m119.md), [README.m120](relnotes/README.m120.md), [README.m121](relnotes/README.m121.md), [README.m122](relnotes/README.m122.md), [README.m123](relnotes/README.m123.md), [README.m124](relnotes/README.m124.md), [README.m125](relnotes/README.m125.md), - [README.m126](relnotes/README.m126.md). + [README.m126](relnotes/README.m126.md), [README.m124](relnotes/README.m127.md), [README.m125](relnotes/README.m128.md). ## Contributing diff --git a/relnotes/README.m127.md b/relnotes/README.m127.md new file mode 100644 index 00000000..f6d09db7 --- /dev/null +++ b/relnotes/README.m127.md @@ -0,0 +1,14 @@ +Since m126: + +* CentOS 7 EOL on 1 Jul 2024: small update to how we build the packages; We now more explicitly + build for mac os 10.13+ in Skia. + +* Adding references and code snipplets to OpenGL settings for Apple users. fixes #214 + +* GrVkExtensionFlags & GrVkFeatureFlags removed upsteam. + +* Some redirections/aliases are added to allow newly written python codes to look like + their current C counterparts (in addition to supporting a m87-like API). + We also added some direct calls to currently APIs which were accessible + only via m87-like emulations. Re-enabled a few parameterized tests removed + during the m87->m116 transition. diff --git a/relnotes/README.m128.md b/relnotes/README.m128.md new file mode 100644 index 00000000..f491eaea --- /dev/null +++ b/relnotes/README.m128.md @@ -0,0 +1,5 @@ +Since m127: + +* Vulkan symbols are renamed to skgpu::* . We use the older GrVk* forms, + but will alias them to skgpu.Vulkan* , similar to upstream soon, so + that both m87-like and current continue to work. From e957098b07199ec910f6f7980448e8e537102503 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 19:06:37 +0100 Subject: [PATCH 24/26] m128: some skgpu.Vulkan* aliases to m87 GrVk* symbols --- src/skia/GrContext_vk.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/skia/GrContext_vk.cpp b/src/skia/GrContext_vk.cpp index c9c445ae..ccee030b 100644 --- a/src/skia/GrContext_vk.cpp +++ b/src/skia/GrContext_vk.cpp @@ -115,4 +115,8 @@ py::class_(m, "GrVkBackendContext", .def(py::init<>()) // TODO: Implement me! ; + +m.attr("skgpu").attr("VulkanBackendContext") = m.attr("GrVkBackendContext"); +m.attr("skgpu").attr("VulkanAlloc") = m.attr("GrVkAlloc"); +m.attr("skgpu").attr("VulkanYcbcrConversionInfo") = m.attr("GrVkYcbcrConversionInfo"); } From e4631f9bbcabc953bda206d2d504e96de3c8bec1 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 19:56:03 +0100 Subject: [PATCH 25/26] m128: missing skia.skgpu namespace initialization itself new skia.skgpu namespace, adapted from https://pybind11.readthedocs.io/en/stable/advanced/pycpp/object.html --- src/skia/GrContext_vk.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/skia/GrContext_vk.cpp b/src/skia/GrContext_vk.cpp index ccee030b..7a0705bd 100644 --- a/src/skia/GrContext_vk.cpp +++ b/src/skia/GrContext_vk.cpp @@ -116,6 +116,8 @@ py::class_(m, "GrVkBackendContext", // TODO: Implement me! ; +py::object SimpleNamespace = py::module_::import("types").attr("SimpleNamespace"); +m.attr("skgpu") = SimpleNamespace(); m.attr("skgpu").attr("VulkanBackendContext") = m.attr("GrVkBackendContext"); m.attr("skgpu").attr("VulkanAlloc") = m.attr("GrVkAlloc"); m.attr("skgpu").attr("VulkanYcbcrConversionInfo") = m.attr("GrVkYcbcrConversionInfo"); From fba93cc940cc8e1aaff4119d82a0cecb0769f415 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 27 Jul 2024 20:36:49 +0100 Subject: [PATCH 26/26] Re-wording README.m128.md now that we have the skia.skgpu namespace --- relnotes/README.m128.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/relnotes/README.m128.md b/relnotes/README.m128.md index f491eaea..026f6567 100644 --- a/relnotes/README.m128.md +++ b/relnotes/README.m128.md @@ -1,5 +1,6 @@ Since m127: * Vulkan symbols are renamed to skgpu::* . We use the older GrVk* forms, - but will alias them to skgpu.Vulkan* , similar to upstream soon, so - that both m87-like and current continue to work. + but also alias them to skgpu.Vulkan* , under the skia.skgpu namespace + (i.e. similar to upstream's skgpu::, with python syntax), so that both + m87-like and current continue to work.