New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to m114 #1604
Update to m114 #1604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
I'd like us to have a list with explanations of all the build changes you've made and why they were made - This is important so that we can go back and use it for reference later. The code changes are self explanatory, but the lint-, CMakeLists, podspec etc needs to be documented at least in this PRs description.
@@ -165,7 +165,6 @@ export const configurations: Configuration = { | |||
}, | |||
args: [ | |||
["skia_use_metal", true], | |||
["skia_use_gl", true], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was just removed because superfluous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree - but we need a description of why it was superfluous - I know you removed SK_GL, but SK_GL was previously necessary to build on iOS with Metal - a description in the PR needs to contain the information of why this was now removed (probl. because it is no longer needed to make it build) and the tests you've made to verify this. It is also important that the PR's main description contains this information - it is important reference for later. As I said the code changes in C++ is self explanatory, so they only needs one line in the description.
So please add a list of main changes and why they were made on the top :) (not as comments :) :) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I just assumed that it was superfluous and removed it and it works. Also the skia repository contains a list of build recipes and skia_use_metal=true skia_use_gl=true is not a recipe that exists. Since when this has changed, I don't know.
@@ -22,7 +22,7 @@ Pod::Spec.new do |s| | |||
|
|||
s.requires_arc = true | |||
s.pod_target_xcconfig = { | |||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_GL=1 SK_METAL=1', | |||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_METAL=1 SK_GANESH=1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found from https://skia.googlesource.com/skia/+/refs/heads/main/RELEASE_NOTES.md#milestone-113
SK_GL was superfluous
@@ -85,7 +85,7 @@ - (instancetype)initWithUiManager:(RCTUIManager *)uiManager { | |||
kBGRA_8888_SkColorType, kPremul_SkAlphaType); | |||
|
|||
// ... and then create the SkImage itself! | |||
return SkImage::MakeRasterData(info, skData, bytesPerRow); | |||
return SkImages::RasterFromData(info, skData, bytesPerRow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!strokePaint.getFillPath(*_path.get(), p.get(), nullptr, | ||
precision)) { | ||
if (!skpathutils::FillPathWithPaint(*_path.get(), strokePaint, | ||
p.get(), nullptr, precision)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -320,8 +323,7 @@ class JsiSkPath : public JsiSkWrappingSharedPtrHostObject<SkPath> { | |||
|
|||
JSI_HOST_FUNCTION(toSVGString) { | |||
SkPath path = *getObject(); | |||
SkString s; | |||
SkParsePath::ToSVGString(path, &s); | |||
auto s = SkParsePath::ToSVGString(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skpathutils::FillPathWithPaint(path, p, &path, nullptr, precision); | ||
if (result) { | ||
getObject()->swap(path); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -30,7 +30,7 @@ class JsiSkImageFactory : public JsiSkHostObject { | |||
auto imageInfo = JsiSkImageInfo::fromValue(runtime, arguments[0]); | |||
auto pixelData = JsiSkData::fromValue(runtime, arguments[1]); | |||
auto bytesPerRow = arguments[2].asNumber(); | |||
auto image = SkImage::MakeRasterData(*imageInfo, pixelData, bytesPerRow); | |||
auto image = SkImages::RasterFromData(*imageInfo, pixelData, bytesPerRow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -18,7 +18,7 @@ class JsiSkImageFactory : public JsiSkHostObject { | |||
public: | |||
JSI_HOST_FUNCTION(MakeImageFromEncoded) { | |||
auto data = JsiSkData::fromValue(runtime, arguments[0]); | |||
auto image = SkImage::MakeFromEncoded(data); | |||
auto image = SkImages::DeferredFromEncodedData(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | ||
SkPngEncoder::Options options; | ||
data = SkPngEncoder::Encode(nullptr, image.get(), options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | ||
SkPngEncoder::Options options; | ||
data = SkPngEncoder::Encode(nullptr, getObject().get(), options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -101,7 +101,7 @@ sk_sp<SkImage> JniPlatformContext::takeScreenshotFromViewTag(size_t tag) { | |||
// Create pixmap from pixels and make a copy of it so that | |||
// the SkImage owns its own pixels | |||
SkPixmap pm(skInfo, pixels, bmi.stride); | |||
auto skImage = SkImage::MakeRasterCopy(pm); | |||
auto skImage = SkImages::RasterFromPixmapCopy(pm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -278,6 +278,7 @@ if (ENABLE_PREFAB) { | |||
into "${project.buildDir}/headers/rnskia/" | |||
includeEmptyDirs = false | |||
include "**/*.h" | |||
duplicatesStrategy = 'include' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://skia.googlesource.com/skia/+/refs/heads/main/RELEASE_NOTES.md#milestone-114 (the duplicated files link directly to the moved files and will be removed eventually from Skia).
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.4.1) | |||
|
|||
set (CMAKE_VERBOSE_MAKEFILE ON) | |||
set (CMAKE_CXX_STANDARD 17) | |||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID") | |||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_GANESH -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I linked to the relevant milestone (couldn't link directly to the item within the milestone) but we can discuss the changes offline as well if needed. |
@@ -13,8 +13,7 @@ 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/SkLRUCache.h ./package/cpp/skia/src/core/.`, | |||
`cp -a ./externals/skia/src/core/SkTInternalLList.h ./package/cpp/skia/src/core/.`, | |||
`cp -a ./externals/skia/src/core/SkTHash.h ./package/cpp/skia/src/core/.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I first removed the SkLRUCache.h SkTInternalLList.h and then added the ones which were needed. This is sensible to do this for every upgrade since these private API will be changing a lot everytime.
The way I approach the upgrade was: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a throughout explanation in the PR’s description about the changes (not each code change, they are kind of self explanatory) - but at least about each of the build file changes and why they were made.
Create a simple list of changes like this:
- Changed "reanimtead/js-function-in-worklet" to off because ......
- Added define SK_GANESH in Android build because...
- Added duplicatesStrategy "include" in Android build.gradle because...
- Removed define SK_GL since we can now build for Metal without this define on iOS
- Copied the file SkTHash.h in our build script since...
I upgraded the description accordingly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, thanks for documenting the changes - it'll help us down the road.
Next step is to merge to main, start the Skia build and then create a new release!! :) :)
let's do it finger crossed 🤞🏻 |
# Why update @shopify/react-native-skia vendoring module for sdk 49 # How - [tools] update patch - `et uvm -m @shopify/react-native-skia -c 0.1.193` - backport skia chrome/m114 to sdk47 and sdk48 code. reference changes from Shopify/react-native-skia#1604 # Test Plan - versioned expo go + unversioned ncl skia - versioned expo go + sdk 48 ncl skia
SK_GANESH
to the list of preprocessor directives (m113)duplicatesStrategy = 'include'
to the header copy on Android due to headers which have moved location but a redirect at the old location is kept for backward compatibility. An example of such header would be: https://github.com/google/skia/blob/main/include/core/SkEncodedImageFormat.hSkImage
factories have been moved toSkImages
(m114)image->encodeToData
doesn't exists anymore. (m114)