Reland "Remove deprecated form of SkRuntimeEffect::Make."
This reverts commite89b50ae05
. Reason for revert: landed Android fix at http://ag/13544365 (master) and http://ag/13554983 (sc-dev) Original change's description: > Android roll broke with a compilation error: > frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get' > sk_sp<SkRuntimeEffect> effect = std::get<0>(result) > > Revert "Remove deprecated form of SkRuntimeEffect::Make." > > This reverts commit1cda194366
. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > Remove deprecated form of SkRuntimeEffect::Make. > > > > Chromium has migrated to the new API at https://crrev.com/c/2675855. > > > > Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060 > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com > > Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616 > Reviewed-by: Stan Iliev <stani@google.com> > Commit-Queue: Stan Iliev <stani@google.com> TBR=mtklein@google.com,brianosman@google.com,stani@google.com,johnstiles@google.com Change-Id: I9d679013cb275dc80aaaa977b7f1f4da31f36d1e No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369037 Reviewed-by: John Stiles <johnstiles@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
2494942f0d
commit
1f19ce2272
@ -32,6 +32,7 @@ Milestone 90
|
||||
* Updated SkRuntimeEffect::Make() to take an Options struct. It also now returns a Results struct
|
||||
instead of a tuple.
|
||||
https://review.skia.org/363785
|
||||
https://review.skia.org/367060
|
||||
|
||||
* Changed SkRuntimeEffect::Varying to have lower-case member names, with no 'f' prefix.
|
||||
https://review.skia.org/365656
|
||||
|
@ -204,14 +204,14 @@ DEF_BENCH( return new ColorFilterBench("gaussian", []() {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
DEF_BENCH( return new ColorFilterBench("src_runtime", []() {
|
||||
static sk_sp<SkRuntimeEffect> gEffect = std::get<0>(
|
||||
SkRuntimeEffect::Make(SkString(RuntimeNone_GPU_SRC)));
|
||||
static sk_sp<SkRuntimeEffect> gEffect =
|
||||
SkRuntimeEffect::Make(SkString(RuntimeNone_GPU_SRC)).effect;
|
||||
sk_sp<SkColorFilter> input = nullptr;
|
||||
return gEffect->makeColorFilter(SkData::MakeEmpty(), &input, 1);
|
||||
});)
|
||||
DEF_BENCH( return new ColorFilterBench("matrix_runtime", []() {
|
||||
static sk_sp<SkRuntimeEffect> gEffect = std::get<0>(
|
||||
SkRuntimeEffect::Make(SkString(RuntimeColorMatrix_GPU_SRC)));
|
||||
static sk_sp<SkRuntimeEffect> gEffect =
|
||||
SkRuntimeEffect::Make(SkString(RuntimeColorMatrix_GPU_SRC)).effect;
|
||||
sk_sp<SkColorFilter> input = nullptr;
|
||||
return gEffect->makeColorFilter(SkData::MakeWithCopy(gColorMatrix, sizeof(gColorMatrix)),
|
||||
&input, 1);
|
||||
|
@ -316,10 +316,10 @@ DEF_SIMPLE_GM(sksl_sample_chaining, canvas, 380, 306) {
|
||||
SkBitmap bmp = make_test_bitmap();
|
||||
|
||||
sk_sp<SkRuntimeEffect> effects[4] = {
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(gConstantMatrixSkSL))),
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(gUniformMatrixSkSL))),
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(gVariableMatrixSkSL))),
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(gExplicitCoordSkSL))),
|
||||
SkRuntimeEffect::Make(SkString(gConstantMatrixSkSL)).effect,
|
||||
SkRuntimeEffect::Make(SkString(gUniformMatrixSkSL)).effect,
|
||||
SkRuntimeEffect::Make(SkString(gVariableMatrixSkSL)).effect,
|
||||
SkRuntimeEffect::Make(SkString(gExplicitCoordSkSL)).effect,
|
||||
};
|
||||
|
||||
canvas->translate(10, 10);
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
return mix(sample(cf0), sample(cf1), t);
|
||||
}
|
||||
)";
|
||||
effect = std::get<0>(SkRuntimeEffect::Make(SkString(sksl)));
|
||||
effect = SkRuntimeEffect::Make(SkString(sksl)).effect;
|
||||
SkASSERT(effect);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class RuntimeFunctions : public skiagm::GM {
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
sk_sp<SkRuntimeEffect> gEffect =
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(RUNTIME_FUNCTIONS_SRC)));
|
||||
SkRuntimeEffect::Make(SkString(RUNTIME_FUNCTIONS_SRC)).effect;
|
||||
SkASSERT(gEffect);
|
||||
|
||||
SkMatrix localM;
|
||||
|
@ -356,7 +356,7 @@ DEF_SIMPLE_GM(child_sampling_rt, canvas, 256,256) {
|
||||
surf->getCanvas()->drawLine(0, 0, 100, 100, p);
|
||||
auto shader = surf->makeImageSnapshot()->makeShader(SkSamplingOptions(SkFilterMode::kLinear));
|
||||
|
||||
SkRuntimeShaderBuilder builder(std::get<0>(SkRuntimeEffect::Make(SkString(scale))));
|
||||
SkRuntimeShaderBuilder builder(SkRuntimeEffect::Make(SkString(scale)).effect);
|
||||
builder.child("child") = shader;
|
||||
p.setShader(builder.makeShader(nullptr, false));
|
||||
|
||||
|
@ -305,7 +305,7 @@ DEF_SIMPLE_GM(vertices_data, canvas, 512, 256) {
|
||||
return vtx_color;
|
||||
}
|
||||
)";
|
||||
auto[effect, errorText] = SkRuntimeEffect::Make(SkString(gProg));
|
||||
auto [effect, errorText] = SkRuntimeEffect::Make(SkString(gProg));
|
||||
if (!effect) {
|
||||
SK_ABORT("RuntimeEffect error: %s\n", errorText.c_str());
|
||||
}
|
||||
|
@ -87,12 +87,9 @@ public:
|
||||
|
||||
static Result Make(SkString sksl, const Options& options);
|
||||
|
||||
// Older/deprecated version of the Make() API:
|
||||
using EffectResult = std::tuple<sk_sp<SkRuntimeEffect>, SkString>;
|
||||
static EffectResult Make(SkString sksl) {
|
||||
Result result = Make(sksl, Options{});
|
||||
return EffectResult{std::move(result.effect), std::move(result.errorText)};
|
||||
}
|
||||
// We can't use a default argument for `options` due to a bug in Clang.
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=36684
|
||||
static Result Make(SkString sksl) { return Make(std::move(sksl), Options{}); }
|
||||
|
||||
sk_sp<SkShader> makeShader(sk_sp<SkData> uniforms,
|
||||
sk_sp<SkShader> children[],
|
||||
|
@ -64,7 +64,7 @@ static sk_sp<SkRuntimeEffect> make_effect() {
|
||||
)";
|
||||
|
||||
static const SkRuntimeEffect* effect =
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(BLACK_AND_WHITE_EFFECT))).release();
|
||||
SkRuntimeEffect::Make(SkString(BLACK_AND_WHITE_EFFECT)).effect.release();
|
||||
SkASSERT(effect);
|
||||
|
||||
return sk_ref_sp(effect);
|
||||
|
@ -140,8 +140,8 @@ public:
|
||||
const AnimationBuilder& abuilder,
|
||||
sk_sp<sksg::RenderNode> layer)
|
||||
: INHERITED(sksg::ExternalColorFilter::Make(std::move(layer)))
|
||||
, fBrightnessEffect(std::get<0>(SkRuntimeEffect::Make(SkString(BRIGHTNESS_EFFECT))))
|
||||
, fContrastEffect(std::get<0>(SkRuntimeEffect::Make(SkString(CONTRAST_EFFECT)))) {
|
||||
, fBrightnessEffect(SkRuntimeEffect::Make(SkString(BRIGHTNESS_EFFECT)).effect)
|
||||
, fContrastEffect(SkRuntimeEffect::Make(SkString(CONTRAST_EFFECT)).effect) {
|
||||
SkASSERT(fBrightnessEffect);
|
||||
SkASSERT(fContrastEffect);
|
||||
|
||||
|
@ -55,9 +55,9 @@ static constexpr char gDisplacementSkSL[] = R"(
|
||||
|
||||
static sk_sp<SkRuntimeEffect> displacement_effect_singleton() {
|
||||
static const SkRuntimeEffect* effect =
|
||||
std::get<0>(SkRuntimeEffect::Make(SkString(gDisplacementSkSL))).release();
|
||||
SkRuntimeEffect::Make(SkString(gDisplacementSkSL)).effect.release();
|
||||
if (0 && !effect) {
|
||||
auto err = std::get<1>(SkRuntimeEffect::Make(SkString(gDisplacementSkSL)));
|
||||
auto err = SkRuntimeEffect::Make(SkString(gDisplacementSkSL)).errorText;
|
||||
printf("!!! %s\n", err.c_str());
|
||||
}
|
||||
SkASSERT(effect);
|
||||
|
@ -488,7 +488,7 @@ sk_sp<SkFlattenable> SkRuntimeColorFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
buffer.readString(&sksl);
|
||||
sk_sp<SkData> uniforms = buffer.readByteArrayAsData();
|
||||
|
||||
auto effect = std::get<0>(SkRuntimeEffect::Make(std::move(sksl)));
|
||||
auto effect = SkRuntimeEffect::Make(std::move(sksl)).effect;
|
||||
if (!buffer.validate(effect != nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -659,7 +659,7 @@ sk_sp<SkFlattenable> SkRTShader::CreateProc(SkReadBuffer& buffer) {
|
||||
localMPtr = &localM;
|
||||
}
|
||||
|
||||
auto effect = std::get<0>(SkRuntimeEffect::Make(std::move(sksl)));
|
||||
auto effect = SkRuntimeEffect::Make(std::move(sksl)).effect;
|
||||
if (!buffer.validate(effect != nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
: fReporter(r), fSurface(std::move(surface)) {}
|
||||
|
||||
void build(const char* src) {
|
||||
auto[effect, errorText] = SkRuntimeEffect::Make(SkString(src));
|
||||
auto [effect, errorText] = SkRuntimeEffect::Make(SkString(src));
|
||||
if (!effect) {
|
||||
REPORT_FAILURE(fReporter, "effect",
|
||||
SkStringPrintf("Effect didn't compile: %s", errorText.c_str()));
|
||||
@ -322,7 +322,7 @@ DEF_TEST(SkRuntimeShaderBuilderReuse, r) {
|
||||
half4 main() { return half4(x); }
|
||||
)";
|
||||
|
||||
sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(kSource)));
|
||||
sk_sp<SkRuntimeEffect> effect = SkRuntimeEffect::Make(SkString(kSource)).effect;
|
||||
REPORTER_ASSERT(r, effect);
|
||||
|
||||
// Test passes if this sequence doesn't assert. skbug.com/10667
|
||||
@ -341,7 +341,7 @@ DEF_TEST(SkRuntimeShaderBuilderSetUniforms, r) {
|
||||
half4 main() { return half4(x); }
|
||||
)";
|
||||
|
||||
sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(kSource)));
|
||||
sk_sp<SkRuntimeEffect> effect = SkRuntimeEffect::Make(SkString(kSource)).effect;
|
||||
REPORTER_ASSERT(r, effect);
|
||||
|
||||
SkRuntimeShaderBuilder b(std::move(effect));
|
||||
|
Loading…
Reference in New Issue
Block a user