@shopify/react-native-skia 2.6.4 → 2.6.6
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 +8 -4
- package/android/build.gradle +22 -3
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +62 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +35 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +17 -0
- package/apple/RNSkApplePlatformContext.h +2 -0
- package/apple/RNSkApplePlatformContext.mm +71 -0
- package/apple/RNWebGPUAppleNativeBuffer.mm +33 -0
- package/cpp/api/JsiNativeBuffer.h +9 -1
- package/cpp/api/JsiSkAnimatedImageFactory.h +1 -1
- package/cpp/api/JsiSkApi.h +2 -2
- package/cpp/api/JsiSkCanvas.h +34 -1
- package/cpp/api/JsiSkDataFactory.h +1 -1
- package/cpp/api/JsiSkFont.h +1 -1
- package/cpp/api/JsiSkFontMgr.h +1 -1
- package/cpp/api/JsiSkHostObjects.h +3 -3
- package/cpp/api/JsiSkImage.h +14 -6
- package/cpp/api/JsiSkImageFactory.h +2 -2
- package/cpp/api/JsiSkPath.h +1 -1
- package/cpp/api/JsiSkPathFactory.h +1 -1
- package/cpp/api/JsiSkSurface.h +18 -6
- package/cpp/api/JsiSkTypeface.h +1 -1
- package/cpp/api/JsiSkTypefaceFontProvider.h +1 -1
- package/cpp/api/JsiSkiaContext.h +2 -2
- package/cpp/api/JsiTextureInfo.h +1 -1
- package/cpp/api/JsiVideo.h +2 -2
- package/cpp/api/recorder/Drawings.h +1 -1
- package/cpp/api/recorder/JsiRecorder.h +4 -4
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/ViewProperty.h +1 -1
- package/cpp/rnskia/RNDawnContext.h +13 -0
- package/cpp/rnskia/RNDawnUtils.h +11 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
- package/cpp/rnskia/RNSkManager.cpp +88 -2
- package/cpp/rnskia/RNSkPictureView.h +4 -4
- package/cpp/rnskia/RNSkPlatformContext.h +7 -0
- package/cpp/rnskia/RNSkView.h +9 -6
- package/cpp/rnwgpu/ArrayBuffer.h +51 -7
- package/cpp/rnwgpu/api/AppleNativeBuffer.h +22 -0
- package/cpp/rnwgpu/api/Convertors.h +33 -11
- package/cpp/rnwgpu/api/GPU.cpp +0 -3
- package/cpp/rnwgpu/api/GPUAdapter.cpp +37 -7
- package/cpp/rnwgpu/api/GPUBuffer.h +1 -1
- package/cpp/rnwgpu/api/GPUDevice.cpp +84 -6
- package/cpp/rnwgpu/api/GPUDevice.h +12 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +139 -0
- package/cpp/rnwgpu/api/GPUExternalTexture.h +52 -2
- package/cpp/rnwgpu/api/GPUQueue.cpp +50 -45
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +1 -1
- package/cpp/rnwgpu/api/GPUSharedFence.cpp +80 -0
- package/cpp/rnwgpu/api/GPUSharedFence.h +53 -0
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +135 -0
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +75 -0
- package/cpp/rnwgpu/api/ImageBitmap.h +62 -0
- package/cpp/rnwgpu/api/NativeBufferUtils.h +87 -0
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +4 -1
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +56 -0
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +10 -0
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +43 -24
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +9 -9
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +2 -2
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +58 -0
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +51 -0
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +73 -0
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +1 -1
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +1 -1
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +1 -1
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +1 -1
- package/cpp/skia/include/android/SkAnimatedImage.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +0 -8
- package/cpp/skia/include/codec/SkEncodedOrigin.h +1 -1
- package/cpp/skia/include/codec/SkPngRustDecoder.h +1 -1
- package/cpp/skia/include/core/SkBitmap.h +2 -8
- package/cpp/skia/include/core/SkCPURecorder.h +3 -1
- package/cpp/skia/include/core/SkCanvasVirtualEnforcer.h +1 -1
- package/cpp/skia/include/core/SkColorType.h +5 -3
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkCoverageMode.h +1 -1
- package/cpp/skia/include/core/SkCubicMap.h +1 -1
- package/cpp/skia/include/core/SkExecutor.h +1 -1
- package/cpp/skia/include/core/SkFont.h +15 -0
- package/cpp/skia/include/core/SkFontArguments.h +6 -1
- package/cpp/skia/include/core/SkFontMetrics.h +1 -1
- package/cpp/skia/include/core/SkFontMgr.h +36 -1
- package/cpp/skia/include/core/SkFontParameters.h +1 -1
- package/cpp/skia/include/core/SkFontScanner.h +1 -1
- package/cpp/skia/include/core/SkFontTypes.h +1 -1
- package/cpp/skia/include/core/SkM44.h +1 -1
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +1 -1
- package/cpp/skia/include/core/SkPathBuilder.h +10 -4
- package/cpp/skia/include/core/SkPathIter.h +1 -1
- package/cpp/skia/include/core/SkPathTypes.h +1 -1
- package/cpp/skia/include/core/SkPixelRef.h +4 -1
- package/cpp/skia/include/core/SkRecorder.h +2 -1
- package/cpp/skia/include/core/SkRegion.h +17 -6
- package/cpp/skia/include/core/SkSamplingOptions.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +8 -1
- package/cpp/skia/include/core/SkShader.h +3 -5
- package/cpp/skia/include/core/SkSpan.h +1 -1
- package/cpp/skia/include/core/SkStream.h +1 -1
- package/cpp/skia/include/core/SkStrikeRef.h +80 -0
- package/cpp/skia/include/core/SkTileMode.h +1 -1
- package/cpp/skia/include/core/SkVertices.h +1 -1
- package/cpp/skia/include/core/SkYUVAPixmaps.h +3 -5
- package/cpp/skia/include/docs/SkPDFDocument.h +1 -1
- package/cpp/skia/include/docs/SkXPSDocument.h +1 -1
- package/cpp/skia/include/effects/SkGradient.h +1 -1
- package/cpp/skia/include/effects/SkHighContrastFilter.h +1 -1
- package/cpp/skia/include/effects/SkRuntimeEffect.h +2 -2
- package/cpp/skia/include/effects/SkShaderMaskFilter.h +1 -1
- package/cpp/skia/include/effects/SkTrimPathEffect.h +1 -1
- package/cpp/skia/include/encode/SkEncoder.h +1 -1
- package/cpp/skia/include/encode/SkJpegEncoder.h +1 -1
- package/cpp/skia/include/encode/SkPngEncoder.h +1 -1
- package/cpp/skia/include/encode/SkPngRustEncoder.h +1 -1
- package/cpp/skia/include/encode/SkWebpEncoder.h +1 -1
- package/cpp/skia/include/gpu/GpuTypes.h +2 -0
- package/cpp/skia/include/gpu/MutableTextureState.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +6 -62
- package/cpp/skia/include/gpu/ganesh/GrContextThreadSafeProxy.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +2 -1
- package/cpp/skia/include/gpu/ganesh/mock/GrMockBackendSurface.h +59 -0
- package/cpp/skia/include/gpu/ganesh/mock/GrMockTypes.h +1 -1
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlBackendContext.h +1 -1
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlTypes.h +1 -1
- package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +1 -1
- package/cpp/skia/include/gpu/graphite/Context.h +12 -5
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +6 -0
- package/cpp/skia/include/gpu/graphite/Image.h +82 -9
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +7 -2
- package/cpp/skia/include/gpu/graphite/Recorder.h +6 -4
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileColorFilter.h +11 -1
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +1 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +1 -1
- package/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +1 -1
- package/cpp/skia/include/ports/SkCFObject.h +1 -1
- package/cpp/skia/include/ports/SkFontMgr_Fontations.h +1 -1
- package/cpp/skia/include/ports/SkFontMgr_android_ndk.h +1 -1
- package/cpp/skia/include/ports/SkFontMgr_data.h +1 -1
- package/cpp/skia/include/ports/SkFontMgr_fuchsia.h +1 -1
- package/cpp/skia/include/ports/SkFontMgr_mac_ct.h +1 -1
- package/cpp/skia/include/ports/SkFontScanner_Fontations.h +1 -1
- package/cpp/skia/include/ports/SkFontScanner_FreeType.h +1 -1
- package/cpp/skia/include/ports/SkTypeface_fontations.h +1 -1
- package/cpp/skia/include/private/SkExif.h +1 -1
- package/cpp/skia/include/private/SkGainmapInfo.h +1 -1
- package/cpp/skia/include/private/SkGainmapShader.h +1 -1
- package/cpp/skia/include/private/SkHdrMetadata.h +21 -0
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -1
- package/cpp/skia/include/private/SkPixelStorage.h +37 -0
- package/cpp/skia/include/private/SkXmp.h +1 -1
- package/cpp/skia/include/private/base/SkAssert.h +6 -5
- package/cpp/skia/include/private/base/SkContainers.h +1 -1
- package/cpp/skia/include/private/base/SkFeatures.h +30 -30
- package/cpp/skia/include/private/base/SkLog.h +1 -7
- package/cpp/skia/include/private/base/SkLogPriority.h +4 -5
- package/cpp/skia/include/private/base/SkMacros.h +1 -1
- package/cpp/skia/include/private/base/SkMalloc.h +1 -1
- package/cpp/skia/include/private/base/SkSafe32.h +1 -1
- package/cpp/skia/include/private/base/SkSpan_impl.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +13 -1
- package/cpp/skia/include/private/base/SkTPin.h +1 -1
- package/cpp/skia/include/private/base/SkTo.h +1 -1
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +1 -1
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +1 -1
- package/cpp/skia/include/private/chromium/SkCodecsICCProfileChromium.h +52 -0
- package/cpp/skia/include/private/chromium/SkExifChromium.h +26 -0
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +2 -1
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_icd.h +41 -51
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_layer.h +42 -53
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std.h +158 -154
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_decode.h +68 -65
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_av1std_encode.h +90 -87
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +9 -9
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +2 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_encode.h +82 -79
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +24 -24
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +2 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_encode.h +95 -96
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std.h +151 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_vp9std_decode.h +68 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +1 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +5 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +7 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_beta.h +291 -158
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +13174 -10113
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_directfb.h +23 -19
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_fuchsia.h +159 -165
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ggp.h +22 -19
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +3 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +3 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_metal.h +94 -88
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ohos.h +120 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_screen.h +55 -51
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_vi.h +18 -15
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_wayland.h +23 -19
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +31 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +5 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib.h +27 -27
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xlib_xrandr.h +20 -16
- package/cpp/skia/include/utils/SkEventTracer.h +6 -1
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +1 -1
- package/cpp/skia/include/utils/SkShadowUtils.h +1 -1
- package/cpp/skia/include/utils/SkTextUtils.h +1 -1
- package/cpp/skia/modules/jsonreader/SkJSONReader.cpp +20 -4
- package/cpp/skia/modules/skcms/src/Transform_inl.h +11 -15
- package/cpp/skia/modules/skcms/src/skcms_public.h +2 -0
- package/cpp/skia/modules/skottie/include/ExternalLayer.h +1 -1
- package/cpp/skia/modules/skottie/include/Skottie.h +1 -1
- package/cpp/skia/modules/skottie/include/SkottieProperty.h +1 -1
- package/cpp/skia/modules/skottie/include/SlotManager.h +1 -1
- package/cpp/skia/modules/skottie/include/TextShaper.h +1 -1
- package/cpp/skia/modules/skottie/src/SkottieValue.h +1 -1
- package/cpp/skia/modules/skottie/src/animator/Animator.h +1 -1
- package/cpp/skia/modules/skottie/src/text/Font.h +1 -1
- package/cpp/skia/modules/skottie/src/text/TextAdapter.h +1 -1
- package/cpp/skia/modules/skottie/src/text/TextAnimator.h +3 -2
- package/cpp/skia/modules/skottie/src/text/TextValue.h +1 -1
- package/cpp/skia/modules/skparagraph/include/DartTypes.h +1 -1
- package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +5 -1
- package/cpp/skia/modules/skparagraph/include/Metrics.h +1 -1
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +1 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +1 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +1 -1
- package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +12 -5
- package/cpp/skia/modules/skparagraph/include/TextShadow.h +1 -1
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +1 -1
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGClipEffect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGColorFilter.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGDraw.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGEffectNode.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGGeometryEffect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGGeometryNode.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGGradient.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGGroup.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGImage.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGInvalidationController.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGMaskEffect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGMerge.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGNode.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGOpacityEffect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGPaint.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGPath.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGPlane.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGRect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGRenderEffect.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGRenderNode.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGScene.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGText.h +1 -1
- package/cpp/skia/modules/sksg/include/SkSGTransform.h +1 -1
- package/cpp/skia/modules/skshaper/include/SkShaper_coretext.h +8 -1
- package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeMerge.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeMorphology.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/base/SkAutoLocaleSetter.h +94 -0
- package/cpp/skia/src/base/SkUTF.h +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/types/WebGPU.d.ts +153 -0
- package/lib/commonjs/skia/types/WebGPU.js +6 -0
- package/lib/commonjs/skia/types/WebGPU.js.map +1 -0
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +11 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +19 -0
- package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/skia/types/WebGPU.d.ts +153 -0
- package/lib/module/skia/types/WebGPU.js +2 -0
- package/lib/module/skia/types/WebGPU.js.map +1 -0
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
- package/lib/module/skia/web/JsiSkNativeBufferFactory.js +19 -0
- package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +1 -2
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
- package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +10 -1
- package/lib/typescript/src/skia/types/WebGPU.d.ts +153 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +1 -0
- package/package.json +14 -12
- package/react-native-skia.podspec +59 -7
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +10 -1
- package/src/skia/types/WebGPU.ts +186 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkNativeBufferFactory.ts +20 -0
- package/src/skia/web/JsiSkPath.ts +8 -2
- package/scripts/install-libs.js +0 -133
package/android/CMakeLists.txt
CHANGED
|
@@ -4,7 +4,8 @@ cmake_minimum_required(VERSION 3.4.1)
|
|
|
4
4
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
5
|
set (CMAKE_CXX_STANDARD 20)
|
|
6
6
|
|
|
7
|
-
# SKIA_LIBS_PATH is passed from Gradle (pointing
|
|
7
|
+
# SKIA_LIBS_PATH is passed from Gradle (pointing at the prebuilt Skia binaries,
|
|
8
|
+
# read straight from the react-native-skia-android npm package, or libs/android for Graphite)
|
|
8
9
|
# Append the ABI to get the full path
|
|
9
10
|
set (SKIA_LIBS_PATH "${SKIA_LIBS_PATH}/${ANDROID_ABI}")
|
|
10
11
|
|
|
@@ -17,12 +18,12 @@ if(NOT EXISTS "${SKIA_LIBS_PATH}/libskia.a")
|
|
|
17
18
|
message("│ │")
|
|
18
19
|
message("│ Could not find libskia.a at: ${SKIA_LIBS_PATH} │")
|
|
19
20
|
message("│ │")
|
|
20
|
-
message("│
|
|
21
|
-
message("│
|
|
21
|
+
message("│ Make sure dependencies are installed: │")
|
|
22
|
+
message("│ yarn install (or npm install) │")
|
|
22
23
|
message("│ │")
|
|
23
24
|
message("└─────────────────────────────────────────────────────────────────────────────┘")
|
|
24
25
|
message("")
|
|
25
|
-
message(FATAL_ERROR "Skia prebuilt binaries not found. Run `
|
|
26
|
+
message(FATAL_ERROR "Skia prebuilt binaries not found. Run `yarn install` to fix this.")
|
|
26
27
|
endif()
|
|
27
28
|
|
|
28
29
|
# Import libskia
|
|
@@ -134,12 +135,15 @@ if(SK_GRAPHITE)
|
|
|
134
135
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUComputePipeline.cpp"
|
|
135
136
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUDevice.cpp"
|
|
136
137
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUDeviceLostInfo.cpp"
|
|
138
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUExternalTexture.cpp"
|
|
137
139
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUQuerySet.cpp"
|
|
138
140
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUQueue.cpp"
|
|
139
141
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPURenderBundleEncoder.cpp"
|
|
140
142
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPURenderPassEncoder.cpp"
|
|
141
143
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPURenderPipeline.cpp"
|
|
142
144
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUShaderModule.cpp"
|
|
145
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUSharedFence.cpp"
|
|
146
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUSharedTextureMemory.cpp"
|
|
143
147
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUSupportedLimits.cpp"
|
|
144
148
|
"${PROJECT_SOURCE_DIR}/../cpp/rnwgpu/api/GPUTexture.cpp"
|
|
145
149
|
|
package/android/build.gradle
CHANGED
|
@@ -58,10 +58,29 @@ static def findNodeModules(baseDir) {
|
|
|
58
58
|
|
|
59
59
|
def nodeModules = findNodeModules(projectDir)
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
//
|
|
61
|
+
// Resolve a node package directory using Node's own module resolution, so we
|
|
62
|
+
// pick up the prebuilt Skia binaries straight from node_modules (no postinstall
|
|
63
|
+
// copy step needed). Mirrors `require.resolve(pkg/package.json)`.
|
|
64
|
+
static def resolveNodePackage(packageName, baseDir) {
|
|
65
|
+
def script = "process.stdout.write(require('path').dirname(require.resolve('${packageName}/package.json')))"
|
|
66
|
+
def proc = ["node", "-e", script].execute(null, baseDir)
|
|
67
|
+
proc.waitFor()
|
|
68
|
+
if (proc.exitValue() != 0) {
|
|
69
|
+
throw new GradleException(
|
|
70
|
+
"react-native-skia: Could not resolve the '${packageName}' package. " +
|
|
71
|
+
"Make sure dependencies are installed (yarn install / npm install).\n" + proc.err.text
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
return proc.text.trim()
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Graphite is detected via a marker file created by install-skia-graphite, which
|
|
78
|
+
// downloads its binaries directly into libs/. For the default (Ganesh) build the
|
|
79
|
+
// binaries live in the react-native-skia-android npm package and are read in place.
|
|
63
80
|
def useGraphite = file("${projectDir}/../libs/.graphite").exists()
|
|
64
|
-
def skiaLibsPath =
|
|
81
|
+
def skiaLibsPath = useGraphite
|
|
82
|
+
? "${projectDir}/../libs/android"
|
|
83
|
+
: "${resolveNodePackage('react-native-skia-android', projectDir)}/libs"
|
|
65
84
|
|
|
66
85
|
logger.warn("react-native-skia: SK_GRAPHITE: ${useGraphite}")
|
|
67
86
|
logger.warn("react-native-skia: Skia libs: ${skiaLibsPath}")
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
#if __ANDROID_API__ >= 26
|
|
4
4
|
#include <android/hardware_buffer.h>
|
|
5
5
|
#endif
|
|
6
|
+
#include <algorithm>
|
|
7
|
+
#include <cstdint>
|
|
6
8
|
#include <exception>
|
|
7
9
|
#include <functional>
|
|
8
10
|
#include <memory>
|
|
@@ -120,6 +122,13 @@ public:
|
|
|
120
122
|
|
|
121
123
|
uint64_t makeNativeBuffer(sk_sp<SkImage> image) override {
|
|
122
124
|
#if __ANDROID_API__ >= 26
|
|
125
|
+
#if defined(SK_GRAPHITE)
|
|
126
|
+
// A Graphite GPU texture can't be read with readPixels(nullptr); read it
|
|
127
|
+
// back to a raster image first or the buffer ends up uninitialized/black.
|
|
128
|
+
if (image && image->isTextureBacked()) {
|
|
129
|
+
image = DawnContext::getInstance().MakeRasterImage(image);
|
|
130
|
+
}
|
|
131
|
+
#endif
|
|
123
132
|
auto bytesPerPixel = image->imageInfo().bytesPerPixel();
|
|
124
133
|
int bytesPerRow = image->width() * bytesPerPixel;
|
|
125
134
|
auto buf = SkData::MakeUninitialized(image->width() * image->height() *
|
|
@@ -177,6 +186,59 @@ public:
|
|
|
177
186
|
#endif
|
|
178
187
|
}
|
|
179
188
|
|
|
189
|
+
uint64_t makeTestNativeBuffer(int width, int height) override {
|
|
190
|
+
#if __ANDROID_API__ >= 26
|
|
191
|
+
// Allocate an RGBA8 AHardwareBuffer and fill it with a procedural test
|
|
192
|
+
// pattern (RGB gradient + diagonal stripes), entirely on the CPU. We read
|
|
193
|
+
// the buffer's actual row stride after locking (the allocator may pad it),
|
|
194
|
+
// so the upload is correct regardless of width alignment.
|
|
195
|
+
AHardwareBuffer_Desc desc = {};
|
|
196
|
+
desc.width = static_cast<uint32_t>(width);
|
|
197
|
+
desc.height = static_cast<uint32_t>(height);
|
|
198
|
+
desc.layers = 1;
|
|
199
|
+
desc.format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
|
|
200
|
+
desc.usage = AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY |
|
|
201
|
+
AHARDWAREBUFFER_USAGE_CPU_READ_RARELY |
|
|
202
|
+
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
|
|
203
|
+
|
|
204
|
+
AHardwareBuffer *buffer = nullptr;
|
|
205
|
+
if (AHardwareBuffer_allocate(&desc, &buffer) != 0) {
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
AHardwareBuffer_Desc allocated = {};
|
|
210
|
+
AHardwareBuffer_describe(buffer, &allocated);
|
|
211
|
+
const size_t rowBytes = static_cast<size_t>(allocated.stride) * 4;
|
|
212
|
+
|
|
213
|
+
void *mappedBuffer = nullptr;
|
|
214
|
+
AHardwareBuffer_lock(buffer, AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY, -1,
|
|
215
|
+
nullptr, &mappedBuffer);
|
|
216
|
+
if (mappedBuffer == nullptr) {
|
|
217
|
+
AHardwareBuffer_release(buffer);
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
auto *base = static_cast<uint8_t *>(mappedBuffer);
|
|
222
|
+
for (int y = 0; y < height; ++y) {
|
|
223
|
+
uint8_t *row = base + y * rowBytes;
|
|
224
|
+
for (int x = 0; x < width; ++x) {
|
|
225
|
+
uint8_t r = static_cast<uint8_t>((x * 255) / std::max(width - 1, 1));
|
|
226
|
+
uint8_t g = static_cast<uint8_t>((y * 255) / std::max(height - 1, 1));
|
|
227
|
+
uint8_t b = static_cast<uint8_t>(((x + y) & 0x20) ? 220 : 30);
|
|
228
|
+
row[x * 4 + 0] = r; // RGBA byte order
|
|
229
|
+
row[x * 4 + 1] = g;
|
|
230
|
+
row[x * 4 + 2] = b;
|
|
231
|
+
row[x * 4 + 3] = 0xFF;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
AHardwareBuffer_unlock(buffer, nullptr);
|
|
236
|
+
return reinterpret_cast<uint64_t>(buffer);
|
|
237
|
+
#else
|
|
238
|
+
return 0;
|
|
239
|
+
#endif
|
|
240
|
+
}
|
|
241
|
+
|
|
180
242
|
#if !defined(SK_GRAPHITE)
|
|
181
243
|
GrDirectContext *getDirectContext() override {
|
|
182
244
|
return OpenGLContext::getInstance().getDirectContext();
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
15
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
16
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
17
|
+
|
|
18
|
+
public class SkiaWebGPUViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SkiaWebGPUViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
19
|
+
public SkiaWebGPUViewManagerDelegate(U viewManager) {
|
|
20
|
+
super(viewManager);
|
|
21
|
+
}
|
|
22
|
+
@Override
|
|
23
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
24
|
+
switch (propName) {
|
|
25
|
+
case "contextId":
|
|
26
|
+
mViewManager.setContextId(view, value == null ? 0 : ((Double) value).intValue());
|
|
27
|
+
break;
|
|
28
|
+
case "transparent":
|
|
29
|
+
mViewManager.setTransparent(view, value != null && (boolean) value);
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
super.setProperty(view, propName, value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
|
|
14
|
+
public interface SkiaWebGPUViewManagerInterface<T extends View> {
|
|
15
|
+
void setContextId(T view, int value);
|
|
16
|
+
void setTransparent(T view, boolean value);
|
|
17
|
+
}
|
|
@@ -57,6 +57,8 @@ public:
|
|
|
57
57
|
|
|
58
58
|
uint64_t makeNativeBuffer(sk_sp<SkImage> image) override;
|
|
59
59
|
|
|
60
|
+
uint64_t makeTestNativeBuffer(int width, int height) override;
|
|
61
|
+
|
|
60
62
|
void releaseNativeBuffer(uint64_t pointer) override;
|
|
61
63
|
|
|
62
64
|
std::shared_ptr<RNSkVideo> createVideo(const std::string &url) override;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
#import <CoreMedia/CMSampleBuffer.h>
|
|
4
4
|
#include <Metal/Metal.h>
|
|
5
5
|
#import <React/RCTUtils.h>
|
|
6
|
+
#include <algorithm>
|
|
6
7
|
#include <set>
|
|
7
8
|
#include <thread>
|
|
8
9
|
#include <utility>
|
|
@@ -82,6 +83,15 @@ void RNSkApplePlatformContext::releaseNativeBuffer(uint64_t pointer) {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
uint64_t RNSkApplePlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
|
|
86
|
+
#if defined(SK_GRAPHITE)
|
|
87
|
+
// A Graphite GPU texture can't be read with readPixels(nullptr) (and can't be
|
|
88
|
+
// drawn onto a raster surface) — both yield uninitialized/black pixels. Read
|
|
89
|
+
// it back to a raster image first. (JsiNativeBuffer calls the Ganesh-only
|
|
90
|
+
// SkImage::makeNonTextureImage(), which is a no-op on Graphite.)
|
|
91
|
+
if (image && image->isTextureBacked()) {
|
|
92
|
+
image = DawnContext::getInstance().MakeRasterImage(image);
|
|
93
|
+
}
|
|
94
|
+
#endif
|
|
85
95
|
// 0. If Image is not in BGRA, convert to BGRA as only BGRA is supported.
|
|
86
96
|
if (image->colorType() != kBGRA_8888_SkColorType) {
|
|
87
97
|
const SkImageInfo bgraInfo =
|
|
@@ -170,6 +180,67 @@ uint64_t RNSkApplePlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
|
|
|
170
180
|
return reinterpret_cast<uint64_t>(pixelBuffer);
|
|
171
181
|
}
|
|
172
182
|
|
|
183
|
+
uint64_t RNSkApplePlatformContext::makeTestNativeBuffer(int width, int height) {
|
|
184
|
+
// Allocate a BGRA IOSurface and fill it with a procedural test pattern (RGB
|
|
185
|
+
// gradient + diagonal stripes), entirely on the CPU. No GPU / SkImage round
|
|
186
|
+
// trip, so this works the same on every backend.
|
|
187
|
+
const int bytesPerElement = 4;
|
|
188
|
+
const int pitch = width * bytesPerElement;
|
|
189
|
+
const int allocSize = width * height * bytesPerElement;
|
|
190
|
+
OSType pixelFormat = kCVPixelFormatType_32BGRA;
|
|
191
|
+
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(
|
|
192
|
+
kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks,
|
|
193
|
+
&kCFTypeDictionaryValueCallBacks);
|
|
194
|
+
auto setInt = [&](CFStringRef key, int value) {
|
|
195
|
+
CFNumberRef num =
|
|
196
|
+
CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);
|
|
197
|
+
CFDictionarySetValue(dict, key, num);
|
|
198
|
+
CFRelease(num);
|
|
199
|
+
};
|
|
200
|
+
setInt(kIOSurfaceWidth, width);
|
|
201
|
+
setInt(kIOSurfaceHeight, height);
|
|
202
|
+
setInt(kIOSurfaceBytesPerRow, pitch);
|
|
203
|
+
setInt(kIOSurfaceBytesPerElement, bytesPerElement);
|
|
204
|
+
setInt(kIOSurfacePixelFormat, static_cast<int>(pixelFormat));
|
|
205
|
+
setInt(kIOSurfaceAllocSize, allocSize);
|
|
206
|
+
IOSurfaceRef surface = IOSurfaceCreate(dict);
|
|
207
|
+
CFRelease(dict);
|
|
208
|
+
if (surface == nil) {
|
|
209
|
+
throw std::runtime_error("Failed to create " + std::to_string(width) + "x" +
|
|
210
|
+
std::to_string(height) + " test IOSurface!");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
IOSurfaceLock(surface, 0, nil);
|
|
214
|
+
auto *base = static_cast<uint8_t *>(IOSurfaceGetBaseAddress(surface));
|
|
215
|
+
const size_t rowBytes = IOSurfaceGetBytesPerRow(surface);
|
|
216
|
+
for (int y = 0; y < height; ++y) {
|
|
217
|
+
uint8_t *row = base + y * rowBytes;
|
|
218
|
+
for (int x = 0; x < width; ++x) {
|
|
219
|
+
uint8_t r = static_cast<uint8_t>((x * 255) / std::max(width - 1, 1));
|
|
220
|
+
uint8_t g = static_cast<uint8_t>((y * 255) / std::max(height - 1, 1));
|
|
221
|
+
uint8_t b = static_cast<uint8_t>(((x + y) & 0x20) ? 220 : 30);
|
|
222
|
+
row[x * 4 + 0] = b; // BGRA byte order
|
|
223
|
+
row[x * 4 + 1] = g;
|
|
224
|
+
row[x * 4 + 2] = r;
|
|
225
|
+
row[x * 4 + 3] = 0xFF;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
IOSurfaceUnlock(surface, 0, nil);
|
|
229
|
+
|
|
230
|
+
CVPixelBufferRef pixelBuffer = nullptr;
|
|
231
|
+
CVReturn result =
|
|
232
|
+
CVPixelBufferCreateWithIOSurface(nil, surface, nil, &pixelBuffer);
|
|
233
|
+
// The CVPixelBuffer retains the IOSurface; drop our reference so the
|
|
234
|
+
// CVPixelBuffer is its sole owner (freed by releaseNativeBuffer).
|
|
235
|
+
CFRelease(surface);
|
|
236
|
+
if (result != kCVReturnSuccess) {
|
|
237
|
+
throw std::runtime_error("Failed to create CVPixelBuffer for test native "
|
|
238
|
+
"buffer! Return value: " +
|
|
239
|
+
std::to_string(result));
|
|
240
|
+
}
|
|
241
|
+
return reinterpret_cast<uint64_t>(pixelBuffer);
|
|
242
|
+
}
|
|
243
|
+
|
|
173
244
|
#if !defined(SK_GRAPHITE)
|
|
174
245
|
GrDirectContext *RNSkApplePlatformContext::getDirectContext() {
|
|
175
246
|
return MetalContext::getInstance().getDirectContext();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#ifdef SK_GRAPHITE
|
|
2
|
+
|
|
3
|
+
#import <CoreVideo/CoreVideo.h>
|
|
4
|
+
|
|
5
|
+
#include "rnwgpu/api/AppleNativeBuffer.h"
|
|
6
|
+
|
|
7
|
+
namespace rnwgpu {
|
|
8
|
+
|
|
9
|
+
void *GetIOSurfaceFromNativeBuffer(void *cvPixelBuffer, uint32_t *outWidth,
|
|
10
|
+
uint32_t *outHeight) {
|
|
11
|
+
auto pixelBuffer = reinterpret_cast<CVPixelBufferRef>(cvPixelBuffer);
|
|
12
|
+
if (pixelBuffer == nullptr) {
|
|
13
|
+
if (outWidth != nullptr) {
|
|
14
|
+
*outWidth = 0;
|
|
15
|
+
}
|
|
16
|
+
if (outHeight != nullptr) {
|
|
17
|
+
*outHeight = 0;
|
|
18
|
+
}
|
|
19
|
+
return nullptr;
|
|
20
|
+
}
|
|
21
|
+
if (outWidth != nullptr) {
|
|
22
|
+
*outWidth = static_cast<uint32_t>(CVPixelBufferGetWidth(pixelBuffer));
|
|
23
|
+
}
|
|
24
|
+
if (outHeight != nullptr) {
|
|
25
|
+
*outHeight = static_cast<uint32_t>(CVPixelBufferGetHeight(pixelBuffer));
|
|
26
|
+
}
|
|
27
|
+
// The IOSurface is owned by the CVPixelBuffer; we don't retain it here.
|
|
28
|
+
return CVPixelBufferGetIOSurface(pixelBuffer);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
} // namespace rnwgpu
|
|
32
|
+
|
|
33
|
+
#endif // SK_GRAPHITE
|
|
@@ -24,6 +24,13 @@ public:
|
|
|
24
24
|
return jsi::BigInt::fromUint64(runtime, pointer);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
JSI_HOST_FUNCTION(MakeTestBuffer) {
|
|
28
|
+
auto width = static_cast<int>(arguments[0].asNumber());
|
|
29
|
+
auto height = static_cast<int>(arguments[1].asNumber());
|
|
30
|
+
uint64_t pointer = getContext()->makeTestNativeBuffer(width, height);
|
|
31
|
+
return jsi::BigInt::fromUint64(runtime, pointer);
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
JSI_HOST_FUNCTION(Release) {
|
|
28
35
|
|
|
29
36
|
jsi::BigInt pointer = arguments[0].asBigInt(runtime);
|
|
@@ -34,7 +41,8 @@ public:
|
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiNativeBufferFactory, Release),
|
|
37
|
-
JSI_EXPORT_FUNC(JsiNativeBufferFactory, MakeFromImage)
|
|
44
|
+
JSI_EXPORT_FUNC(JsiNativeBufferFactory, MakeFromImage),
|
|
45
|
+
JSI_EXPORT_FUNC(JsiNativeBufferFactory, MakeTestBuffer))
|
|
38
46
|
|
|
39
47
|
size_t getMemoryPressure() const override { return 1024; }
|
|
40
48
|
|
package/cpp/api/JsiSkApi.h
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
4
|
|
|
5
|
-
#include "RNSkPlatformContext.h"
|
|
5
|
+
#include "rnskia/RNSkPlatformContext.h"
|
|
6
6
|
|
|
7
7
|
#include "JsiSkHostObjects.h"
|
|
8
8
|
|
|
9
9
|
#ifdef SK_GRAPHITE
|
|
10
|
-
#include "RNDawnContext.h"
|
|
10
|
+
#include "rnskia/RNDawnContext.h"
|
|
11
11
|
#include "rnwgpu/api/GPUDevice.h"
|
|
12
12
|
#include "rnwgpu/async/AsyncRunner.h"
|
|
13
13
|
#endif
|
package/cpp/api/JsiSkCanvas.h
CHANGED
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
#include "JsiSkTextBlob.h"
|
|
20
20
|
#include "JsiSkVertices.h"
|
|
21
21
|
|
|
22
|
-
#include "RNSkTypedArray.h"
|
|
22
|
+
#include "utils/RNSkTypedArray.h"
|
|
23
|
+
|
|
24
|
+
#if defined(SK_GRAPHITE)
|
|
25
|
+
#include "rnskia/RNDawnContext.h"
|
|
26
|
+
#endif
|
|
23
27
|
|
|
24
28
|
#include <jsi/jsi.h>
|
|
25
29
|
|
|
@@ -644,6 +648,29 @@ public:
|
|
|
644
648
|
.getArrayBuffer(runtime);
|
|
645
649
|
auto bfrPtr = reinterpret_cast<void *>(buffer.data(runtime));
|
|
646
650
|
|
|
651
|
+
#if defined(SK_GRAPHITE)
|
|
652
|
+
// Graphite records draws lazily and offers no synchronous GPU readback. If
|
|
653
|
+
// this canvas belongs to a surface, snap & submit its recording, snapshot
|
|
654
|
+
// it to a CPU raster image and read from that (mirroring makeImageSnapshot).
|
|
655
|
+
// A canvas without an owning surface (e.g. a picture-recording canvas) has
|
|
656
|
+
// no texture to read back, so fall through to the raster canvas read below.
|
|
657
|
+
if (_surface) {
|
|
658
|
+
// Snapshot first: makeImageSnapshot records a copy task into the recorder
|
|
659
|
+
// that must be submitted before the texture can be read back (this is the
|
|
660
|
+
// same ordering used by JsiSkSurface::makeImageSnapshot and RNSkView).
|
|
661
|
+
auto snapshot = _surface->makeImageSnapshot();
|
|
662
|
+
if (auto *recorder = _surface->recorder()) {
|
|
663
|
+
DawnContext::getInstance().submitRecording(recorder->snap().get());
|
|
664
|
+
}
|
|
665
|
+
auto raster = DawnContext::getInstance().MakeRasterImage(snapshot);
|
|
666
|
+
if (!raster ||
|
|
667
|
+
!raster->readPixels(nullptr, *info, bfrPtr, bytesPerRow, srcX, srcY)) {
|
|
668
|
+
return jsi::Value::null();
|
|
669
|
+
}
|
|
670
|
+
return dest;
|
|
671
|
+
}
|
|
672
|
+
#endif
|
|
673
|
+
|
|
647
674
|
if (!_canvas->readPixels(*info, bfrPtr, bytesPerRow, srcX, srcY)) {
|
|
648
675
|
return jsi::Value::null();
|
|
649
676
|
}
|
|
@@ -708,7 +735,13 @@ public:
|
|
|
708
735
|
void setCanvas(SkCanvas *canvas) { _canvas = canvas; }
|
|
709
736
|
SkCanvas *getCanvas() { return _canvas; }
|
|
710
737
|
|
|
738
|
+
// Optionally associate the canvas with its owning surface. This lets
|
|
739
|
+
// readPixels fall back to a surface snapshot on Graphite, which has no
|
|
740
|
+
// synchronous canvas readback.
|
|
741
|
+
void setSurface(sk_sp<SkSurface> surface) { _surface = std::move(surface); }
|
|
742
|
+
|
|
711
743
|
private:
|
|
712
744
|
SkCanvas *_canvas;
|
|
745
|
+
sk_sp<SkSurface> _surface;
|
|
713
746
|
};
|
|
714
747
|
} // namespace RNSkia
|
package/cpp/api/JsiSkFont.h
CHANGED
package/cpp/api/JsiSkFontMgr.h
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
#include <string>
|
|
6
6
|
#include <utility>
|
|
7
7
|
|
|
8
|
-
#include "JsiHostObject.h"
|
|
9
|
-
#include "RNSkLog.h"
|
|
10
|
-
#include "RNSkPlatformContext.h"
|
|
8
|
+
#include "jsi/JsiHostObject.h"
|
|
9
|
+
#include "utils/RNSkLog.h"
|
|
10
|
+
#include "rnskia/RNSkPlatformContext.h"
|
|
11
11
|
|
|
12
12
|
namespace RNSkia {
|
|
13
13
|
|
package/cpp/api/JsiSkImage.h
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
#include "api/third_party/base64.h"
|
|
13
13
|
|
|
14
14
|
#include "JsiTextureInfo.h"
|
|
15
|
-
#include "RNSkTypedArray.h"
|
|
15
|
+
#include "utils/RNSkTypedArray.h"
|
|
16
16
|
|
|
17
17
|
#if defined(SK_GRAPHITE)
|
|
18
|
-
#include "RNDawnContext.h"
|
|
18
|
+
#include "rnskia/RNDawnContext.h"
|
|
19
19
|
#include "include/gpu/graphite/Context.h"
|
|
20
20
|
#else
|
|
21
21
|
#include "include/gpu/ganesh/GrDirectContext.h"
|
|
@@ -277,9 +277,6 @@ public:
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
JSI_HOST_FUNCTION(readPixels) {
|
|
280
|
-
#if defined(SK_GRAPHITE)
|
|
281
|
-
throw std::runtime_error("Not implemented yet");
|
|
282
|
-
#else
|
|
283
280
|
int srcX = 0;
|
|
284
281
|
int srcY = 0;
|
|
285
282
|
if (count > 0 && !arguments[0].isUndefined()) {
|
|
@@ -313,13 +310,24 @@ public:
|
|
|
313
310
|
.getArrayBuffer(runtime);
|
|
314
311
|
auto bfrPtr = reinterpret_cast<void *>(buffer.data(runtime));
|
|
315
312
|
|
|
313
|
+
#if defined(SK_GRAPHITE)
|
|
314
|
+
// Graphite offers no synchronous GPU readback, so fall back to a CPU raster
|
|
315
|
+
// copy of the image (a no-op when the image is already raster) and read the
|
|
316
|
+
// pixels from that. This matches the Ganesh behaviour for non-texture and
|
|
317
|
+
// texture-backed images alike.
|
|
318
|
+
auto image = DawnContext::getInstance().MakeRasterImage(getObject());
|
|
319
|
+
if (!image ||
|
|
320
|
+
!image->readPixels(nullptr, info, bfrPtr, bytesPerRow, srcX, srcY)) {
|
|
321
|
+
return jsi::Value::null();
|
|
322
|
+
}
|
|
323
|
+
#else
|
|
316
324
|
auto grContext = getContext()->getDirectContext();
|
|
317
325
|
if (!getObject()->readPixels(grContext, info, bfrPtr, bytesPerRow, srcX,
|
|
318
326
|
srcY)) {
|
|
319
327
|
return jsi::Value::null();
|
|
320
328
|
}
|
|
321
|
-
return dest;
|
|
322
329
|
#endif
|
|
330
|
+
return dest;
|
|
323
331
|
}
|
|
324
332
|
|
|
325
333
|
JSI_HOST_FUNCTION(makeNonTextureImage) {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "JsiPromises.h"
|
|
8
|
+
#include "jsi/JsiPromises.h"
|
|
9
9
|
#include "JsiSkData.h"
|
|
10
10
|
#include "JsiSkHostObjects.h"
|
|
11
11
|
#include "JsiSkImage.h"
|
|
12
12
|
#include "JsiSkImageInfo.h"
|
|
13
13
|
|
|
14
14
|
#ifdef SK_GRAPHITE
|
|
15
|
-
#include "RNDawnContext.h"
|
|
15
|
+
#include "rnskia/RNDawnContext.h"
|
|
16
16
|
#include "rnwgpu/api/GPUTexture.h"
|
|
17
17
|
#endif
|
|
18
18
|
|
package/cpp/api/JsiSkPath.h
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
#pragma clang diagnostic push
|
|
18
18
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
19
19
|
|
|
20
|
-
#include "RNSkLog.h"
|
|
20
|
+
#include "utils/RNSkLog.h"
|
|
21
21
|
#include "include/core/SkPath.h"
|
|
22
22
|
#include "include/core/SkPathBuilder.h"
|
|
23
23
|
#include "include/core/SkPathUtils.h"
|
package/cpp/api/JsiSkSurface.h
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#include "JsiSkImage.h"
|
|
16
16
|
|
|
17
17
|
#if defined(SK_GRAPHITE)
|
|
18
|
-
#include "RNDawnContext.h"
|
|
18
|
+
#include "rnskia/RNDawnContext.h"
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
21
|
#pragma clang diagnostic push
|
|
@@ -72,8 +72,12 @@ public:
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
JSI_HOST_FUNCTION(getCanvas) {
|
|
75
|
+
auto surface = getObject();
|
|
75
76
|
auto canvas =
|
|
76
|
-
std::make_shared<JsiSkCanvas>(getContext(),
|
|
77
|
+
std::make_shared<JsiSkCanvas>(getContext(), surface->getCanvas());
|
|
78
|
+
// Keep a reference to the owning surface so the canvas can read pixels back
|
|
79
|
+
// through a snapshot on Graphite (which lacks synchronous canvas readback).
|
|
80
|
+
canvas->setSurface(surface);
|
|
77
81
|
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(runtime, canvas,
|
|
78
82
|
getContext());
|
|
79
83
|
}
|
|
@@ -81,8 +85,12 @@ public:
|
|
|
81
85
|
JSI_HOST_FUNCTION(flush) {
|
|
82
86
|
auto surface = getObject();
|
|
83
87
|
#if defined(SK_GRAPHITE)
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
// A raster surface (e.g. Skia.Surface.Make) has no Graphite recorder;
|
|
89
|
+
// only Graphite-backed surfaces need to snap and submit a recording.
|
|
90
|
+
if (auto *recorder = surface->recorder()) {
|
|
91
|
+
auto recording = recorder->snap();
|
|
92
|
+
DawnContext::getInstance().submitRecording(recording.get());
|
|
93
|
+
}
|
|
86
94
|
#else
|
|
87
95
|
if (auto dContext = GrAsDirectContext(surface->recordingContext())) {
|
|
88
96
|
dContext->flushAndSubmit();
|
|
@@ -102,8 +110,12 @@ public:
|
|
|
102
110
|
image = surface->makeImageSnapshot();
|
|
103
111
|
}
|
|
104
112
|
#if defined(SK_GRAPHITE)
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
// A raster surface (e.g. Skia.Surface.Make) has no Graphite recorder; its
|
|
114
|
+
// snapshot is already a valid CPU image, so skip the recording submit.
|
|
115
|
+
if (auto *recorder = surface->recorder()) {
|
|
116
|
+
auto recording = recorder->snap();
|
|
117
|
+
DawnContext::getInstance().submitRecording(recording.get());
|
|
118
|
+
}
|
|
107
119
|
#endif
|
|
108
120
|
if (count > 1 && arguments[1].isObject()) {
|
|
109
121
|
auto jsiImage =
|
package/cpp/api/JsiSkTypeface.h
CHANGED