chore: Upgrade Skia to new Ganesh Rendering Pipeline and RN to 0.72 (#1638)

* chore: Upgrade all Deps RN 72

* fix breaking skia changes

* fix devDeps

* Update yarn.lock

* fix metro config

* Update yarn.lock
This commit is contained in:
Marc Rousavy
2023-07-03 12:40:07 +02:00
committed by GitHub
parent 820db3ca9e
commit 4ad4804e51
23 changed files with 4196 additions and 3393 deletions

View File

@@ -29,13 +29,7 @@ FrameProcessorCallback convertWorkletToFrameProcessorCallback(jsi::Runtime& runt
// Wrap Worklet call in invoker
auto workletInvoker = std::make_shared<RNWorklet::WorkletInvoker>(worklet);
// Create cached Skia Canvas object
auto callInvoker = RCTBridge.currentBridge.jsCallInvoker;
auto skiaPlatformContext = std::make_shared<RNSkia::RNSkiOSPlatformContext>(&runtime, callInvoker, [](std::function<void()>) {
// TODO: dispatch on main thread is stubbed for now :/
}, [](size_t viewTag) {
// TODO: screenshot is stubbed for now :/
return sk_sp<SkImage>(nullptr);
});
auto skiaPlatformContext = std::make_shared<RNSkia::RNSkiOSPlatformContext>(&runtime, RCTBridge.currentBridge);
auto canvasHostObject = std::make_shared<RNSkia::JsiSkCanvas>(skiaPlatformContext);
// Converts a Worklet to a callable Objective-C block function

View File

@@ -10,6 +10,7 @@
#import <Foundation/Foundation.h>
#import "SkiaMetalCanvasProvider.h"
#include <include/core/SkCanvas.h>
#include <exception>
#include <string>

View File

@@ -13,7 +13,9 @@
#import <include/core/SkColorSpace.h>
#import <include/core/SkSurface.h>
#import <include/core/SkCanvas.h>
#import <include/core/SkData.h>
#import <include/core/SkImage.h>
#import <include/gpu/ganesh/SkImageGanesh.h>
#import <include/gpu/mtl/GrMtlTypes.h>
#import <include/gpu/GrRecordingContext.h>
#include <TargetConditionals.h>
@@ -68,17 +70,17 @@ sk_sp<SkImage> SkImageHelpers::convertCMSampleBufferToSkImage(GrRecordingContext
GrMtlTextureInfo textureInfo;
auto mtlTexture = CVMetalTextureGetTexture(cvTexture);
textureInfo.fTexture.retain((__bridge void*)mtlTexture);
// Wrap it in a GrBackendTexture
GrBackendTexture texture(width, height, GrMipmapped::kNo, textureInfo);
// Create an SkImage from the existing texture
auto image = SkImage::MakeFromTexture(context,
texture,
kTopLeft_GrSurfaceOrigin,
kBGRA_8888_SkColorType,
kOpaque_SkAlphaType,
SkColorSpace::MakeSRGB());
auto image = SkImages::AdoptTextureFrom(context,
texture,
kTopLeft_GrSurfaceOrigin,
kBGRA_8888_SkColorType,
kOpaque_SkAlphaType,
SkColorSpace::MakeSRGB());
// Release the Texture wrapper (it will still be strong)
CFRelease(cvTexture);

View File

@@ -6,11 +6,12 @@
#import <MetalKit/MetalKit.h>
#import <QuartzCore/CAMetalLayer.h>
#import <AVFoundation/AVFoundation.h>
#include <functional>
#include <include/gpu/GrDirectContext.h>
#include <include/core/SkCanvas.h>
#include <functional>
#include <mutex>
#include <memory>
#include <atomic>

View File

@@ -7,6 +7,7 @@
#import <include/core/SkSurface.h>
#import <include/core/SkCanvas.h>
#import <include/core/SkFont.h>
#import <include/gpu/ganesh/SkImageGanesh.h>
#import <include/gpu/GrDirectContext.h>
#import "SkImageHelpers.h"
@@ -120,12 +121,12 @@ void SkiaMetalCanvasProvider::render() {
GrMtlTextureInfo textureInfo;
textureInfo.fTexture.retain((__bridge void*)texture);
GrBackendTexture backendTexture(texture.width, texture.height, GrMipmapped::kNo, textureInfo);
auto image = SkImage::MakeFromTexture(context,
backendTexture,
kTopLeft_GrSurfaceOrigin,
kBGRA_8888_SkColorType,
kOpaque_SkAlphaType,
SkColorSpace::MakeSRGB());
auto image = SkImages::AdoptTextureFrom(context,
backendTexture,
kTopLeft_GrSurfaceOrigin,
kBGRA_8888_SkColorType,
kOpaque_SkAlphaType,
SkColorSpace::MakeSRGB());
// Draw the Texture (Frame) to the Canvas
canvas->drawImage(image, 0, 0);