Skip to content

Commit db7d7fc

Browse files
authored
Merge pull request kyamagu#274 from HinTak/SkRuntimeEffect-binding
Sk runtime effect binding
2 parents 57e705c + e1e7ca5 commit db7d7fc

34 files changed

+1056
-71
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
key: linux-aarch64-skia-${{ github.sha }}-3rd-party
2626
- name: Pre-fetch skia deps
2727
if: ${{ steps.cache-skia.outputs.cache-hit != 'true' }}
28-
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m130-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m130-minimize-download.patch
28+
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m132-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m132-minimize-download.patch
2929
- name: Set up QEMU
3030
uses: docker/setup-qemu-action@v3
3131
- name: Build skia 3rd-Party
@@ -73,29 +73,89 @@ jobs:
7373
strategy:
7474
fail-fast: false
7575
matrix:
76-
os: [ubuntu-22.04, windows-2022, macos-12]
76+
os: [ubuntu-22.04, windows-2022, macos-13]
7777
arch: [auto64]
78-
cp: ["cp3{8,9,10,11,12}"]
78+
cp: ["cp3{10,11,12,13}"]
7979
include:
80-
- os: macos-12
80+
- os: macos-13
8181
arch: arm64
82-
cp: "cp3{8,9,10,11,12}"
82+
cp: "cp3{10,11,12,13}"
8383
# aarch64 is emulated and takes longer, build one wheel per job
8484
- os: ubuntu-22.04
8585
arch: aarch64
86-
cp: cp38
86+
cp: cp310
8787
- os: ubuntu-22.04
8888
arch: aarch64
89-
cp: cp39
89+
cp: cp311
9090
- os: ubuntu-22.04
9191
arch: aarch64
92-
cp: cp310
92+
cp: cp312
9393
- os: ubuntu-22.04
9494
arch: aarch64
95-
cp: cp311
95+
cp: cp313
96+
97+
steps:
98+
- uses: actions/checkout@v4
99+
with:
100+
submodules: true
101+
102+
- uses: actions/cache/restore@v4
103+
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
104+
with:
105+
path: |
106+
gn
107+
skia
108+
key: linux-aarch64-skia-${{ github.sha }}
109+
110+
- name: Set up QEMU
111+
if: runner.os == 'Linux' && matrix.arch == 'aarch64'
112+
uses: docker/setup-qemu-action@v3
113+
with:
114+
platforms: ${{ matrix.arch }}
115+
116+
- name: Build wheels
117+
uses: pypa/[email protected]
118+
env:
119+
CIBW_BUILD: "${{ matrix.cp }}-*"
120+
CIBW_SKIP: "*musllinux*"
121+
CIBW_ARCHS: ${{ matrix.arch }}
122+
CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0
123+
CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh
124+
CIBW_BEFORE_BUILD: pip install pybind11 numpy
125+
CIBW_TEST_REQUIRES: pytest pillow glfw
126+
CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl
127+
CIBW_TEST_COMMAND: python -m pytest {project}/tests
128+
CIBW_TEST_COMMAND_LINUX: >
129+
xvfb-run -s "-screen 0 640x480x24" python -m pytest {project}/tests
130+
CIBW_TEST_SKIP: "*-macosx_arm64"
131+
132+
- uses: actions/upload-artifact@v4
133+
with:
134+
name: wheel-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cp }}
135+
path: ./wheelhouse/*.whl
136+
137+
# identical to "build_wheels", except with the older pypa/[email protected]
138+
build_wheels_old:
139+
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) for ${{ matrix.cp }}
140+
needs: prebuild_linux_aarch64
141+
runs-on: ${{ matrix.os }}
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
os: [ubuntu-22.04, windows-2022, macos-13]
146+
arch: [auto64]
147+
cp: ["cp3{8,9}"]
148+
include:
149+
- os: macos-13
150+
arch: arm64
151+
cp: "cp3{8,9}"
152+
# aarch64 is emulated and takes longer, build one wheel per job
96153
- os: ubuntu-22.04
97154
arch: aarch64
98-
cp: cp312
155+
cp: cp38
156+
- os: ubuntu-22.04
157+
arch: aarch64
158+
cp: cp39
99159

100160
steps:
101161
- uses: actions/checkout@v4
@@ -139,7 +199,7 @@ jobs:
139199

140200
build_docs:
141201
name: Build docs
142-
needs: [build_wheels]
202+
needs: [build_wheels, build_wheels_old]
143203
runs-on: ubuntu-latest
144204
steps:
145205
- uses: actions/checkout@v4
@@ -169,7 +229,7 @@ jobs:
169229

170230
publish:
171231
name: Upload packages to PyPI
172-
needs: [build_wheels]
232+
needs: [build_wheels, build_wheels_old]
173233
runs-on: ubuntu-latest
174234
if: github.event_name == 'release' && github.event.action == 'published'
175235
permissions:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Binary package is available on PyPI:
1515
pip install skia-python
1616
```
1717

18-
Supported platforms: Python 3.8-3.12 (CPython) on
18+
Supported platforms: Python 3.8-3.13 (CPython) on
1919

2020
- Linux x86_64, aarch64
2121
- macOS x86_64, arm64
@@ -57,7 +57,8 @@ https://kyamagu.github.io/skia-python
5757
[README.m120](relnotes/README.m120.md), [README.m121](relnotes/README.m121.md), [README.m122](relnotes/README.m122.md),
5858
[README.m123](relnotes/README.m123.md), [README.m124](relnotes/README.m124.md), [README.m125](relnotes/README.m125.md),
5959
[README.m126](relnotes/README.m126.md), [README.m127](relnotes/README.m127.md), [README.m128](relnotes/README.m128.md),
60-
[README.m129](relnotes/README.m129.md), [README.m130](relnotes/README.m130.md).
60+
[README.m129](relnotes/README.m129.md), [README.m130](relnotes/README.m130.md), [README.m131](relnotes/README.m131.md),
61+
[README.m132](relnotes/README.m132.md).
6162

6263
## Contributing
6364

docs/tutorial/canvas.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ The following example uses glfw package to create an OpenGL context. Install
9191
glfw.window_hint(glfw.VISIBLE, glfw.FALSE)
9292
glfw.window_hint(glfw.STENCIL_BITS, 8)
9393
# see https://www.glfw.org/faq#macos
94-
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
95-
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2)
96-
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
97-
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
94+
if sys.platform.startswith("darwin"):
95+
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
96+
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2)
97+
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
98+
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
9899
window = glfw.create_window(640, 480, '', None, None)
99100
glfw.make_context_current(window)
100101
yield window
@@ -144,10 +145,11 @@ Here's a complete example:
144145
raise RuntimeError('glfw.init() failed')
145146
glfw.window_hint(glfw.STENCIL_BITS, 8)
146147
# see https://www.glfw.org/faq#macos
147-
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
148-
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2)
149-
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
150-
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
148+
if sys.platform.startswith("darwin"):
149+
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3)
150+
glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 2)
151+
glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True)
152+
glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE)
151153
window = glfw.create_window(WIDTH, HEIGHT, '', None, None)
152154
glfw.make_context_current(window)
153155
yield window
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff --git a/DEPS b/DEPS
2+
index a30e242..3d8dd72 100644
3+
--- a/DEPS
4+
+++ b/DEPS
5+
@@ -31,53 +31,18 @@ vars = {
6+
# ./tools/git-sync-deps
7+
deps = {
8+
"buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75",
9+
- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@78a694a1b82a01623226a418cf2f765c75e45c70",
10+
- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8",
11+
- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b",
12+
- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting.
13+
- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well.
14+
- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@f3c7cc5c580eb743829c78bb77df0c1e8f6a6ce3",
15+
- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07",
16+
- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794",
17+
- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@65a55c2ba891f6d2492477707f4a2e327a0b40dc",
18+
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
19+
- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe",
20+
- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57",
21+
"third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@624da0f593bb8d7e146b9f42b06d8e6c80d032a3",
22+
"third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@83af801b552111e37d9466a887e1783a0fb5f196",
23+
"third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@a070f9ebbe88dc71b248af9731dd49ec93f4e6e6",
24+
- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0",
25+
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4",
26+
- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13",
27+
- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456",
28+
- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000",
29+
- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1",
30+
- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0",
31+
"third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@ccfbe1c82a3b6dbe8647ceb36a3f9ee711fba3cf",
32+
- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3",
33+
"third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429",
34+
"third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f",
35+
- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96",
36+
- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d",
37+
- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419",
38+
- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553",
39+
- "third_party/externals/partition_alloc" : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@ca4487e127c2e071da5d4a36a9f71fd7b65b1434",
40+
- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394",
41+
"third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
42+
- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@7a9a492a38b7c701f7c96a15a76046aed8f8c0c3",
43+
"third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191",
44+
- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories.
45+
- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well.
46+
"third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@8f346c5caf5a624f42324ffb88167fc90992cab5",
47+
- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3",
48+
"third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@50bc4debdc3eec5045edbeb8ce164090e29b91f3",
49+
- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@42b315c15b1ff941b46bb3949c105e5386be8717",
50+
- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620",
51+
- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@d91597a82f881d473887b560a03a7edf2720b72c",
52+
- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@eb9b6043be165f06c7ec78fadbb1ff773c5fc19c",
53+
- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@bfd85956e1b4c1c79842ce857fc7fb15adb8a573",
54+
- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095",
55+
- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
56+
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8",
57+
"third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596",
58+
59+
diff --git a/bin/activate-emsdk b/bin/activate-emsdk
60+
index 687ca9f..7167d8d 100755
61+
--- a/bin/activate-emsdk
62+
+++ b/bin/activate-emsdk
63+
@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
64+
EMSDK_VERSION = '3.1.44'
65+
66+
def main():
67+
+ return
68+
if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']:
69+
# This platform cannot install emsdk at the provided version. See
70+
# https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5

0 commit comments

Comments
 (0)