@shopify/react-native-skia 2.4.15 → 2.4.17
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/CMakeLists.txt +69 -0
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +19 -7
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +7 -0
- package/apple/RNSkApplePlatformContext.mm +4 -0
- package/cpp/api/JsiSkApi.h +31 -0
- package/cpp/api/JsiSkImageFactory.h +69 -1
- package/cpp/api/JsiSkImageFilter.h +1 -0
- package/cpp/api/JsiSkPath.h +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +0 -2
- package/cpp/jsi2/EnumMapper.h +45 -0
- package/cpp/jsi2/JSIConverter.h +468 -0
- package/cpp/jsi2/NativeObject.h +598 -0
- package/cpp/jsi2/Promise.cpp +44 -0
- package/cpp/jsi2/Promise.h +35 -0
- package/cpp/rnskia/RNDawnContext.h +114 -0
- package/cpp/rnskia/RNSkManager.cpp +41 -1
- package/cpp/rnwgpu/ArrayBuffer.h +68 -0
- package/cpp/rnwgpu/api/Convertors.h +761 -0
- package/cpp/rnwgpu/api/External.h +12 -0
- package/cpp/rnwgpu/api/GPU.cpp +129 -0
- package/cpp/rnwgpu/api/GPU.h +57 -0
- package/cpp/rnwgpu/api/GPUAdapter.cpp +178 -0
- package/cpp/rnwgpu/api/GPUAdapter.h +59 -0
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +57 -0
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
- package/cpp/rnwgpu/api/GPUBindGroup.h +51 -0
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +52 -0
- package/cpp/rnwgpu/api/GPUBuffer.cpp +97 -0
- package/cpp/rnwgpu/api/GPUBuffer.h +87 -0
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +45 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +179 -0
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +111 -0
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +79 -0
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +36 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +60 -0
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +85 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +12 -0
- package/cpp/rnwgpu/api/GPUComputePipeline.h +60 -0
- package/cpp/rnwgpu/api/GPUDevice.cpp +434 -0
- package/cpp/rnwgpu/api/GPUDevice.h +174 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +7 -0
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +40 -0
- package/cpp/rnwgpu/api/GPUError.h +35 -0
- package/cpp/rnwgpu/api/GPUExtent3D.h +66 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +45 -0
- package/cpp/rnwgpu/api/GPUFeatures.h +212 -0
- package/cpp/rnwgpu/api/GPUInternalError.h +31 -0
- package/cpp/rnwgpu/api/GPUOrigin2D.h +55 -0
- package/cpp/rnwgpu/api/GPUOrigin3D.h +62 -0
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +33 -0
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +45 -0
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
- package/cpp/rnwgpu/api/GPUQuerySet.h +73 -0
- package/cpp/rnwgpu/api/GPUQueue.cpp +169 -0
- package/cpp/rnwgpu/api/GPUQueue.h +84 -0
- package/cpp/rnwgpu/api/GPURenderBundle.h +44 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +131 -0
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +110 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +165 -0
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +130 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
- package/cpp/rnwgpu/api/GPURenderPipeline.h +61 -0
- package/cpp/rnwgpu/api/GPUSampler.h +44 -0
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +51 -0
- package/cpp/rnwgpu/api/GPUShaderModule.h +66 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +129 -0
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +131 -0
- package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
- package/cpp/rnwgpu/api/GPUTexture.h +150 -0
- package/cpp/rnwgpu/api/GPUTextureView.h +44 -0
- package/cpp/rnwgpu/api/GPUValidationError.h +32 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +64 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +71 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +97 -0
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +57 -0
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +52 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +39 -0
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +66 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +58 -0
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +29 -0
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +45 -0
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +45 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +58 -0
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +67 -0
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +103 -0
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +99 -0
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +38 -0
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +71 -0
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +73 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +65 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +81 -0
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +54 -0
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +22 -0
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +54 -0
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +57 -0
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +69 -0
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +61 -0
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +55 -0
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +43 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +45 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +80 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +81 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +101 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +92 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +58 -0
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +103 -0
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +45 -0
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +110 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +60 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +25 -0
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +64 -0
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +59 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +91 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +29 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +91 -0
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +64 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +53 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +62 -0
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +73 -0
- package/cpp/rnwgpu/api/descriptors/Unions.h +1984 -0
- package/cpp/rnwgpu/async/AsyncDispatcher.h +28 -0
- package/cpp/rnwgpu/async/AsyncRunner.cpp +181 -0
- package/cpp/rnwgpu/async/AsyncRunner.h +56 -0
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +181 -0
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +55 -0
- package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp +23 -0
- package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.h +22 -0
- package/lib/commonjs/Platform/Platform.web.js +1 -2
- package/lib/commonjs/Platform/Platform.web.js.map +1 -1
- package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -4
- package/lib/commonjs/renderer/Canvas.js +4 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/Group.js +1 -2
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/FitBox.js +1 -2
- package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
- package/lib/commonjs/skia/types/ContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +20 -0
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +17 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -0
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +6 -0
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +2 -2
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +6 -0
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js +2 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +4 -4
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/web/WithSkiaWeb.js +1 -2
- package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +1 -4
- package/lib/module/renderer/Canvas.js +3 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/types/ContourMeasure.js.map +1 -1
- package/lib/module/skia/types/Image/ImageFactory.d.ts +20 -0
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +17 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -0
- package/lib/module/skia/web/JsiSkImageFactory.js +6 -0
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +2 -2
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +6 -0
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js +4 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +3 -2
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +2 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -0
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +1 -1
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -4
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +20 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +17 -0
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/package.json +20 -16
- package/react-native-skia.podspec +52 -13
- package/scripts/install-skia.mjs +99 -48
- package/src/external/reanimated/buffers.ts +1 -1
- package/src/renderer/Canvas.tsx +3 -2
- package/src/skia/types/ContourMeasure.tsx +1 -2
- package/src/skia/types/Image/ImageFactory.ts +22 -0
- package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -2
- package/src/skia/types/Skia.ts +17 -0
- package/src/skia/web/JsiSkImageFactory.ts +8 -0
- package/src/skia/web/JsiSkia.ts +6 -0
- package/src/sksg/Recorder/commands/ColorFilters.ts +3 -2
- package/src/sksg/Recorder/commands/ImageFilters.ts +3 -2
- package/src/sksg/Recorder/commands/PathEffects.ts +3 -2
- package/src/sksg/Recorder/commands/Shaders.ts +3 -2
- package/src/specs/SkiaPictureViewNativeComponent.ts +7 -0
- package/src/views/SkiaPictureView.web.tsx +4 -1
package/scripts/install-skia.mjs
CHANGED
|
@@ -8,6 +8,12 @@ import { fileURLToPath } from "url";
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
|
+
// Allow skipping download via environment variable (useful for CI builds)
|
|
12
|
+
if (process.env.SKIP_SKIA_DOWNLOAD === '1' || process.env.SKIP_SKIA_DOWNLOAD === 'true') {
|
|
13
|
+
console.log("⏭️ Skipping Skia download (SKIP_SKIA_DOWNLOAD is set)");
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
const repo = "shopify/react-native-skia";
|
|
12
18
|
|
|
13
19
|
const packageJsonPath = path.join(__dirname, "..", "package.json");
|
|
@@ -42,13 +48,24 @@ const updateSkiaChecksums = (checksums, graphite = false) => {
|
|
|
42
48
|
|
|
43
49
|
const GRAPHITE = !!process.env.SK_GRAPHITE;
|
|
44
50
|
const prefix = GRAPHITE ? "skia-graphite" : "skia";
|
|
51
|
+
|
|
52
|
+
// Build artifact names based on platform and Graphite mode
|
|
45
53
|
const names = [
|
|
46
54
|
`${prefix}-android-arm`,
|
|
47
55
|
`${prefix}-android-arm-64`,
|
|
48
56
|
`${prefix}-android-arm-x64`,
|
|
49
57
|
`${prefix}-android-arm-x86`,
|
|
50
|
-
`${prefix}-apple-xcframeworks`,
|
|
58
|
+
`${prefix}-apple-ios-xcframeworks`,
|
|
59
|
+
`${prefix}-apple-macos-xcframeworks`,
|
|
51
60
|
];
|
|
61
|
+
|
|
62
|
+
// Add tvOS only for non-Graphite builds
|
|
63
|
+
if (!GRAPHITE) {
|
|
64
|
+
names.push(`${prefix}-apple-tvos-xcframeworks`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Note: macCatalyst is now included in the iOS xcframeworks, no separate download needed
|
|
68
|
+
|
|
52
69
|
if (GRAPHITE) {
|
|
53
70
|
names.push(`${prefix}-headers`);
|
|
54
71
|
}
|
|
@@ -108,7 +125,9 @@ const runCommandWithOutput = (command, args, options = {}) => {
|
|
|
108
125
|
const skiaDir = path.resolve(__dirname, "../../../externals/skia");
|
|
109
126
|
|
|
110
127
|
const checkoutSkiaBranch = async (version) => {
|
|
111
|
-
|
|
128
|
+
// Extract base version (e.g., "m144a" -> "m144", "m142" -> "m142")
|
|
129
|
+
const baseVersion = version.match(/^(m\d+)/)?.[1] || version;
|
|
130
|
+
const branchName = `chrome/${baseVersion}`;
|
|
112
131
|
|
|
113
132
|
// Check if the skia directory exists and is a git repo
|
|
114
133
|
// (won't exist when installed via npm - submodule is not included in the package)
|
|
@@ -142,8 +161,7 @@ const checkoutSkiaBranch = async (version) => {
|
|
|
142
161
|
|
|
143
162
|
console.log(` ✓ Successfully checked out ${branchName}`);
|
|
144
163
|
} catch (error) {
|
|
145
|
-
|
|
146
|
-
console.error(" Headers may not match the prebuilt binaries!");
|
|
164
|
+
throw new Error(`Failed to checkout branch ${branchName}: ${error.message}`);
|
|
147
165
|
}
|
|
148
166
|
};
|
|
149
167
|
|
|
@@ -346,11 +364,18 @@ const calculateLibraryChecksums = () => {
|
|
|
346
364
|
}
|
|
347
365
|
}
|
|
348
366
|
|
|
349
|
-
// Apple
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
367
|
+
// Apple platforms - calculate separate checksums for each platform
|
|
368
|
+
// Note: maccatalyst is included in iOS xcframeworks, not a separate artifact
|
|
369
|
+
const applePlatforms = GRAPHITE
|
|
370
|
+
? ["ios", "macos"]
|
|
371
|
+
: ["ios", "tvos", "macos"];
|
|
372
|
+
|
|
373
|
+
for (const platform of applePlatforms) {
|
|
374
|
+
const platformDir = path.join(libsDir, "apple", platform);
|
|
375
|
+
const checksum = calculateDirectoryChecksum(platformDir);
|
|
376
|
+
if (checksum) {
|
|
377
|
+
checksums[`apple-${platform}-xcframeworks`] = checksum;
|
|
378
|
+
}
|
|
354
379
|
}
|
|
355
380
|
|
|
356
381
|
return checksums;
|
|
@@ -400,10 +425,16 @@ const areBinariesInstalled = () => {
|
|
|
400
425
|
}
|
|
401
426
|
}
|
|
402
427
|
|
|
403
|
-
// Check for Apple frameworks
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
428
|
+
// Check for Apple platform frameworks
|
|
429
|
+
const applePlatforms = GRAPHITE
|
|
430
|
+
? ["ios", "macos"]
|
|
431
|
+
: ["ios", "tvos", "macos", "maccatalyst"];
|
|
432
|
+
|
|
433
|
+
for (const platform of applePlatforms) {
|
|
434
|
+
const platformDir = path.join(libsDir, "apple", platform);
|
|
435
|
+
if (!fs.existsSync(platformDir) || fs.readdirSync(platformDir).length === 0) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
407
438
|
}
|
|
408
439
|
|
|
409
440
|
return true;
|
|
@@ -523,45 +554,65 @@ const main = async () => {
|
|
|
523
554
|
}
|
|
524
555
|
});
|
|
525
556
|
|
|
526
|
-
// Create apple directory structure
|
|
557
|
+
// Create apple directory structure - now per-platform
|
|
527
558
|
const appleDir = path.join(libsDir, "apple");
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
fs.
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
559
|
+
fs.mkdirSync(appleDir, { recursive: true });
|
|
560
|
+
|
|
561
|
+
// Define the platform artifacts to process
|
|
562
|
+
// Note: maccatalyst is included in iOS xcframeworks, not a separate artifact
|
|
563
|
+
const applePlatformArtifacts = GRAPHITE
|
|
564
|
+
? [
|
|
565
|
+
{ artifact: `${prefix}-apple-ios-xcframeworks`, srcSubdir: "ios", dest: "ios" },
|
|
566
|
+
{ artifact: `${prefix}-apple-macos-xcframeworks`, srcSubdir: "macos", dest: "macos" },
|
|
567
|
+
]
|
|
568
|
+
: [
|
|
569
|
+
{ artifact: `${prefix}-apple-ios-xcframeworks`, srcSubdir: "ios", dest: "ios" },
|
|
570
|
+
{ artifact: `${prefix}-apple-tvos-xcframeworks`, srcSubdir: "tvos", dest: "tvos" },
|
|
571
|
+
{ artifact: `${prefix}-apple-macos-xcframeworks`, srcSubdir: "macos", dest: "macos" },
|
|
572
|
+
];
|
|
573
|
+
|
|
574
|
+
applePlatformArtifacts.forEach(({ artifact, srcSubdir, dest }) => {
|
|
575
|
+
// The tar file extracts to artifact_name/srcSubdir (e.g., skia-apple-ios-xcframeworks/ios)
|
|
576
|
+
const appleSrcDir = path.join(artifactsDir, artifact, srcSubdir);
|
|
577
|
+
const destDir = path.join(appleDir, dest);
|
|
578
|
+
|
|
579
|
+
console.log(` Checking ${appleSrcDir} -> ${destDir}`);
|
|
580
|
+
if (fs.existsSync(appleSrcDir)) {
|
|
581
|
+
console.log(` ✓ Copying ${artifact}/${srcSubdir}`);
|
|
582
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
583
|
+
|
|
584
|
+
// Copy all xcframeworks
|
|
585
|
+
fs.readdirSync(appleSrcDir).forEach((item) => {
|
|
586
|
+
const srcPath = path.join(appleSrcDir, item);
|
|
587
|
+
const destPath = path.join(destDir, item);
|
|
588
|
+
|
|
589
|
+
if (fs.lstatSync(srcPath).isDirectory()) {
|
|
590
|
+
// Copy directory recursively
|
|
591
|
+
const copyDir = (src, dest) => {
|
|
592
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
593
|
+
fs.readdirSync(src).forEach((file) => {
|
|
594
|
+
const srcFile = path.join(src, file);
|
|
595
|
+
const destFile = path.join(dest, file);
|
|
596
|
+
if (fs.lstatSync(srcFile).isDirectory()) {
|
|
597
|
+
copyDir(srcFile, destFile);
|
|
598
|
+
} else {
|
|
599
|
+
fs.copyFileSync(srcFile, destFile);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
copyDir(srcPath, destPath);
|
|
604
|
+
} else {
|
|
605
|
+
fs.copyFileSync(srcPath, destPath);
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
} else {
|
|
609
|
+
console.log(` ✗ Source directory not found: ${appleSrcDir}`);
|
|
610
|
+
}
|
|
611
|
+
});
|
|
562
612
|
|
|
563
613
|
// Create or remove Graphite marker files based on build type
|
|
564
614
|
const androidMarkerFile = path.join(androidDir, "graphite.enabled");
|
|
615
|
+
// Apple marker file stays at the apple root level (libs/apple/graphite.enabled)
|
|
565
616
|
const appleMarkerFile = path.join(appleDir, "graphite.enabled");
|
|
566
617
|
|
|
567
618
|
if (GRAPHITE) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo } from "react";
|
|
2
|
-
import type { WorkletFunction } from "react-native-
|
|
2
|
+
import type { WorkletFunction } from "react-native-worklets";
|
|
3
3
|
|
|
4
4
|
import type { SkColor, SkHostRect, SkPoint, SkRSXform } from "../../skia/types";
|
|
5
5
|
import { Skia } from "../../skia";
|
package/src/renderer/Canvas.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
View,
|
|
16
16
|
ViewProps,
|
|
17
17
|
} from "react-native";
|
|
18
|
-
import type {
|
|
18
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
19
19
|
|
|
20
20
|
import Rea from "../external/reanimated/ReanimatedProxy";
|
|
21
21
|
import { SkiaViewNativeId } from "../views/SkiaViewNativeId";
|
|
@@ -113,7 +113,8 @@ export const Canvas = ({
|
|
|
113
113
|
// @ts-expect-error
|
|
114
114
|
measure(viewRef.current.canvasRef)
|
|
115
115
|
: { width: 0, height: 0 }
|
|
116
|
-
:
|
|
116
|
+
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
+
measure(viewRef as any);
|
|
117
118
|
if (result) {
|
|
118
119
|
const { width, height } = result;
|
|
119
120
|
if (onSize.value.width !== width || onSize.value.height !== height) {
|
|
@@ -36,8 +36,7 @@ export interface SkContourMeasure extends SkJSIInstance<"ContourMeasure"> {
|
|
|
36
36
|
length(): number;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export interface SkContourMeasureIter
|
|
40
|
-
extends SkJSIInstance<"ContourMeasureIter"> {
|
|
39
|
+
export interface SkContourMeasureIter extends SkJSIInstance<"ContourMeasureIter"> {
|
|
41
40
|
/**
|
|
42
41
|
* Iterates through contours in path, returning a contour-measure object for each contour
|
|
43
42
|
* in the path. Returns null when it is done.
|
|
@@ -94,4 +94,26 @@ export interface ImageFactory {
|
|
|
94
94
|
* @param bytesPerRow
|
|
95
95
|
*/
|
|
96
96
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Creates an SkImage from a WebGPU texture.
|
|
100
|
+
* This allows using textures rendered by WebGPU in Skia drawings.
|
|
101
|
+
*
|
|
102
|
+
* Note: This method is only available when the Graphite backend is enabled.
|
|
103
|
+
*
|
|
104
|
+
* @param texture - A GPUTexture object from the WebGPU API
|
|
105
|
+
* @returns An SkImage wrapping the texture, or throws if the texture is invalid
|
|
106
|
+
*/
|
|
107
|
+
MakeImageFromTexture(texture: GPUTexture): SkImage;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Creates a WebGPU texture from an SkImage.
|
|
111
|
+
* This allows using Skia images in WebGPU rendering pipelines.
|
|
112
|
+
*
|
|
113
|
+
* Note: This method is only available when the Graphite backend is enabled.
|
|
114
|
+
*
|
|
115
|
+
* @param image - An SkImage to convert to a texture
|
|
116
|
+
* @returns A GPUTexture containing the image data, or throws if conversion fails
|
|
117
|
+
*/
|
|
118
|
+
MakeTextureFromImage(image: SkImage): GPUTexture;
|
|
97
119
|
}
|
|
@@ -10,8 +10,7 @@ export interface SkSLUniform {
|
|
|
10
10
|
isInteger: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export interface SkRuntimeShaderBuilder
|
|
14
|
-
extends SkJSIInstance<"RuntimeShaderBuilder"> {
|
|
13
|
+
export interface SkRuntimeShaderBuilder extends SkJSIInstance<"RuntimeShaderBuilder"> {
|
|
15
14
|
setUniform(name: string, value: readonly number[]): void;
|
|
16
15
|
}
|
|
17
16
|
|
package/src/skia/types/Skia.ts
CHANGED
|
@@ -108,4 +108,21 @@ export interface Skia {
|
|
|
108
108
|
Context(surface: bigint, width: number, height: number): SkiaContext;
|
|
109
109
|
NativeBuffer: NativeBufferFactory;
|
|
110
110
|
Recorder(): JsiRecorder;
|
|
111
|
+
/**
|
|
112
|
+
* Returns whether the Graphite backend is enabled and WebGPU is available.
|
|
113
|
+
*
|
|
114
|
+
* @returns true if Graphite/WebGPU is available, false otherwise
|
|
115
|
+
*/
|
|
116
|
+
hasDevice(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Returns the shared WebGPU device used by Skia's Graphite backend.
|
|
119
|
+
* This allows direct access to the GPU device for WebGPU operations.
|
|
120
|
+
*
|
|
121
|
+
* Note: This method is only available when the Graphite backend is enabled.
|
|
122
|
+
* Use hasDevice() to check availability before calling this method.
|
|
123
|
+
*
|
|
124
|
+
* @returns The GPUDevice used by Skia
|
|
125
|
+
* @throws Error if Graphite backend is not enabled
|
|
126
|
+
*/
|
|
127
|
+
getDevice(): GPUDevice;
|
|
111
128
|
}
|
|
@@ -101,4 +101,12 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
101
101
|
}
|
|
102
102
|
return new JsiSkImage(this.CanvasKit, image);
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
MakeImageFromTexture(_texture: GPUTexture): SkImage {
|
|
106
|
+
return throwNotImplementedOnRNWeb<SkImage>();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
MakeTextureFromImage(_image: SkImage): GPUTexture {
|
|
110
|
+
return throwNotImplementedOnRNWeb<GPUTexture>();
|
|
111
|
+
}
|
|
104
112
|
}
|
package/src/skia/web/JsiSkia.ts
CHANGED
|
@@ -140,4 +140,10 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
|
|
140
140
|
Recorder: () => {
|
|
141
141
|
return throwNotImplementedOnRNWeb<JsiRecorder>();
|
|
142
142
|
},
|
|
143
|
+
getDevice: () => {
|
|
144
|
+
return throwNotImplementedOnRNWeb<GPUDevice>();
|
|
145
|
+
},
|
|
146
|
+
hasDevice: () => {
|
|
147
|
+
return false;
|
|
148
|
+
},
|
|
143
149
|
});
|
|
@@ -27,8 +27,9 @@ type Props = {
|
|
|
27
27
|
[NodeType.SRGBToLinearGammaColorFilter]: Record<string, never>;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
interface PushColorFilter<
|
|
31
|
-
extends
|
|
30
|
+
interface PushColorFilter<
|
|
31
|
+
T extends keyof Props,
|
|
32
|
+
> extends Command<CommandType.PushColorFilter> {
|
|
32
33
|
colorFilterType: T;
|
|
33
34
|
props: Props[T];
|
|
34
35
|
}
|
|
@@ -224,8 +224,9 @@ type Props = {
|
|
|
224
224
|
[NodeType.RuntimeShaderImageFilter]: RuntimeShaderImageFilterProps;
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
interface PushImageFilter<
|
|
228
|
-
extends
|
|
227
|
+
interface PushImageFilter<
|
|
228
|
+
T extends keyof Props,
|
|
229
|
+
> extends Command<CommandType.PushImageFilter> {
|
|
229
230
|
imageFilterType: T;
|
|
230
231
|
props: Props[T];
|
|
231
232
|
}
|
|
@@ -121,8 +121,9 @@ type Props = {
|
|
|
121
121
|
[NodeType.Line2DPathEffect]: Line2DPathEffectProps;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
interface PushPathEffect<
|
|
125
|
-
extends
|
|
124
|
+
interface PushPathEffect<
|
|
125
|
+
T extends keyof Props,
|
|
126
|
+
> extends Command<CommandType.PushPathEffect> {
|
|
126
127
|
pathEffectType: T;
|
|
127
128
|
props: Props[T];
|
|
128
129
|
}
|
|
@@ -257,8 +257,9 @@ type Props = {
|
|
|
257
257
|
[NodeType.Blend]: BlendProps;
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
-
interface PushShader<
|
|
261
|
-
extends
|
|
260
|
+
interface PushShader<
|
|
261
|
+
T extends keyof Props,
|
|
262
|
+
> extends Command<CommandType.PushShader> {
|
|
262
263
|
shaderType: T;
|
|
263
264
|
props: Props[T];
|
|
264
265
|
children: number;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
2
2
|
import type { ViewProps } from "react-native";
|
|
3
|
+
import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
4
|
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings
|
|
4
7
|
export interface NativeProps extends ViewProps {
|
|
5
8
|
debug?: boolean;
|
|
6
9
|
opaque?: boolean;
|
|
7
10
|
colorSpace?: string;
|
|
8
11
|
androidWarmup?: boolean;
|
|
12
|
+
pointerEvents?: WithDefault<
|
|
13
|
+
"auto" | "none" | "box-none" | "box-only",
|
|
14
|
+
"auto"
|
|
15
|
+
>;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
// eslint-disable-next-line import/no-default-export
|
|
@@ -419,7 +419,10 @@ export const SkiaPictureView = (props: SkiaPictureViewProps) => {
|
|
|
419
419
|
const { debug = false, ref: _ref, ...viewProps } = props;
|
|
420
420
|
return (
|
|
421
421
|
<Platform.View {...viewProps} onLayout={onLayoutEvent}>
|
|
422
|
-
<canvas
|
|
422
|
+
<canvas
|
|
423
|
+
ref={canvasRef}
|
|
424
|
+
style={{ display: "block", width: "100%", height: "100%" }}
|
|
425
|
+
/>
|
|
423
426
|
</Platform.View>
|
|
424
427
|
);
|
|
425
428
|
};
|