Skip to content

Commit

Permalink
Upgrade to m119 (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Oct 19, 2023
1 parent cd21dce commit 0121d4f
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "externals/skia"]
path = externals/skia
url = https://chromium.googlesource.com/skia/
branch = chrome/m116
branch = chrome/m119
[submodule "externals/depot_tools"]
path = externals/depot_tools
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ SPEC CHECKSUMS:
React-jsinspector: 9885f6f94d231b95a739ef7bb50536fb87ce7539
React-logger: 3f8ebad1be1bf3299d1ab6d7f971802d7395c7ef
react-native-safe-area-context: dfe5aa13bee37a0c7e8059d14f72ffc076d120e9
react-native-skia: 54fc333c477cc04df78b87b03e87b7e112bc3f47
react-native-skia: 98b02a2b122c02f7b13dc4a990ee1d9cec2cb07b
React-perflogger: 2d505bbe298e3b7bacdd9e542b15535be07220f6
React-RCTActionSheet: 0e96e4560bd733c9b37efbf68f5b1a47615892fb
React-RCTAnimation: fd138e26f120371c87e406745a27535e2c8a04ef
Expand Down
2 changes: 1 addition & 1 deletion externals/depot_tools
Submodule depot_tools updated from bcba17 to c51829
2 changes: 1 addition & 1 deletion externals/skia
Submodule skia updated from bb4088 to ab212d
5 changes: 3 additions & 2 deletions package/android/cpp/rnskia-android/SkiaOpenGLHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "SkColorSpace.h"
#include "SkSurface.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/ganesh/gl/GrGLDirectContext.h"
#include "include/gpu/gl/GrGLInterface.h"

#pragma clang diagnostic pop
Expand Down Expand Up @@ -270,10 +271,10 @@ class SkiaOpenGLHelper {

// Create the Skia context
auto backendInterface = GrGLMakeNativeInterface();
context->directContext = GrDirectContext::MakeGL(backendInterface);
context->directContext = GrDirectContexts::MakeGL(backendInterface);

if (context->directContext == nullptr) {
RNSkLogger::logToConsole("GrDirectContext::MakeGL failed");
RNSkLogger::logToConsole("GrDirectContexts::MakeGL failed");
return false;
}
}
Expand Down
11 changes: 9 additions & 2 deletions package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#include "SkiaOpenGLHelper.h"
#include <SkiaOpenGLSurfaceFactory.h>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"

#include "include/gpu/ganesh/gl/GrGLBackendSurface.h"

#pragma clang diagnostic pop

namespace RNSkia {

thread_local SkiaOpenGLContext ThreadContextHolder::ThreadSkiaOpenGLContext;
Expand Down Expand Up @@ -103,8 +110,8 @@ sk_sp<SkSurface> WindowSurfaceHolder::getSurface() {
samples = maxSamples;
}

GrBackendRenderTarget renderTarget(_width, _height, samples, stencil,
fboInfo);
auto renderTarget = GrBackendRenderTargets::MakeGL(_width, _height, samples,
stencil, fboInfo);

SkSurfaceProps props(0, kUnknown_SkPixelGeometry);

Expand Down
5 changes: 4 additions & 1 deletion package/cpp/api/JsiSkSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma clang diagnostic ignored "-Wdocumentation"

#include "SkSurface.h"
#include "include/gpu/GrDirectContext.h"

#pragma clang diagnostic pop

Expand All @@ -37,7 +38,9 @@ class JsiSkSurface : public JsiSkWrappingSkPtrHostObject<SkSurface> {
}

JSI_HOST_FUNCTION(flush) {
getObject()->flush();
if (auto dContext = GrAsDirectContext(getObject()->recordingContext())) {
dContext->flushAndSubmit();
}
return jsi::Value::undefined();
}

Expand Down
4 changes: 3 additions & 1 deletion package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
SkCanvas *canvas = skSurface->getCanvas();
cb(canvas);

skSurface->flushAndSubmit();
if (auto dContext = GrAsDirectContext(skSurface->recordingContext())) {
dContext->flushAndSubmit();
}

id<MTLCommandBuffer> commandBuffer(
[ThreadContextHolder::ThreadSkiaMetalContext
Expand Down
2 changes: 1 addition & 1 deletion package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
GrMtlTextureInfo fbInfo;
fbInfo.fTexture.retain((__bridge void *)texture);

GrBackendRenderTarget backendRT(width, height, 1, fbInfo);
GrBackendRenderTarget backendRT(width, height, fbInfo);

auto skSurface = SkSurfaces::WrapBackendRenderTarget(
ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(), backendRT,
Expand Down
2 changes: 1 addition & 1 deletion package/react-native-skia.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
# optional - use expanded license entry instead:
# s.license = { :type => "MIT", :file => "LICENSE" }
s.authors = { "Your Name" => "[email protected]" }
s.platforms = { :ios => "9.0" }
s.platforms = { :ios => "12.0" }
s.source = { :git => "https://github.com/shopify/react-native-skia/react-native-skia.git", :tag => "#{s.version}" }

s.requires_arc = true
Expand Down
3 changes: 1 addition & 2 deletions scripts/copy-skia-module-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ const copyModule = (module: string) => [
`cp -a ./externals/skia/modules/skcms/. ./package/cpp/skia/modules/skcms`,
`mkdir -p ./package/cpp/skia/src/`,
`mkdir -p ./package/cpp/skia/src/core/`,
`cp -a ./externals/skia/src/core/SkPathEnums.h ./package/cpp/skia/src/core/.`,
`cp -a ./externals/skia/src/core/SkPathPriv.h ./package/cpp/skia/src/core/.`,
`cp -a ./externals/skia/src/core/SkChecksum.h ./package/cpp/skia/src/core/.`,
`cp -a ./externals/skia/src/core/SkTHash.h ./package/cpp/skia/src/core/.`,
`rm ./package/cpp/skia/include/core/SkICC.h`, // Remove since there are now (Skia M108) two headers with the same name
`rm ./package/cpp/skia/include/core/SkEncodedImageFormat.h`, // Remove since there are now (Skia M108) two headers with the same name
].map((cmd) => {
console.log(cmd);
executeCmdSync(cmd);
Expand Down

0 comments on commit 0121d4f

Please sign in to comment.