react-native-skia 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +17 -0
- package/cpp/rnskia/RNDawnContext.h +6 -0
- package/package.json +7 -7
- package/react-native-skia.podspec +18 -1
package/android/build.gradle
CHANGED
|
@@ -76,7 +76,24 @@ def skiaLibsPath = useGraphite
|
|
|
76
76
|
// Graphite build's Dawn release tag (libs/.dawn-version) with the tag
|
|
77
77
|
// react-native-webgpu declares in its package.json `dawn` field.
|
|
78
78
|
if (useGraphite) {
|
|
79
|
+
// Fail early rather than with a ninja "missing and no known rule" error.
|
|
80
|
+
def missingDawn = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"].findAll {
|
|
81
|
+
!file("${skiaLibsPath}/${it}/libwebgpu_dawn.so").exists()
|
|
82
|
+
}
|
|
83
|
+
if (!missingDawn.isEmpty()) {
|
|
84
|
+
throw new GradleException(
|
|
85
|
+
"react-native-skia: libwebgpu_dawn.so not found in ${skiaLibsPath} " +
|
|
86
|
+
"for ${missingDawn.join(', ')}. The installed react-native-skia-graphite-android " +
|
|
87
|
+
"package does not ship the shared Dawn library this Graphite build links against. " +
|
|
88
|
+
"Upgrade it and rebuild.")
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// In-repo builds write the marker into libs/, npm installs ship it in the
|
|
92
|
+
// react-native-skia-graphite-android package.
|
|
79
93
|
def dawnMarker = file("${projectDir}/../libs/.dawn-version")
|
|
94
|
+
if (!dawnMarker.exists()) {
|
|
95
|
+
dawnMarker = file("${skiaLibsPath}/.dawn-version")
|
|
96
|
+
}
|
|
80
97
|
def webgpuDir = null
|
|
81
98
|
try {
|
|
82
99
|
webgpuDir = resolveNodePackage('react-native-webgpu', projectDir)
|
|
@@ -144,6 +144,11 @@ public:
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
sk_sp<SkImage> MakeImageFromBuffer(void *buffer) {
|
|
147
|
+
#if defined(__ANDROID__) && __ANDROID_API__ < 26
|
|
148
|
+
// AHardwareBuffer is only available from API 26
|
|
149
|
+
(void)buffer;
|
|
150
|
+
return nullptr;
|
|
151
|
+
#else
|
|
147
152
|
#ifdef __APPLE__
|
|
148
153
|
wgpu::SharedTextureMemoryIOSurfaceDescriptor platformDesc;
|
|
149
154
|
auto ioSurface = CVPixelBufferGetIOSurface((CVPixelBufferRef)buffer);
|
|
@@ -213,6 +218,7 @@ public:
|
|
|
213
218
|
return nullptr;
|
|
214
219
|
}
|
|
215
220
|
return nullptr;
|
|
221
|
+
#endif
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
// Create offscreen surface
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
9
9
|
},
|
|
10
10
|
"title": "React Native Skia",
|
|
11
|
-
"version": "3.0.
|
|
11
|
+
"version": "3.0.1",
|
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
|
13
13
|
"main": "lib/module/index.js",
|
|
14
14
|
"react-native": "src/index.ts",
|
|
@@ -142,15 +142,15 @@
|
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
144
|
"canvaskit-wasm": "0.41.0",
|
|
145
|
-
"react-native-skia-graphite-android": "154.0.
|
|
146
|
-
"react-native-skia-graphite-apple-ios": "154.0.
|
|
147
|
-
"react-native-skia-graphite-apple-macos": "154.0.
|
|
145
|
+
"react-native-skia-graphite-android": "154.0.1",
|
|
146
|
+
"react-native-skia-graphite-apple-ios": "154.0.1",
|
|
147
|
+
"react-native-skia-graphite-apple-macos": "154.0.1",
|
|
148
148
|
"react-reconciler": "0.31.0"
|
|
149
149
|
},
|
|
150
150
|
"graphiteDependencies": {
|
|
151
|
-
"react-native-skia-graphite-android": "154.0.
|
|
152
|
-
"react-native-skia-graphite-apple-ios": "154.0.
|
|
153
|
-
"react-native-skia-graphite-apple-macos": "154.0.
|
|
151
|
+
"react-native-skia-graphite-android": "154.0.1",
|
|
152
|
+
"react-native-skia-graphite-apple-ios": "154.0.1",
|
|
153
|
+
"react-native-skia-graphite-apple-macos": "154.0.1"
|
|
154
154
|
},
|
|
155
155
|
"eslintIgnore": [
|
|
156
156
|
"node_modules/",
|
|
@@ -37,6 +37,11 @@ install_apple_skia_libs = lambda do |base_dir, packages|
|
|
|
37
37
|
src = File.join(pkg_dir, 'libs')
|
|
38
38
|
next unless Dir.exist?(src) && !Dir.glob(File.join(src, '*.xcframework')).empty?
|
|
39
39
|
|
|
40
|
+
# Graphite packages carry the Dawn release tag they ship (libs/.dawn-version),
|
|
41
|
+
# used below for the react-native-webgpu version check.
|
|
42
|
+
dawn_version = File.join(src, '.dawn-version')
|
|
43
|
+
FileUtils.cp(dawn_version, File.join(base_dir, 'libs', '.dawn-version')) if File.exist?(dawn_version)
|
|
44
|
+
|
|
40
45
|
version = JSON.parse(File.read(File.join(pkg_dir, 'package.json')))['version'].to_s
|
|
41
46
|
dest = File.join(base_dir, 'libs', platform)
|
|
42
47
|
marker = File.join(dest, '.version')
|
|
@@ -110,7 +115,19 @@ if use_graphite && has_webgpu_pkg
|
|
|
110
115
|
Pod::UI.puts "react-native-skia: Dawn versions match (#{skia_dawn})"
|
|
111
116
|
end
|
|
112
117
|
end
|
|
113
|
-
|
|
118
|
+
if use_graphite && !has_webgpu_pkg
|
|
119
|
+
# CocoaPods silently skips missing vendored frameworks, which would surface
|
|
120
|
+
# later as undefined dawn::native symbols at link time. Fail early instead.
|
|
121
|
+
%w[ios macos].each do |platform|
|
|
122
|
+
platform_dir = File.join(__dir__, 'libs', platform)
|
|
123
|
+
# A missing libs/<platform> is reported by the prebuilt binaries check below.
|
|
124
|
+
next if !Dir.exist?(platform_dir) || Dir.exist?(File.join(platform_dir, 'libwebgpu_dawn.xcframework'))
|
|
125
|
+
raise "react-native-skia: libwebgpu_dawn.xcframework not found in libs/#{platform}. " \
|
|
126
|
+
"The installed #{apple_skia_packages[platform]} package does not ship the shared " \
|
|
127
|
+
"Dawn library this Graphite build links against. Upgrade it, then run `pod install` again."
|
|
128
|
+
end
|
|
129
|
+
framework_names += ['libwebgpu_dawn']
|
|
130
|
+
end
|
|
114
131
|
|
|
115
132
|
# Verify that the prebuilt binaries are available (copied in above from the npm
|
|
116
133
|
# packages, or downloaded by install-skia-graphite for in-repo Graphite builds).
|