Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ 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
# 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 '*' &&
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -116,12 +116,12 @@ 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*"
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
Expand Down
10 changes: 10 additions & 0 deletions docs/tutorial/canvas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
69 changes: 69 additions & 0 deletions patch/skia-m127-minimize-download.patch
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions relnotes/README.m116.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_Linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_Windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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='
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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="
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion skia
Submodule skia updated from 9097d7 to 1c8089
11 changes: 9 additions & 2 deletions src/skia/GrContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ py::class_<GrBackendRenderTarget>(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) {
Expand Down Expand Up @@ -1231,7 +1234,7 @@ py::class_<GrDirectContext, sk_sp<GrDirectContext>, GrRecordingContext>(m, "GrDi

#ifdef SK_VULKAN
.def_static("MakeVulkan",
py::overload_cast<const GrVkBackendContext&, const GrContextOptions&>(
py::overload_cast<const skgpu::VulkanBackendContext&, const GrContextOptions&>(
&GrDirectContexts::MakeVulkan),
R"docstring(
The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive
Expand All @@ -1243,7 +1246,7 @@ py::class_<GrDirectContext, sk_sp<GrDirectContext>, GrRecordingContext>(m, "GrDi
)docstring",
py::arg("backendContext"), py::arg("options"))
.def_static("MakeVulkan",
py::overload_cast<const GrVkBackendContext&>(
py::overload_cast<const skgpu::VulkanBackendContext&>(
&GrDirectContexts::MakeVulkan),
py::arg("backendContext"))
#endif
Expand Down Expand Up @@ -1321,6 +1324,10 @@ py::class_<GrDirectContext, sk_sp<GrDirectContext>, 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);
Expand Down
5 changes: 4 additions & 1 deletion src/skia/GrContext_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ py::class_<GrVkDrawableInfo>(m, "GrVkDrawableInfo")
;

// GrVkBackendContext.h
/* GrVkExtensionFlags & GrVkFeatureFlags removed in m127 */
/*
py::enum_<GrVkExtensionFlags>(m, "GrVkExtensionFlags", py::arithmetic())
.value("kEXT_debug_report_GrVkExtensionFlag",
GrVkExtensionFlags::kEXT_debug_report_GrVkExtensionFlag)
Expand All @@ -95,8 +97,9 @@ py::enum_<GrVkFeatureFlags>(m, "GrVkFeatureFlags", py::arithmetic())
.value("kSampleRateShading_GrVkFeatureFlag",
GrVkFeatureFlags::kSampleRateShading_GrVkFeatureFlag)
.export_values();
*/

py::class_<GrVkBackendContext>(m, "GrVkBackendContext",
py::class_<skgpu::VulkanBackendContext>(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
Expand Down
Loading