@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/cpp/api/JsiSkiaContext.h
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include <vector>
|
|
7
7
|
|
|
8
8
|
#include "JsiSkHostObjects.h"
|
|
9
|
-
#include "RNSkLog.h"
|
|
9
|
+
#include "utils/RNSkLog.h"
|
|
10
10
|
#include <jsi/jsi.h>
|
|
11
11
|
|
|
12
12
|
#include "JsiSkPaint.h"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#include "JsiSkRect.h"
|
|
15
15
|
#include "JsiSkTypeface.h"
|
|
16
16
|
|
|
17
|
-
#include "RNWindowContext.h"
|
|
17
|
+
#include "rnskia/RNWindowContext.h"
|
|
18
18
|
|
|
19
19
|
#pragma clang diagnostic push
|
|
20
20
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
package/cpp/api/JsiTextureInfo.h
CHANGED
package/cpp/api/JsiVideo.h
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
#include <vector>
|
|
7
7
|
|
|
8
8
|
#include "JsiSkHostObjects.h"
|
|
9
|
-
#include "RNSkLog.h"
|
|
9
|
+
#include "utils/RNSkLog.h"
|
|
10
10
|
#include <jsi/jsi.h>
|
|
11
11
|
|
|
12
12
|
#include "JsiSkPaint.h"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#include "JsiSkRect.h"
|
|
15
15
|
#include "JsiSkTypeface.h"
|
|
16
16
|
|
|
17
|
-
#include "RNSkVideo.h"
|
|
17
|
+
#include "rnskia/RNSkVideo.h"
|
|
18
18
|
|
|
19
19
|
#pragma clang diagnostic push
|
|
20
20
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
#include <utility>
|
|
6
6
|
#include <vector>
|
|
7
7
|
|
|
8
|
-
#include "JsiSkCanvas.h"
|
|
9
|
-
#include "JsiSkHostObjects.h"
|
|
10
|
-
#include "JsiSkPicture.h"
|
|
8
|
+
#include "api/JsiSkCanvas.h"
|
|
9
|
+
#include "api/JsiSkHostObjects.h"
|
|
10
|
+
#include "api/JsiSkPicture.h"
|
|
11
11
|
|
|
12
12
|
#include "DrawingCtx.h"
|
|
13
13
|
#include "RNRecorder.h"
|
|
14
|
-
#include "RNSkLog.h"
|
|
14
|
+
#include "utils/RNSkLog.h"
|
|
15
15
|
|
|
16
16
|
#include <jsi/jsi.h>
|
|
17
17
|
|
package/cpp/jsi/ViewProperty.h
CHANGED
|
@@ -138,6 +138,15 @@ public:
|
|
|
138
138
|
wgpu::SharedTextureMemoryBeginAccessDescriptor beginAccessDesc;
|
|
139
139
|
beginAccessDesc.initialized = true;
|
|
140
140
|
beginAccessDesc.fenceCount = 0;
|
|
141
|
+
#if defined(__ANDROID__)
|
|
142
|
+
// Dawn's Vulkan backend requires the acquired VkImageLayout to be chained.
|
|
143
|
+
// UNDEFINED (= 0) on both ends is the canonical "no prior GPU producer"
|
|
144
|
+
// pattern (matches GPUSharedTextureMemory::beginAccess).
|
|
145
|
+
wgpu::SharedTextureMemoryVkImageLayoutBeginState vkBegin = {};
|
|
146
|
+
vkBegin.oldLayout = 0;
|
|
147
|
+
vkBegin.newLayout = 0;
|
|
148
|
+
beginAccessDesc.nextInChain = &vkBegin;
|
|
149
|
+
#endif
|
|
141
150
|
bool success = memory.BeginAccess(texture, &beginAccessDesc);
|
|
142
151
|
|
|
143
152
|
if (success) {
|
|
@@ -149,6 +158,10 @@ public:
|
|
|
149
158
|
[](void *context) {
|
|
150
159
|
auto ctx = static_cast<SharedTextureContext *>(context);
|
|
151
160
|
wgpu::SharedTextureMemoryEndAccessState endState = {};
|
|
161
|
+
#if defined(__ANDROID__)
|
|
162
|
+
wgpu::SharedTextureMemoryVkImageLayoutEndState vkEnd = {};
|
|
163
|
+
endState.nextInChain = &vkEnd;
|
|
164
|
+
#endif
|
|
152
165
|
ctx->sharedTextureMemory.EndAccess(ctx->texture, &endState);
|
|
153
166
|
delete ctx;
|
|
154
167
|
},
|
package/cpp/rnskia/RNDawnUtils.h
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#include "dawn/dawn_proc.h"
|
|
6
6
|
#include "dawn/native/DawnNative.h"
|
|
7
7
|
|
|
8
|
-
#include "RNSkLog.h"
|
|
8
|
+
#include "utils/RNSkLog.h"
|
|
9
9
|
#include "include/core/SkColorType.h"
|
|
10
10
|
#include "include/gpu/graphite/dawn/DawnBackendContext.h"
|
|
11
11
|
|
|
@@ -206,12 +206,22 @@ createDawnBackendContext(dawn::native::Instance *instance) {
|
|
|
206
206
|
wgpu::FeatureName::ImplicitDeviceSynchronization,
|
|
207
207
|
#ifdef __APPLE__
|
|
208
208
|
wgpu::FeatureName::SharedTextureMemoryIOSurface,
|
|
209
|
+
// Required to call SharedTextureMemory::EndAccess on Metal (it exports a
|
|
210
|
+
// MTLSharedEvent fence). importExternalTexture / importSharedTextureMemory
|
|
211
|
+
// end the access window after submit; without this EndAccess errors with
|
|
212
|
+
// "Required feature (SharedFenceMTLSharedEvent) is missing". Safe here
|
|
213
|
+
// because we always queue.submit() before EndAccess (the secondary device
|
|
214
|
+
// omits it on purpose — its camera path doesn't commit first).
|
|
215
|
+
wgpu::FeatureName::SharedFenceMTLSharedEvent,
|
|
209
216
|
wgpu::FeatureName::DawnMultiPlanarFormats,
|
|
210
217
|
wgpu::FeatureName::MultiPlanarFormatP010,
|
|
211
218
|
wgpu::FeatureName::MultiPlanarFormatP210,
|
|
212
219
|
wgpu::FeatureName::MultiPlanarFormatExtendedUsages,
|
|
213
220
|
#else
|
|
214
221
|
wgpu::FeatureName::SharedTextureMemoryAHardwareBuffer,
|
|
222
|
+
// Vulkan equivalent of the above: EndAccess exports a sync-fd fence.
|
|
223
|
+
wgpu::FeatureName::SharedFenceSyncFD,
|
|
224
|
+
wgpu::FeatureName::SharedFenceVkSemaphoreOpaqueFD,
|
|
215
225
|
#endif
|
|
216
226
|
};
|
|
217
227
|
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
#include <utility>
|
|
10
10
|
#include <vector>
|
|
11
11
|
|
|
12
|
-
#include "JsiHostObject.h"
|
|
12
|
+
#include "jsi/JsiHostObject.h"
|
|
13
13
|
#include "RNSkPictureView.h"
|
|
14
14
|
#include "RNSkPlatformContext.h"
|
|
15
15
|
#include "RNSkView.h"
|
|
16
|
-
#include "ViewProperty.h"
|
|
16
|
+
#include "jsi/ViewProperty.h"
|
|
17
17
|
#include <jsi/jsi.h>
|
|
18
18
|
|
|
19
19
|
namespace RNSkia {
|
|
@@ -5,22 +5,29 @@
|
|
|
5
5
|
|
|
6
6
|
#include <jsi/jsi.h>
|
|
7
7
|
|
|
8
|
-
#include "JsiSkApi.h"
|
|
8
|
+
#include "api/JsiSkApi.h"
|
|
9
9
|
#include "RNSkJsiViewApi.h"
|
|
10
10
|
#include "RNSkView.h"
|
|
11
11
|
|
|
12
|
-
#include "RuntimeAwareCache.h"
|
|
12
|
+
#include "jsi/RuntimeAwareCache.h"
|
|
13
13
|
|
|
14
14
|
#ifdef SK_GRAPHITE
|
|
15
15
|
#include "RNDawnContext.h"
|
|
16
|
+
#include "rnwgpu/ArrayBuffer.h"
|
|
16
17
|
#include "rnwgpu/api/GPU.h"
|
|
17
18
|
#include "rnwgpu/api/GPUUncapturedErrorEvent.h"
|
|
19
|
+
#include "rnwgpu/api/ImageBitmap.h"
|
|
18
20
|
#include "rnwgpu/api/RNWebGPU.h"
|
|
19
21
|
#include "rnwgpu/api/descriptors/GPUBufferUsage.h"
|
|
20
22
|
#include "rnwgpu/api/descriptors/GPUColorWrite.h"
|
|
21
23
|
#include "rnwgpu/api/descriptors/GPUMapMode.h"
|
|
22
24
|
#include "rnwgpu/api/descriptors/GPUShaderStage.h"
|
|
23
25
|
#include "rnwgpu/api/descriptors/GPUTextureUsage.h"
|
|
26
|
+
#include "jsi2/Promise.h"
|
|
27
|
+
|
|
28
|
+
#include "include/core/SkData.h"
|
|
29
|
+
#include "include/core/SkImage.h"
|
|
30
|
+
#include "include/core/SkImageInfo.h"
|
|
24
31
|
#endif
|
|
25
32
|
|
|
26
33
|
namespace RNSkia {
|
|
@@ -114,6 +121,85 @@ void RNSkManager::installBindings() {
|
|
|
114
121
|
auto rnWebGPU = std::make_shared<rnwgpu::RNWebGPU>(gpu, nullptr);
|
|
115
122
|
_jsRuntime->global().setProperty(
|
|
116
123
|
*_jsRuntime, "RNWebGPU", rnwgpu::RNWebGPU::create(*_jsRuntime, rnWebGPU));
|
|
124
|
+
|
|
125
|
+
// DRAFT — compile-unverified. Install the ImageBitmap constructor (so
|
|
126
|
+
// `instanceof ImageBitmap` works) and a global createImageBitmap() that
|
|
127
|
+
// accepts the non-standard encoded-BufferSource overload.
|
|
128
|
+
//
|
|
129
|
+
// The BufferSource is run through the shared rnwgpu::ArrayBuffer converter,
|
|
130
|
+
// which validates byteOffset/byteLength against the backing buffer and throws
|
|
131
|
+
// synchronously on a spoofed / out-of-bounds view — so createImageBitmap()
|
|
132
|
+
// rejects rather than reading out of bounds (see ArrayBufferBounds /
|
|
133
|
+
// ImageBitmapBounds specs). Decoding uses Skia's own codec; no platform image
|
|
134
|
+
// decoder is needed.
|
|
135
|
+
rnwgpu::ImageBitmap::installConstructor(*_jsRuntime);
|
|
136
|
+
_jsRuntime->global().setProperty(
|
|
137
|
+
*_jsRuntime, "createImageBitmap",
|
|
138
|
+
jsi::Function::createFromHostFunction(
|
|
139
|
+
*_jsRuntime,
|
|
140
|
+
jsi::PropNameID::forAscii(*_jsRuntime, "createImageBitmap"), 1,
|
|
141
|
+
[](jsi::Runtime &rt, const jsi::Value & /*thisVal*/,
|
|
142
|
+
const jsi::Value *args, size_t count) -> jsi::Value {
|
|
143
|
+
if (count < 1 || !args[0].isObject()) {
|
|
144
|
+
throw jsi::JSError(
|
|
145
|
+
rt, "createImageBitmap requires a BufferSource argument");
|
|
146
|
+
}
|
|
147
|
+
// Only the encoded ArrayBuffer / ArrayBufferView overload is
|
|
148
|
+
// supported here. Anything else (Blob, ImageData, …) is rejected.
|
|
149
|
+
auto obj = args[0].getObject(rt);
|
|
150
|
+
bool isBufferSource = obj.isArrayBuffer(rt);
|
|
151
|
+
if (!isBufferSource && obj.hasProperty(rt, "buffer")) {
|
|
152
|
+
auto bufferProp = obj.getProperty(rt, "buffer");
|
|
153
|
+
isBufferSource =
|
|
154
|
+
bufferProp.isObject() &&
|
|
155
|
+
bufferProp.getObject(rt).isArrayBuffer(rt);
|
|
156
|
+
}
|
|
157
|
+
if (!isBufferSource) {
|
|
158
|
+
throw jsi::JSError(rt, "createImageBitmap: unsupported source "
|
|
159
|
+
"(expected an ArrayBuffer or TypedArray "
|
|
160
|
+
"of encoded image bytes)");
|
|
161
|
+
}
|
|
162
|
+
// Validates bounds and THROWS synchronously on a spoofed view, so
|
|
163
|
+
// the bad pointer never reaches the copy below.
|
|
164
|
+
auto buffer =
|
|
165
|
+
rnwgpu::JSIConverter<std::shared_ptr<rnwgpu::ArrayBuffer>>::
|
|
166
|
+
fromJSI(rt, args[0], false);
|
|
167
|
+
// Copy the encoded bytes off the JS-owned ArrayBuffer.
|
|
168
|
+
const uint8_t *bytes = buffer->data();
|
|
169
|
+
std::vector<uint8_t> encoded(bytes, bytes + buffer->size());
|
|
170
|
+
|
|
171
|
+
return rnwgpu::Promise::createPromise(
|
|
172
|
+
rt, [encoded = std::move(encoded)](
|
|
173
|
+
jsi::Runtime &runtime,
|
|
174
|
+
std::shared_ptr<rnwgpu::Promise> promise) mutable {
|
|
175
|
+
auto skData =
|
|
176
|
+
SkData::MakeWithCopy(encoded.data(), encoded.size());
|
|
177
|
+
auto image = SkImages::DeferredFromEncodedData(skData);
|
|
178
|
+
if (image == nullptr) {
|
|
179
|
+
promise->reject(
|
|
180
|
+
"createImageBitmap: failed to decode image data");
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const int w = image->width();
|
|
184
|
+
const int h = image->height();
|
|
185
|
+
auto info =
|
|
186
|
+
SkImageInfo::Make(w, h, kRGBA_8888_SkColorType,
|
|
187
|
+
kUnpremul_SkAlphaType);
|
|
188
|
+
std::vector<uint8_t> pixels(info.computeMinByteSize());
|
|
189
|
+
// nullptr context: decode/read on the CPU (raster).
|
|
190
|
+
if (!image->readPixels(nullptr, info, pixels.data(),
|
|
191
|
+
info.minRowBytes(), 0, 0)) {
|
|
192
|
+
promise->reject(
|
|
193
|
+
"createImageBitmap: failed to read decoded pixels");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
auto bitmap = std::make_shared<rnwgpu::ImageBitmap>(
|
|
197
|
+
std::move(pixels), static_cast<size_t>(w),
|
|
198
|
+
static_cast<size_t>(h));
|
|
199
|
+
promise->resolve(
|
|
200
|
+
rnwgpu::ImageBitmap::create(runtime, bitmap));
|
|
201
|
+
});
|
|
202
|
+
}));
|
|
117
203
|
#endif
|
|
118
204
|
}
|
|
119
205
|
} // namespace RNSkia
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
#include <jsi/jsi.h>
|
|
12
12
|
|
|
13
13
|
#include "RNSkView.h"
|
|
14
|
-
#include "ViewProperty.h"
|
|
14
|
+
#include "jsi/ViewProperty.h"
|
|
15
15
|
|
|
16
|
-
#include "JsiSkPicture.h"
|
|
17
|
-
#include "RNSkLog.h"
|
|
16
|
+
#include "api/JsiSkPicture.h"
|
|
17
|
+
#include "utils/RNSkLog.h"
|
|
18
18
|
#include "RNSkPlatformContext.h"
|
|
19
|
-
#include "RNSkTimingInfo.h"
|
|
19
|
+
#include "utils/RNSkTimingInfo.h"
|
|
20
20
|
|
|
21
21
|
#pragma clang diagnostic push
|
|
22
22
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -141,6 +141,13 @@ public:
|
|
|
141
141
|
|
|
142
142
|
virtual uint64_t makeNativeBuffer(sk_sp<SkImage> image) = 0;
|
|
143
143
|
|
|
144
|
+
// Allocate a platform native buffer (IOSurface on Apple, AHardwareBuffer on
|
|
145
|
+
// Android) of the given size filled with a procedural test pattern (RGB
|
|
146
|
+
// gradient + diagonal stripes), entirely on the CPU. Intended for examples
|
|
147
|
+
// and tests that need a buffer to feed into importExternalTexture without a
|
|
148
|
+
// camera/video source. Release it with releaseNativeBuffer().
|
|
149
|
+
virtual uint64_t makeTestNativeBuffer(int width, int height) = 0;
|
|
150
|
+
|
|
144
151
|
virtual std::shared_ptr<RNSkVideo> createVideo(const std::string &url) = 0;
|
|
145
152
|
|
|
146
153
|
/**
|
package/cpp/rnskia/RNSkView.h
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
#include <vector>
|
|
8
8
|
|
|
9
9
|
#include "RNSkPlatformContext.h"
|
|
10
|
-
#include "ViewProperty.h"
|
|
10
|
+
#include "jsi/ViewProperty.h"
|
|
11
11
|
|
|
12
|
-
#include "JsiSkImage.h"
|
|
13
|
-
#include "JsiSkPoint.h"
|
|
14
|
-
#include "JsiSkRect.h"
|
|
12
|
+
#include "api/JsiSkImage.h"
|
|
13
|
+
#include "api/JsiSkPoint.h"
|
|
14
|
+
#include "api/JsiSkRect.h"
|
|
15
15
|
|
|
16
16
|
#pragma clang diagnostic push
|
|
17
17
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -94,8 +94,11 @@ public:
|
|
|
94
94
|
image = _surface->makeImageSnapshot();
|
|
95
95
|
}
|
|
96
96
|
#if defined(SK_GRAPHITE)
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
// Only Graphite-backed surfaces have a recorder to snap/submit; a raster
|
|
98
|
+
// surface's snapshot is already a valid CPU image.
|
|
99
|
+
if (auto *recorder = _surface->recorder()) {
|
|
100
|
+
DawnContext::getInstance().submitRecording(recorder->snap().get());
|
|
101
|
+
}
|
|
99
102
|
return DawnContext::getInstance().MakeRasterImage(image);
|
|
100
103
|
#else
|
|
101
104
|
auto grContext = _context->getDirectContext();
|
package/cpp/rnwgpu/ArrayBuffer.h
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
#include <jsi/jsi.h>
|
|
3
3
|
|
|
4
|
+
#include <cmath>
|
|
5
|
+
#include <cstdint>
|
|
4
6
|
#include <memory>
|
|
5
7
|
|
|
6
8
|
#include "jsi2/JSIConverter.h"
|
|
@@ -47,16 +49,58 @@ template <> struct JSIConverter<std::shared_ptr<ArrayBuffer>> {
|
|
|
47
49
|
if (bufferProp.isObject() &&
|
|
48
50
|
bufferProp.getObject(runtime).isArrayBuffer(runtime)) {
|
|
49
51
|
auto buff = bufferProp.getObject(runtime);
|
|
50
|
-
auto bytesPerElements =
|
|
51
|
-
obj.getProperty(runtime, "BYTES_PER_ELEMENT").asNumber();
|
|
52
52
|
auto arrayBuffer = buff.getArrayBuffer(runtime);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const size_t bufferSize = arrayBuffer.size(runtime);
|
|
54
|
+
|
|
55
|
+
// byteOffset / byteLength are user-readable JS properties, not values
|
|
56
|
+
// the engine guarantees (unlike Dawn's node binding, which reads them
|
|
57
|
+
// off the engine's typed-array view). Read them as doubles so we can
|
|
58
|
+
// reject negative, non-integral, NaN/Inf, or oversized values before
|
|
59
|
+
// they wrap around when cast to size_t.
|
|
60
|
+
const double byteOffsetValue =
|
|
61
|
+
obj.getProperty(runtime, "byteOffset").asNumber();
|
|
62
|
+
const double byteLengthValue =
|
|
63
|
+
obj.getProperty(runtime, "byteLength").asNumber();
|
|
64
|
+
|
|
65
|
+
auto isValidByteIndex = [](double value) {
|
|
66
|
+
return std::isfinite(value) && value >= 0.0 &&
|
|
67
|
+
value <= static_cast<double>(SIZE_MAX) &&
|
|
68
|
+
std::floor(value) == value;
|
|
69
|
+
};
|
|
70
|
+
if (!isValidByteIndex(byteOffsetValue) ||
|
|
71
|
+
!isValidByteIndex(byteLengthValue)) {
|
|
72
|
+
throw std::runtime_error(
|
|
73
|
+
"ArrayBuffer::fromJSI: invalid byteOffset/byteLength");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const size_t byteOffset = static_cast<size_t>(byteOffsetValue);
|
|
77
|
+
const size_t byteLength = static_cast<size_t>(byteLengthValue);
|
|
78
|
+
|
|
79
|
+
// Overflow-safe bounds check: byteOffset + byteLength <= bufferSize.
|
|
80
|
+
if (byteOffset > bufferSize ||
|
|
81
|
+
byteLength > bufferSize - byteOffset) {
|
|
82
|
+
throw std::runtime_error(
|
|
83
|
+
"ArrayBuffer::fromJSI: view bounds [byteOffset, byteOffset + "
|
|
84
|
+
"byteLength) exceed the backing ArrayBuffer size");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// BYTES_PER_ELEMENT is absent on a DataView; default to 1. A spoofed
|
|
88
|
+
// object could report 0 (or a negative/NaN value), so clamp to a
|
|
89
|
+
// minimum of 1 to avoid a later division by zero in writeBuffer.
|
|
90
|
+
size_t bytesPerElements = 1;
|
|
91
|
+
if (obj.hasProperty(runtime, "BYTES_PER_ELEMENT")) {
|
|
92
|
+
auto bpe = obj.getProperty(runtime, "BYTES_PER_ELEMENT");
|
|
93
|
+
if (bpe.isNumber()) {
|
|
94
|
+
const double value = bpe.asNumber();
|
|
95
|
+
if (std::isfinite(value) && value >= 1.0) {
|
|
96
|
+
bytesPerElements = static_cast<size_t>(value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
57
101
|
return std::make_shared<ArrayBuffer>(
|
|
58
102
|
arrayBuffer.data(runtime) + byteOffset, byteLength,
|
|
59
|
-
|
|
103
|
+
bytesPerElements);
|
|
60
104
|
}
|
|
61
105
|
}
|
|
62
106
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#if defined(__APPLE__)
|
|
4
|
+
|
|
5
|
+
#include <cstdint>
|
|
6
|
+
|
|
7
|
+
namespace rnwgpu {
|
|
8
|
+
|
|
9
|
+
// Extract the backing IOSurface and dimensions from a CVPixelBufferRef pointer
|
|
10
|
+
// (the value Skia's NativeBuffer.MakeFromImage returns on Apple). The returned
|
|
11
|
+
// IOSurfaceRef is owned by the CVPixelBuffer; the caller must keep the
|
|
12
|
+
// CVPixelBuffer alive while the IOSurface is in use. Returns nullptr (and
|
|
13
|
+
// leaves the out-params at 0) if the buffer has no IOSurface.
|
|
14
|
+
//
|
|
15
|
+
// Defined in apple/RNWebGPUAppleNativeBuffer.mm (Objective-C++ so it can use
|
|
16
|
+
// CoreVideo, which isn't available from the cpp/ translation units).
|
|
17
|
+
void *GetIOSurfaceFromNativeBuffer(void *cvPixelBuffer, uint32_t *outWidth,
|
|
18
|
+
uint32_t *outHeight);
|
|
19
|
+
|
|
20
|
+
} // namespace rnwgpu
|
|
21
|
+
|
|
22
|
+
#endif // __APPLE__
|
|
@@ -252,13 +252,24 @@ public:
|
|
|
252
252
|
|
|
253
253
|
[[nodiscard]] bool Convert(wgpu::BindGroupLayoutEntry &out,
|
|
254
254
|
const GPUBindGroupLayoutEntry &in) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
255
|
+
out = {};
|
|
256
|
+
if (!Convert(out.binding, in.binding) ||
|
|
257
|
+
!Convert(out.visibility, in.visibility) ||
|
|
258
|
+
!Convert(out.buffer, in.buffer) || !Convert(out.sampler, in.sampler) ||
|
|
259
|
+
!Convert(out.texture, in.texture) ||
|
|
260
|
+
!Convert(out.storageTexture, in.storageTexture)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
if (in.externalTexture.has_value() &&
|
|
264
|
+
in.externalTexture.value() != nullptr) {
|
|
265
|
+
// External texture layouts bind via a chained struct rather than a
|
|
266
|
+
// direct field on BindGroupLayoutEntry. The chained struct must outlive
|
|
267
|
+
// the BindGroupLayoutEntry until Device::CreateBindGroupLayout returns,
|
|
268
|
+
// so we allocate it on the Convertor's arena.
|
|
269
|
+
auto *chain = Allocate<wgpu::ExternalTextureBindingLayout>();
|
|
270
|
+
out.nextInChain = chain;
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
262
273
|
}
|
|
263
274
|
|
|
264
275
|
[[nodiscard]] bool Convert(wgpu::BlendComponent &out,
|
|
@@ -422,9 +433,11 @@ public:
|
|
|
422
433
|
}
|
|
423
434
|
|
|
424
435
|
[[nodiscard]] bool Convert(wgpu::ExternalTextureBindingLayout &out,
|
|
425
|
-
const GPUExternalTextureBindingLayout &in) {
|
|
426
|
-
// no
|
|
427
|
-
|
|
436
|
+
const GPUExternalTextureBindingLayout & /*in*/) {
|
|
437
|
+
// ExternalTextureBindingLayout carries no fields of its own; its presence
|
|
438
|
+
// (as a chained struct) is what marks the entry as an external texture.
|
|
439
|
+
out = {};
|
|
440
|
+
return true;
|
|
428
441
|
}
|
|
429
442
|
|
|
430
443
|
[[nodiscard]] bool Convert(wgpu::ConstantEntry &out, const std::string &key,
|
|
@@ -729,7 +742,16 @@ public:
|
|
|
729
742
|
out.buffer = buffer->get();
|
|
730
743
|
return true;
|
|
731
744
|
}
|
|
732
|
-
|
|
745
|
+
if (in.externalTexture != nullptr) {
|
|
746
|
+
// External textures bind via a chained struct rather than a direct field
|
|
747
|
+
// on BindGroupEntry. The chained struct must outlive the BindGroupEntry
|
|
748
|
+
// until Device::CreateBindGroup returns, so we allocate it on the
|
|
749
|
+
// Convertor's arena.
|
|
750
|
+
auto *chain = Allocate<wgpu::ExternalTextureBindingEntry>();
|
|
751
|
+
chain->externalTexture = in.externalTexture->get();
|
|
752
|
+
out.nextInChain = chain;
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
733
755
|
return false;
|
|
734
756
|
}
|
|
735
757
|
|
package/cpp/rnwgpu/api/GPU.cpp
CHANGED
|
@@ -136,9 +136,6 @@ std::unordered_set<std::string> GPU::getWgslLanguageFeatures() {
|
|
|
136
136
|
case wgpu::WGSLLanguageFeatureName::BufferView:
|
|
137
137
|
name = "buffer_view";
|
|
138
138
|
break;
|
|
139
|
-
case wgpu::WGSLLanguageFeatureName::FilteringParameters:
|
|
140
|
-
name = "filtering_parameters";
|
|
141
|
-
break;
|
|
142
139
|
case wgpu::WGSLLanguageFeatureName::SwizzleAssignment:
|
|
143
140
|
name = "swizzle_assignment";
|
|
144
141
|
break;
|
|
@@ -109,13 +109,39 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
109
109
|
deviceLostBinding,
|
|
110
110
|
creationRuntime](const async::AsyncTaskHandle::ResolveFunction &resolve,
|
|
111
111
|
const async::AsyncTaskHandle::RejectFunction &reject) {
|
|
112
|
-
|
|
112
|
+
// Build a local mutable copy so we can chain Dawn's device toggles.
|
|
113
|
+
// The toggle name strings are owned by `descriptor` (captured above),
|
|
114
|
+
// and the const char* / DawnTogglesDescriptor locals live for the
|
|
115
|
+
// whole synchronous RequestDevice call below, which is when Dawn reads
|
|
116
|
+
// the chained struct.
|
|
117
|
+
wgpu::DeviceDescriptor deviceDesc = aDescriptor;
|
|
118
|
+
wgpu::DawnTogglesDescriptor toggles{};
|
|
119
|
+
std::vector<const char *> enabledToggles;
|
|
120
|
+
std::vector<const char *> disabledToggles;
|
|
121
|
+
if (descriptor.has_value() && descriptor.value()->dawnToggles) {
|
|
122
|
+
const auto &dawnToggles = descriptor.value()->dawnToggles.value();
|
|
123
|
+
if (dawnToggles->enabledToggles) {
|
|
124
|
+
for (const auto &t : dawnToggles->enabledToggles.value()) {
|
|
125
|
+
enabledToggles.push_back(t.c_str());
|
|
126
|
+
}
|
|
127
|
+
toggles.enabledToggleCount = enabledToggles.size();
|
|
128
|
+
toggles.enabledToggles = enabledToggles.data();
|
|
129
|
+
}
|
|
130
|
+
if (dawnToggles->disabledToggles) {
|
|
131
|
+
for (const auto &t : dawnToggles->disabledToggles.value()) {
|
|
132
|
+
disabledToggles.push_back(t.c_str());
|
|
133
|
+
}
|
|
134
|
+
toggles.disabledToggleCount = disabledToggles.size();
|
|
135
|
+
toggles.disabledToggles = disabledToggles.data();
|
|
136
|
+
}
|
|
137
|
+
deviceDesc.nextInChain = &toggles;
|
|
138
|
+
}
|
|
113
139
|
_instance.RequestDevice(
|
|
114
|
-
&
|
|
140
|
+
&deviceDesc, wgpu::CallbackMode::AllowProcessEvents,
|
|
115
141
|
[asyncRunner = _async, resolve, reject, label, creationRuntime,
|
|
116
142
|
deviceLostBinding](wgpu::RequestDeviceStatus status,
|
|
117
143
|
wgpu::Device device,
|
|
118
|
-
wgpu::StringView message)
|
|
144
|
+
wgpu::StringView message) {
|
|
119
145
|
if (message.length) {
|
|
120
146
|
fprintf(stderr, "%s", message.data);
|
|
121
147
|
}
|
|
@@ -128,10 +154,13 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
128
154
|
return;
|
|
129
155
|
}
|
|
130
156
|
|
|
157
|
+
// SetLoggingCallback is a repeatable callback (no callback mode),
|
|
158
|
+
// which rejects capturing lambdas. Pass the runtime pointer
|
|
159
|
+
// through Dawn's userdata argument instead of capturing it.
|
|
131
160
|
device.SetLoggingCallback(
|
|
132
|
-
[
|
|
133
|
-
|
|
134
|
-
if (
|
|
161
|
+
[](wgpu::LoggingType type, wgpu::StringView msg,
|
|
162
|
+
jsi::Runtime *runtime) {
|
|
163
|
+
if (runtime == nullptr) {
|
|
135
164
|
return;
|
|
136
165
|
}
|
|
137
166
|
const char *logLevel = "";
|
|
@@ -157,7 +186,8 @@ async::AsyncTaskHandle GPUAdapter::requestDevice(
|
|
|
157
186
|
fprintf(stderr, "%s: %.*s\n", logLevel,
|
|
158
187
|
static_cast<int>(msg.length), msg.data);
|
|
159
188
|
}
|
|
160
|
-
}
|
|
189
|
+
},
|
|
190
|
+
creationRuntime);
|
|
161
191
|
|
|
162
192
|
auto deviceHost = std::make_shared<GPUDevice>(std::move(device),
|
|
163
193
|
asyncRunner, label);
|