Roll external/skia 762ddd7e4..d25443560 (8 commits)
https://skia.googlesource.com/skia.git/+log/762ddd7e4..d25443560
2019-03-12 kjlubick@google.com [pathkit] Clean up perf/test init
2019-03-12 bsalomon@google.com Revert "Reintroduce deinstantiate lazy proxy types and use for promise images."
2019-03-12 robertphillips@google.com Always explicitly allocate except in Android Framework (take 2)
2019-03-12 recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com Roll recipe dependencies (trivial).
2019-03-12 brianosman@google.com Remove SkToSRGBColorFilter (now unused)
2019-03-12 rmistry@google.com Add new recipe autoroller service account to list of recognized accounts
2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3e2a4780e607..abb57857c536 (3 commits)
2019-03-12 skia-autoroll@skia-public.iam.gserviceaccount.com Roll third_party/externals/swiftshader 3364227fa0d8..3e2a4780e607 (1 commits)
The AutoRoll server is located here: https://autoroll-internal.skia.org/r/android-master-autoroll
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
If the roll is causing failures, please contact the current sheriff, who should
be CC'd on the roll, and stop the roller if necessary.
Test: Presubmit checks will test this change.
Change-Id: I3ee10de74c18797a88f78ed81c3ab7780c4d011f
Exempt-From-Owner-Approval: The autoroll bot does not require owner approval.
diff --git a/Android.bp b/Android.bp
index 2736144..32b07ea 100644
--- a/Android.bp
+++ b/Android.bp
@@ -328,7 +328,6 @@
"src/effects/SkShaderMaskFilter.cpp",
"src/effects/SkTableColorFilter.cpp",
"src/effects/SkTableMaskFilter.cpp",
- "src/effects/SkToSRGBColorFilter.cpp",
"src/effects/SkTrimPathEffect.cpp",
"src/effects/imagefilters/SkAlphaThresholdFilter.cpp",
"src/effects/imagefilters/SkArithmeticImageFilter.cpp",
@@ -568,7 +567,6 @@
"src/gpu/GrContext_Base.cpp",
"src/gpu/GrDDLContext.cpp",
"src/gpu/GrDefaultGeoProcFactory.cpp",
- "src/gpu/GrDeinstantiateProxyTracker.cpp",
"src/gpu/GrDistanceFieldGenFromVector.cpp",
"src/gpu/GrDrawOpAtlas.cpp",
"src/gpu/GrDrawOpTest.cpp",
@@ -1478,7 +1476,6 @@
"gm/tilemodes.cpp",
"gm/tilemodes_scaled.cpp",
"gm/tinybitmap.cpp",
- "gm/tosrgb_colorfilter.cpp",
"gm/transparency.cpp",
"gm/trickycubicstrokes.cpp",
"gm/typeface.cpp",
@@ -1802,7 +1799,6 @@
"tests/TArrayTest.cpp",
"tests/TDPQueueTest.cpp",
"tests/TLazyTest.cpp",
- "tests/TableColorFilterTest.cpp",
"tests/TemplatesTest.cpp",
"tests/TessellatingPathRendererTests.cpp",
"tests/Test.cpp",
@@ -1814,7 +1810,6 @@
"tests/TextureProxyTest.cpp",
"tests/TextureStripAtlasManagerTest.cpp",
"tests/Time.cpp",
- "tests/ToSRGBColorFilter.cpp",
"tests/TopoSortTest.cpp",
"tests/TraceMemoryDumpTest.cpp",
"tests/TracingTest.cpp",
@@ -2431,7 +2426,6 @@
"gm/tilemodes.cpp",
"gm/tilemodes_scaled.cpp",
"gm/tinybitmap.cpp",
- "gm/tosrgb_colorfilter.cpp",
"gm/transparency.cpp",
"gm/trickycubicstrokes.cpp",
"gm/typeface.cpp",
diff --git a/DEPS b/DEPS
index c425eb6..9c3acd6 100644
--- a/DEPS
+++ b/DEPS
@@ -28,7 +28,7 @@
"third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974",
"third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@661ad91124e6af2272afd00f804d8aa276e17107",
"third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@e9e4393b1c5aad7553c05782acefbe32b42644bd",
- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@3364227fa0d88a3681e03237461cf0d2e4c9b39e",
+ "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@abb57857c5369cecdf048de8b9dc8f530fb37849",
#"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs.git@ae6e8db4ad4236654e7b8c68d24f41a37e5f4f96",
"third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@47af7c547f8551bd25424e56354a2ae1e9062859",
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 0cf5acb..a9e0b5f 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -43,7 +43,7 @@
SERVICE_ACCOUNT_SUFFIX = [
'@%s.iam.gserviceaccount.com' % project for project in [
'skia-buildbots.google.com', 'skia-swarming-bots', 'skia-public',
- 'skia-corp.google.com']]
+ 'skia-corp.google.com', 'chops-service-accounts']]
def _CheckChangeHasEol(input_api, output_api, source_file_filter=None):
diff --git a/gm/tosrgb_colorfilter.cpp b/gm/tosrgb_colorfilter.cpp
deleted file mode 100644
index 8637386..0000000
--- a/gm/tosrgb_colorfilter.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gm.h"
-
-#include "SkColorPriv.h"
-#include "SkToSRGBColorFilter.h"
-
-DEF_SIMPLE_GM_BG(tosrgb_colorfilter, canvas, 130, 130, SK_ColorBLACK) {
- // Src bitmap with some colors that we're going to interpret as being in a few different spaces
- SkBitmap bmp;
- bmp.allocN32Pixels(3, 2);
- SkPMColor* pixels = reinterpret_cast<SkPMColor*>(bmp.getPixels());
- pixels[0] = SkPackARGB32(0xFF, 0xA0, 0x00, 0x00);
- pixels[1] = SkPackARGB32(0xFF, 0x00, 0xA0, 0x00);
- pixels[2] = SkPackARGB32(0xFF, 0x00, 0x00, 0xA0);
- pixels[3] = SkPackARGB32(0xFF, 0x00, 0xA0, 0xA0);
- pixels[4] = SkPackARGB32(0xFF, 0xA0, 0x00, 0xA0);
- pixels[5] = SkPackARGB32(0xFF, 0xA0, 0xA0, 0x00);
-
- // Reference image
- canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(10, 10, 50, 50), nullptr);
-
- auto srgb = SkColorSpace::MakeSRGB();
- auto rec2020 = SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kRec2020);
-
- // NarrowGamut RGB (an artifically smaller than sRGB gamut)
- skcms_Matrix3x3 narrowGamutRGBMatrix;
- SkAssertResult(skcms_PrimariesToXYZD50(
- 0.54f, 0.33f, // Rx, Ry
- 0.33f, 0.50f, // Gx, Gy
- 0.25f, 0.20f, // Bx, By
- 0.3127f, 0.3290f, // Wx, Wy
- &narrowGamutRGBMatrix));
- auto narrow = SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, narrowGamutRGBMatrix);
-
- SkPaint paint;
-
- // Transforming sRGB -> sRGB should do nothing. Top two squares should look identical.
- paint.setColorFilter(SkToSRGBColorFilter::Make(srgb));
- canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(70, 10, 50, 50), &paint);
-
- // Rec2020 -> sRGB should produce more vivid colors.
- paint.setColorFilter(SkToSRGBColorFilter::Make(rec2020));
- canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(10, 70, 50, 50), &paint);
-
- // Narrow -> sRGB should produce more muted colors.
- paint.setColorFilter(SkToSRGBColorFilter::Make(narrow));
- canvas->drawBitmapRect(bmp, SkRect::MakeXYWH(70, 70, 50, 50), &paint);
-}
diff --git a/gn/effects.gni b/gn/effects.gni
index 217eb6a..ee4ec03 100644
--- a/gn/effects.gni
+++ b/gn/effects.gni
@@ -30,7 +30,6 @@
"$_src/effects/SkShaderMaskFilter.cpp",
"$_src/effects/SkTableColorFilter.cpp",
"$_src/effects/SkTableMaskFilter.cpp",
- "$_src/effects/SkToSRGBColorFilter.cpp",
"$_src/effects/SkTrimPathEffect.cpp",
"$_src/shaders/SkPerlinNoiseShader.cpp",
@@ -66,5 +65,4 @@
"$_include/effects/SkPerlinNoiseShader.h",
"$_include/effects/SkTableColorFilter.h",
"$_include/effects/SkTableMaskFilter.h",
- "$_include/effects/SkToSRGBColorFilter.h",
]
diff --git a/gn/flutter_defines.gni b/gn/flutter_defines.gni
index bd0b95d..dd19743 100644
--- a/gn/flutter_defines.gni
+++ b/gn/flutter_defines.gni
@@ -3,7 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
flutter_defines = [
- "SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION",
+ "SK_DISABLE_OPLIST_SORTING",
"SK_LEGACY_SKCODEC_NONE_ENUM",
# Flutter always wants this https://github.com/flutter/flutter/issues/11402
diff --git a/gn/gm.gni b/gn/gm.gni
index f2d7d2c..b821bd5 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -315,7 +315,6 @@
"$_gm/spritebitmap.cpp",
"$_gm/srcmode.cpp",
"$_gm/srgb.cpp",
- "$_gm/tosrgb_colorfilter.cpp",
"$_gm/stlouisarch.cpp",
"$_gm/stringart.cpp",
"$_gm/stroke_rect_shader.cpp",
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 942c400..8c98928 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -88,8 +88,6 @@
"$_src/gpu/GrDefaultGeoProcFactory.h",
"$_src/gpu/GrDeferredProxyUploader.h",
"$_src/gpu/GrDeferredUpload.h",
- "$_src/gpu/GrDeinstantiateProxyTracker.cpp",
- "$_src/gpu/GrDeinstantiateProxyTracker.h",
"$_src/gpu/GrDistanceFieldGenFromVector.cpp",
"$_src/gpu/GrDistanceFieldGenFromVector.h",
"$_src/gpu/GrDrawingManager.cpp",
diff --git a/gn/tests.gni b/gn/tests.gni
index bd7b9b7..2e25efe 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -261,7 +261,6 @@
"$_tests/SwizzlerTest.cpp",
"$_tests/TArrayTest.cpp",
"$_tests/TDPQueueTest.cpp",
- "$_tests/TableColorFilterTest.cpp",
"$_tests/TemplatesTest.cpp",
"$_tests/TessellatingPathRendererTests.cpp",
"$_tests/TextureBindingsResetTest.cpp",
@@ -276,7 +275,6 @@
"$_tests/Time.cpp",
"$_tests/TLazyTest.cpp",
"$_tests/TopoSortTest.cpp",
- "$_tests/ToSRGBColorFilter.cpp",
"$_tests/TraceMemoryDumpTest.cpp",
"$_tests/TracingTest.cpp",
"$_tests/TransferPixelsTest.cpp",
diff --git a/include/effects/SkToSRGBColorFilter.h b/include/effects/SkToSRGBColorFilter.h
deleted file mode 100644
index 9a51d0b..0000000
--- a/include/effects/SkToSRGBColorFilter.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkToSRGBColorFilter_DEFINED
-#define SkToSRGBColorFilter_DEFINED
-
-#include "SkFlattenable.h"
-#include "SkColorFilter.h"
-#include "SkRefCnt.h"
-
-class SkColorSpace;
-class SkRasterPipeline;
-
-/**
- * Color filter that converts from supplied color space to sRGB (both gamut and transfer function).
- */
-class SK_API SkToSRGBColorFilter : public SkColorFilter {
-public:
- static sk_sp<SkColorFilter> Make(sk_sp<SkColorSpace> srcColorSpace);
-
-#if SK_SUPPORT_GPU
- std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const override;
-#endif
-
-private:
- SK_FLATTENABLE_HOOKS(SkToSRGBColorFilter)
-
- void flatten(SkWriteBuffer&) const override;
- SkToSRGBColorFilter(sk_sp<SkColorSpace>);
- void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
- bool shaderIsOpaque) const override;
-
- sk_sp<SkColorSpace> fSrcColorSpace;
-
- typedef SkColorFilter INHERITED;
-};
-
-#endif
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index e12fd13..a73be43 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -145,15 +145,8 @@
Enable fUseDrawInsteadOfClear = Enable::kDefault;
/**
- * Allow Ganesh to explicitly allocate resources at flush time rather than incrementally while
- * drawing. This will eventually just be the way it is but, for now, it is optional.
- */
- Enable fExplicitlyAllocateGPUResources = Enable::kDefault;
-
- /**
* Allow Ganesh to sort the opLists prior to allocating resources. This is an optional
- * behavior that is only relevant when 'fExplicitlyAllocateGPUResources' is enabled.
- * Eventually this will just be what is done and will not be optional.
+ * behavior but, eventually, this will just be what is done and will not be optional.
*/
Enable fSortRenderTargets = Enable::kDefault;
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index e20ebb0..4a7935f 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -79,6 +79,7 @@
}
private:
+
void computeScratchKey(GrScratchKey*) const override;
size_t onGpuMemorySize() const override;
void markMipMapsDirty();
diff --git a/include/private/GrContext_Base.h b/include/private/GrContext_Base.h
index 141a6d5..c51bd8d 100644
--- a/include/private/GrContext_Base.h
+++ b/include/private/GrContext_Base.h
@@ -8,6 +8,16 @@
#ifndef GrContext_Base_DEFINED
#define GrContext_Base_DEFINED
+// Perform old-style (non-explicit) allocation in the Android Framework and on older
+// (non-Vulkan supporting) Android devices. The latter is to, at least, have some of
+// Skia's bots exercise the old allocation scheme.
+#if !defined(SK_OLD_STYLE_RESOURCE_ALLOCATION)
+ #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || \
+ (defined(SK_BUILD_FOR_ANDROID) && !defined(SK_VULKAN))
+ #define SK_OLD_STYLE_RESOURCE_ALLOCATION
+ #endif
+#endif
+
#include "SkRefCnt.h"
#include "GrContextOptions.h"
#include "GrTypes.h"
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index c9eec6c..7c572bb 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -208,8 +208,6 @@
enum class LazyInstantiationType {
kSingleUse, // Instantiation callback is allowed to be called only once.
kMultipleUse, // Instantiation callback can be called multiple times.
- kDeinstantiate, // Instantiation callback can be called multiple times,
- // but we will deinstantiate the proxy after every flush.
};
enum class LazyState {
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index 07ab292..db5b2f6 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -14,12 +14,12 @@
"deps": {
"depot_tools": {
"branch": "master",
- "revision": "24b5f9087ff65463761cdb064ffb564e76e273a2",
+ "revision": "77e5d48a085ee4fe7f6e10f5dcbb12fbc59eb4d2",
"url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
},
"recipe_engine": {
"branch": "master",
- "revision": "b2fd216f19285779af34b1d2df68b5ca9899ec1d",
+ "revision": "aef5bb3df38a8c316b2af0301be808e34c749583",
"url": "https://chromium.googlesource.com/infra/luci/recipes-py.git"
}
},
diff --git a/modules/pathkit/karma.bench.conf.js b/modules/pathkit/karma.bench.conf.js
index a2808a6..315903b 100644
--- a/modules/pathkit/karma.bench.conf.js
+++ b/modules/pathkit/karma.bench.conf.js
@@ -13,6 +13,7 @@
{ pattern: 'npm-wasm/bin/pathkit.wasm', included:false, served:true},
'perf/perfReporter.js',
'npm-wasm/bin/pathkit.js',
+ 'tests/pathkitinit.js',
'perf/*.bench.js'
],
@@ -38,8 +39,8 @@
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
- browserDisconnectTimeout: 10000,
- browserNoActivityTimeout: 10000,
+ browserDisconnectTimeout: 20000,
+ browserNoActivityTimeout: 20000,
// start these browsers
browsers: ['Chrome'],
@@ -74,6 +75,7 @@
{ pattern: 'npm-asmjs/bin/pathkit.js.mem', included:false, served:true},
'perf/perfReporter.js',
'npm-asmjs/bin/pathkit.js',
+ 'tests/pathkitinit.js',
'perf/*.bench.js'
];
diff --git a/modules/pathkit/karma.conf.js b/modules/pathkit/karma.conf.js
index 649d21d..47ff2d2 100644
--- a/modules/pathkit/karma.conf.js
+++ b/modules/pathkit/karma.conf.js
@@ -14,6 +14,7 @@
{ pattern: 'tests/*.json', included:false, served:true},
'tests/testReporter.js',
'npm-wasm/bin/test/pathkit.js',
+ 'tests/pathkitinit.js',
'tests/*.spec.js'
],
@@ -39,8 +40,8 @@
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
- browserDisconnectTimeout: 15000,
- browserNoActivityTimeout: 15000,
+ browserDisconnectTimeout: 20000,
+ browserNoActivityTimeout: 20000,
// start these browsers
browsers: ['Chrome'],
@@ -76,6 +77,7 @@
{ pattern: 'tests/*.json', included:false, served:true},
'tests/testReporter.js',
'npm-asmjs/bin/test/pathkit.js',
+ 'tests/pathkitinit.js',
'tests/*.spec.js'
];
diff --git a/modules/pathkit/perf/effects.bench.js b/modules/pathkit/perf/effects.bench.js
index cf73fd4..30d6e35 100644
--- a/modules/pathkit/perf/effects.bench.js
+++ b/modules/pathkit/perf/effects.bench.js
@@ -1,20 +1,4 @@
-
-
describe('PathKit\'s Effects', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
// see https://fiddle.skia.org/c/@discrete_path
function drawStar(X=128, Y=128, R=116) {
diff --git a/modules/pathkit/perf/path.bench.js b/modules/pathkit/perf/path.bench.js
index d8dc47e..01fd6f9 100644
--- a/modules/pathkit/perf/path.bench.js
+++ b/modules/pathkit/perf/path.bench.js
@@ -1,21 +1,4 @@
-
-
describe('PathKit\'s Path Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
function drawPath() {
let path = PathKit.NewPath();
path.moveTo(20, 5);
diff --git a/modules/pathkit/perf/pathops.bench.js b/modules/pathkit/perf/pathops.bench.js
index aa105a4..31d7e05 100644
--- a/modules/pathkit/perf/pathops.bench.js
+++ b/modules/pathkit/perf/pathops.bench.js
@@ -1,21 +1,4 @@
-
-
describe('PathKit\'s Pathops', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
// see https://fiddle.skia.org/c/@discrete_path
function drawStar(X=128, Y=128, R=116) {
let p = PathKit.NewPath();
diff --git a/modules/pathkit/perf/perfReporter.js b/modules/pathkit/perf/perfReporter.js
index d74110c..c60cfbc 100644
--- a/modules/pathkit/perf/perfReporter.js
+++ b/modules/pathkit/perf/perfReporter.js
@@ -3,47 +3,52 @@
// Typically used for debugging.
const fail_on_no_perf = false;
-
function benchmarkAndReport(benchName, setupFn, testFn, teardownFn) {
- let ctx = {};
- // warmup 3 times (arbitrary choice)
- setupFn(ctx);
- testFn(ctx);
- testFn(ctx);
- testFn(ctx);
- teardownFn(ctx);
-
- ctx = {};
- setupFn(ctx);
- let start = Date.now();
- let now = start;
- times = 0;
- // See how many times we can do it in 100ms (arbitrary choice)
- while (now - start < 100) {
+ try {
+ let ctx = {};
+ // warmup 3 times (arbitrary choice)
+ setupFn(ctx);
testFn(ctx);
- now = Date.now();
- times++;
- }
-
- teardownFn(ctx);
-
- // Try to make it go for 2 seconds (arbitrarily chosen)
- // Since the pre-try took 100ms, multiply by 20 to get
- // approximate tries in 2s
- let goalTimes = times * 20;
- setupFn(ctx);
- start = Date.now();
- times = 0;
- while (times < goalTimes) {
testFn(ctx);
- times++;
- }
- let end = Date.now();
- teardownFn(ctx);
+ testFn(ctx);
+ teardownFn(ctx);
- let us = (end - start) * 1000 / times;
- console.log(benchName, `${us} microseconds`)
- return _report(us, benchName);
+ ctx = {};
+ setupFn(ctx);
+ let start = Date.now();
+ let now = start;
+ times = 0;
+ // See how many times we can do it in 100ms (arbitrary choice)
+ while (now - start < 100) {
+ testFn(ctx);
+ now = Date.now();
+ times++;
+ }
+
+ teardownFn(ctx);
+
+ // Try to make it go for 2 seconds (arbitrarily chosen)
+ // Since the pre-try took 100ms, multiply by 20 to get
+ // approximate tries in 2s (unless now - start >> 100 ms)
+ let goalTimes = times * 20;
+ ctx = {};
+ setupFn(ctx);
+ times = 0;
+ start = Date.now();
+ while (times < goalTimes) {
+ testFn(ctx);
+ times++;
+ }
+ const end = Date.now();
+ teardownFn(ctx);
+
+ const us = (end - start) * 1000 / times;
+ console.log(benchName, `${us} microseconds`)
+ return _report(us, benchName);
+ } catch(e) {
+ console.error('caught error', e);
+ return Promise.reject(e);
+ }
}
diff --git a/modules/pathkit/tests/effects.spec.js b/modules/pathkit/tests/effects.spec.js
index 29cdbd5..575c95a 100644
--- a/modules/pathkit/tests/effects.spec.js
+++ b/modules/pathkit/tests/effects.spec.js
@@ -1,21 +1,5 @@
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
describe('PathKit\'s Path Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
// see https://fiddle.skia.org/c/@discrete_path
function drawStar() {
let path = PathKit.NewPath();
diff --git a/modules/pathkit/tests/path.spec.js b/modules/pathkit/tests/path.spec.js
index 80a779a..aa674ba 100644
--- a/modules/pathkit/tests/path.spec.js
+++ b/modules/pathkit/tests/path.spec.js
@@ -1,20 +1,4 @@
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
-
describe('PathKit\'s Path Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
describe('Basic Path Features', function() {
function drawSimplePath() {
diff --git a/modules/pathkit/tests/path2d.spec.js b/modules/pathkit/tests/path2d.spec.js
index 6c2b3ef..b60db85 100644
--- a/modules/pathkit/tests/path2d.spec.js
+++ b/modules/pathkit/tests/path2d.spec.js
@@ -1,21 +1,4 @@
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
-
describe('PathKit\'s Path2D API', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
it('can do everything in the Path2D API w/o crashing', function(done) {
LoadPathKit.then(catchException(done, () => {
// This is taken from example.html
diff --git a/modules/pathkit/tests/pathkitinit.js b/modules/pathkit/tests/pathkitinit.js
new file mode 100644
index 0000000..0fc9b71
--- /dev/null
+++ b/modules/pathkit/tests/pathkitinit.js
@@ -0,0 +1,16 @@
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
+
+let PathKit = null;
+const LoadPathKit = new Promise(function(resolve, reject) {
+ console.log('pathkit loading', new Date());
+ PathKitInit({
+ locateFile: (file) => '/pathkit/'+file,
+ }).ready().then((_PathKit) => {
+ console.log('pathkit loaded', new Date());
+ PathKit = _PathKit;
+ resolve();
+ }).catch((e) => {
+ console.error('pathkit failed to load', new Date(), e);
+ reject();
+ });
+});
\ No newline at end of file
diff --git a/modules/pathkit/tests/pathops.spec.js b/modules/pathkit/tests/pathops.spec.js
index 720bd8c..089f9bc 100644
--- a/modules/pathkit/tests/pathops.spec.js
+++ b/modules/pathkit/tests/pathops.spec.js
@@ -1,5 +1,3 @@
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
-
var dumpErrors = false;
var container;
@@ -74,36 +72,27 @@
}
describe('PathKit\'s PathOps Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
var PATHOP_MAP = {};
var FILLTYPE_MAP = {};
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- PATHOP_MAP = {
- 'kIntersect_SkPathOp': PathKit.PathOp.INTERSECT,
- 'kDifference_SkPathOp': PathKit.PathOp.DIFFERENCE,
- 'kUnion_SkPathOp': PathKit.PathOp.UNION,
- 'kXOR_SkPathOp': PathKit.PathOp.XOR,
- 'kXOR_PathOp': PathKit.PathOp.XOR,
- 'kReverseDifference_SkPathOp': PathKit.PathOp.REVERSE_DIFFERENCE,
- };
- FILLTYPE_MAP = {
- 'kWinding_FillType': PathKit.FillType.WINDING,
- 'kEvenOdd_FillType': PathKit.FillType.EVENODD,
- 'kInverseWinding_FillType': PathKit.FillType.INVERSE_WINDING,
- 'kInverseEvenOdd_FillType': PathKit.FillType.INVERSE_EVENODD,
- };
- resolve();
- });
+
+ function init() {
+ if (PathKit && !PATHOP_MAP['kIntersect_SkPathOp']) {
+ PATHOP_MAP = {
+ 'kIntersect_SkPathOp': PathKit.PathOp.INTERSECT,
+ 'kDifference_SkPathOp': PathKit.PathOp.DIFFERENCE,
+ 'kUnion_SkPathOp': PathKit.PathOp.UNION,
+ 'kXOR_SkPathOp': PathKit.PathOp.XOR,
+ 'kXOR_PathOp': PathKit.PathOp.XOR,
+ 'kReverseDifference_SkPathOp': PathKit.PathOp.REVERSE_DIFFERENCE,
+ };
+ FILLTYPE_MAP = {
+ 'kWinding_FillType': PathKit.FillType.WINDING,
+ 'kEvenOdd_FillType': PathKit.FillType.EVENODD,
+ 'kInverseWinding_FillType': PathKit.FillType.INVERSE_WINDING,
+ 'kInverseEvenOdd_FillType': PathKit.FillType.INVERSE_EVENODD,
+ };
}
- });
+ }
function getFillType(str) {
let e = FILLTYPE_MAP[str];
@@ -119,6 +108,7 @@
it('combines two paths with .op() and matches what we see from C++', function(done) {
LoadPathKit.then(catchException(done, () => {
+ init();
// Test JSON created with:
// ./out/Clang/pathops_unittest -J ./modules/pathkit/tests/PathOpsOp.json -m PathOpsOp$
fetch('/base/tests/PathOpsOp.json').then((r) => {
@@ -177,6 +167,7 @@
it('simplifies a path with .simplify() and matches what we see from C++', function(done) {
LoadPathKit.then(catchException(done, () => {
+ init();
// Test JSON created with:
// ./out/Clang/pathops_unittest -J ./modules/pathkit/tests/PathOpsSimplify.json -m PathOpsSimplify$
fetch('/base/tests/PathOpsSimplify.json').then((r) => {
diff --git a/modules/pathkit/tests/svg.spec.js b/modules/pathkit/tests/svg.spec.js
index 02cfa4e..f1d75dd 100644
--- a/modules/pathkit/tests/svg.spec.js
+++ b/modules/pathkit/tests/svg.spec.js
@@ -1,20 +1,4 @@
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
describe('PathKit\'s SVG Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
it('can create a path from an SVG string', function(done) {
LoadPathKit.then(catchException(done, () => {
//.This is a parallelagram from
diff --git a/modules/pathkit/tests/util.spec.js b/modules/pathkit/tests/util.spec.js
index ed65dc5..3e7f5c9 100644
--- a/modules/pathkit/tests/util.spec.js
+++ b/modules/pathkit/tests/util.spec.js
@@ -1,21 +1,5 @@
// Tests for util-related things
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
describe('PathKit\'s CubicMap Behavior', function() {
- // Note, don't try to print the PathKit object - it can cause Karma/Jasmine to lock up.
- var PathKit = null;
- const LoadPathKit = new Promise(function(resolve, reject) {
- if (PathKit) {
- resolve();
- } else {
- PathKitInit({
- locateFile: (file) => '/pathkit/'+file,
- }).ready().then((_PathKit) => {
- PathKit = _PathKit;
- resolve();
- });
- }
- });
-
it('computes YFromX correctly', function(done) {
LoadPathKit.then(catchException(done, () => {
// Spot check a few points
diff --git a/src/effects/SkToSRGBColorFilter.cpp b/src/effects/SkToSRGBColorFilter.cpp
deleted file mode 100644
index 1b98db7..0000000
--- a/src/effects/SkToSRGBColorFilter.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorSpacePriv.h"
-#include "SkColorSpaceXformSteps.h"
-#include "SkRasterPipeline.h"
-#include "SkReadBuffer.h"
-#include "SkString.h"
-#include "SkToSRGBColorFilter.h"
-#include "SkWriteBuffer.h"
-
-#if SK_SUPPORT_GPU
- #include "GrColorSpaceXform.h"
-#endif
-
-void SkToSRGBColorFilter::onAppendStages(SkRasterPipeline* p,
- SkColorSpace* /*dst color space*/,
- SkArenaAlloc* alloc,
- bool shaderIsOpaque) const {
- bool shaderIsNormalized = false;
- alloc->make<SkColorSpaceXformSteps>(fSrcColorSpace.get(), kPremul_SkAlphaType,
- sk_srgb_singleton() , kPremul_SkAlphaType)
- ->apply(p, shaderIsNormalized);
-}
-
-sk_sp<SkColorFilter> SkToSRGBColorFilter::Make(sk_sp<SkColorSpace> srcColorSpace) {
- if (!srcColorSpace || srcColorSpace->isSRGB()) {
- return nullptr;
- } else {
- return sk_sp<SkColorFilter>(new SkToSRGBColorFilter(std::move(srcColorSpace)));
- }
-}
-
-SkToSRGBColorFilter::SkToSRGBColorFilter(sk_sp<SkColorSpace> srcColorSpace)
- : fSrcColorSpace(std::move(srcColorSpace)) {
- SkASSERT(fSrcColorSpace);
-}
-
-sk_sp<SkFlattenable> SkToSRGBColorFilter::CreateProc(SkReadBuffer& buffer) {
- auto data = buffer.readByteArrayAsData();
- return data ? Make(SkColorSpace::Deserialize(data->data(), data->size())) : nullptr;
-}
-
-void SkToSRGBColorFilter::flatten(SkWriteBuffer& buffer) const {
- buffer.writeDataAsByteArray(fSrcColorSpace->serialize().get());
-}
-
-#if SK_SUPPORT_GPU
-std::unique_ptr<GrFragmentProcessor> SkToSRGBColorFilter::asFragmentProcessor(
- GrRecordingContext*, const GrColorSpaceInfo&) const {
- return GrColorSpaceXformEffect::Make(fSrcColorSpace.get(), kPremul_SkAlphaType,
- sk_srgb_singleton(), kPremul_SkAlphaType);
-}
-#endif
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 1bba019..e184e8e 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -42,7 +42,7 @@
// Attach our texture to this context's resource cache. This ensures that deletion will happen
// in the correct thread/context. This adds the only ref to the texture that will persist from
// this point. That ref will be released when the generator's RefHelper is freed.
- context->priv().getResourceCache()->insertDelayedResourceUnref(texture.get());
+ context->priv().getResourceCache()->insertCrossContextGpuResource(texture.get());
GrBackendTexture backendTexture = texture->getBackendTexture();
GrBackendFormat backendFormat = backendTexture.getBackendFormat();
diff --git a/src/gpu/GrContext_Base.cpp b/src/gpu/GrContext_Base.cpp
index 7c45267..3d194a0 100644
--- a/src/gpu/GrContext_Base.cpp
+++ b/src/gpu/GrContext_Base.cpp
@@ -11,12 +11,6 @@
#include "GrCaps.h"
#include "GrSkSLFPFactoryCache.h"
-#ifdef SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
-static const bool kDefaultExplicitlyAllocateGPUResources = false;
-#else
-static const bool kDefaultExplicitlyAllocateGPUResources = true;
-#endif
-
static int32_t next_id() {
static std::atomic<int32_t> nextID{1};
int32_t id;
@@ -45,15 +39,11 @@
}
bool GrContext_Base::explicitlyAllocateGPUResources() const {
- if (GrContextOptions::Enable::kNo == fOptions.fExplicitlyAllocateGPUResources) {
- return false;
- }
-
- if (GrContextOptions::Enable::kYes == fOptions.fExplicitlyAllocateGPUResources) {
- return true;
- }
-
- return kDefaultExplicitlyAllocateGPUResources;
+#ifdef SK_OLD_STYLE_RESOURCE_ALLOCATION
+ return false;
+#else
+ return true;
+#endif
}
const GrCaps* GrContext_Base::caps() const { return fCaps.get(); }
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index cfe81a1..6836e46 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -53,8 +53,7 @@
}
// DDL contexts/drawing managers always sort the oplists. This, in turn, implies that
- // explicit resource allocation is always on (regardless of whatever the client specified
- // in their context options).
+ // explicit resource allocation is always on (regardless of how Skia is compiled).
this->setupDrawingManager(true, true);
SkASSERT(this->caps());
diff --git a/src/gpu/GrDeinstantiateProxyTracker.cpp b/src/gpu/GrDeinstantiateProxyTracker.cpp
deleted file mode 100644
index 9870617..0000000
--- a/src/gpu/GrDeinstantiateProxyTracker.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrDeinstantiateProxyTracker.h"
-
-#include "GrSurfaceProxy.h"
-#include "GrSurfaceProxyPriv.h"
-
-void GrDeinstantiateProxyTracker::addProxy(GrSurfaceProxy* proxy) {
-#ifdef SK_DEBUG
- using LazyType = GrSurfaceProxy::LazyInstantiationType;
- SkASSERT(LazyType::kDeinstantiate == proxy->priv().lazyInstantiationType());
- for (int i = 0; i < fProxies.count(); ++i) {
- SkASSERT(proxy != fProxies[i].get());
- }
-#endif
- fProxies.push_back(sk_ref_sp(proxy));
-}
-
-void GrDeinstantiateProxyTracker::deinstantiateAllProxies() {
- for (int i = 0; i < fProxies.count(); ++i) {
- GrSurfaceProxy* proxy = fProxies[i].get();
- SkASSERT(proxy->priv().isSafeToDeinstantiate());
- proxy->deinstantiate();
- }
-
- fProxies.reset();
-}
diff --git a/src/gpu/GrDeinstantiateProxyTracker.h b/src/gpu/GrDeinstantiateProxyTracker.h
deleted file mode 100644
index 2555ab1..0000000
--- a/src/gpu/GrDeinstantiateProxyTracker.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrDeinstantiateProxyTracker_DEFINED
-#define GrDeinstantiateProxyTracker_DEFINED
-
-#include "GrSurfaceProxy.h"
-#include "SkTArray.h"
-
-class GrDeinstantiateProxyTracker {
-public:
- GrDeinstantiateProxyTracker() {}
-
- // Adds a proxy which will be deinstantiated at the end of flush. The same proxy may not be
- // added multiple times.
- void addProxy(GrSurfaceProxy* proxy);
-
- // Loops through all tracked proxies and deinstantiates them.
- void deinstantiateAllProxies();
-
-private:
- SkTArray<sk_sp<GrSurfaceProxy>> fProxies;
-};
-
-#endif
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 10da8f9..b6d45ff 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -285,7 +285,7 @@
bool flushed = false;
{
- GrResourceAllocator alloc(resourceProvider, flushState.deinstantiateProxyTracker());
+ GrResourceAllocator alloc(resourceProvider);
for (int i = 0; i < fDAG.numOpLists(); ++i) {
if (fDAG.opList(i)) {
fDAG.opList(i)->gatherProxyIntervals(&alloc);
@@ -336,20 +336,13 @@
GrSemaphoresSubmitted result = gpu->finishFlush(proxy, access, flags, numSemaphores,
backendSemaphores);
- flushState.deinstantiateProxyTracker()->deinstantiateAllProxies();
-
// Give the cache a chance to purge resources that become purgeable due to flushing.
if (flushed) {
resourceCache->purgeAsNeeded();
- flushed = false;
}
for (GrOnFlushCallbackObject* onFlushCBObject : fOnFlushCBObjects) {
onFlushCBObject->postFlush(fTokenTracker.nextTokenToFlush(), fFlushingOpListIDs.begin(),
fFlushingOpListIDs.count());
- flushed = true;
- }
- if (flushed) {
- resourceCache->purgeAsNeeded();
}
fFlushingOpListIDs.reset();
fFlushing = false;
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index 75fb6e1..d5bce1b 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -24,6 +24,12 @@
#include "vk/GrVkGpu.h"
#endif
+#ifdef SK_DISABLE_OPLIST_SORTING
+static const bool kDefaultSortOpLists = false;
+#else
+static const bool kDefaultSortOpLists = true;
+#endif
+
class SK_API GrLegacyDirectContext : public GrContext {
public:
GrLegacyDirectContext(GrBackendApi backend, const GrContextOptions& options)
@@ -73,7 +79,7 @@
return false;
}
- bool sortOpLists = this->explicitlyAllocateGPUResources();
+ bool sortOpLists = kDefaultSortOpLists;
if (GrContextOptions::Enable::kNo == this->options().fSortRenderTargets) {
sortOpLists = false;
} else if (GrContextOptions::Enable::kYes == this->options().fSortRenderTargets) {
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 07983d4..bc10920 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -12,7 +12,6 @@
#include "GrAppliedClip.h"
#include "GrBufferAllocPool.h"
#include "GrDeferredUpload.h"
-#include "GrDeinstantiateProxyTracker.h"
#include "GrRenderTargetProxy.h"
#include "SkArenaAlloc.h"
#include "SkArenaAllocList.h"
@@ -109,8 +108,6 @@
// permissible).
GrAtlasManager* atlasManager() const final;
- GrDeinstantiateProxyTracker* deinstantiateProxyTracker() { return &fDeinstantiateProxyTracker; }
-
private:
/** GrMeshDrawOp::Target override. */
SkArenaAlloc* allocator() override { return &fArena; }
@@ -164,9 +161,6 @@
// Variables that are used to track where we are in lists as ops are executed
SkArenaAllocList<Draw>::Iter fCurrDraw;
SkArenaAllocList<InlineUpload>::Iter fCurrUpload;
-
- // Used to track the proxies that need to be deinstantiated after we finish a flush
- GrDeinstantiateProxyTracker fDeinstantiateProxyTracker;
};
#endif
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index 0d3c34e..81c2709 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -7,7 +7,6 @@
#include "GrResourceAllocator.h"
-#include "GrDeinstantiateProxyTracker.h"
#include "GrGpuResourcePriv.h"
#include "GrOpList.h"
#include "GrRenderTargetProxy.h"
@@ -107,12 +106,7 @@
if (proxy->readOnly() || !fResourceProvider->explicitlyAllocateGPUResources()) {
// FIXME: remove this once we can do the lazy instantiation from assign instead.
if (GrSurfaceProxy::LazyState::kNot != proxy->lazyInstantiationState()) {
- if (proxy->priv().doLazyInstantiation(fResourceProvider)) {
- if (proxy->priv().lazyInstantiationType() ==
- GrSurfaceProxy::LazyInstantiationType::kDeinstantiate) {
- fDeinstantiateTracker->addProxy(proxy);
- }
- }
+ proxy->priv().doLazyInstantiation(fResourceProvider);
}
}
}
@@ -375,11 +369,6 @@
if (GrSurfaceProxy::LazyState::kNot != cur->proxy()->lazyInstantiationState()) {
if (!cur->proxy()->priv().doLazyInstantiation(fResourceProvider)) {
*outError = AssignError::kFailedProxyInstantiation;
- } else {
- if (GrSurfaceProxy::LazyInstantiationType::kDeinstantiate ==
- cur->proxy()->priv().lazyInstantiationType()) {
- fDeinstantiateTracker->addProxy(cur->proxy());
- }
}
} else if (sk_sp<GrSurface> surface = this->findSurfaceFor(cur->proxy(), needsStencil)) {
// TODO: make getUniqueKey virtual on GrSurfaceProxy
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index ea1250f..cb366e6 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -16,7 +16,6 @@
#include "SkTDynamicHash.h"
#include "SkTMultiMap.h"
-class GrDeinstantiateProxyTracker;
class GrResourceProvider;
// Print out explicit allocation information
@@ -42,8 +41,8 @@
*/
class GrResourceAllocator {
public:
- GrResourceAllocator(GrResourceProvider* resourceProvider, GrDeinstantiateProxyTracker* tracker)
- : fResourceProvider(resourceProvider), fDeinstantiateTracker(tracker) {}
+ GrResourceAllocator(GrResourceProvider* resourceProvider)
+ : fResourceProvider(resourceProvider) {}
~GrResourceAllocator();
@@ -212,7 +211,6 @@
static const int kInitialArenaSize = 128 * sizeof(Interval);
GrResourceProvider* fResourceProvider;
- GrDeinstantiateProxyTracker* fDeinstantiateTracker;
FreePoolMultiMap fFreePool; // Recently created/used GrSurfaces
IntvlHash fIntvlHash; // All the intervals, hashed by proxyID
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index c36634c..9b17d92 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -14,7 +14,6 @@
#include "GrTexture.h"
#include "GrTextureProxyCacheAccess.h"
#include "GrTracing.h"
-#include "SkExchange.h"
#include "SkGr.h"
#include "SkMessageBus.h"
#include "SkOpts.h"
@@ -68,44 +67,7 @@
GrResourceCache* fCache;
};
-//////////////////////////////////////////////////////////////////////////////
-
-inline GrResourceCache::ResourceAwaitingUnref::ResourceAwaitingUnref() = default;
-
-inline GrResourceCache::ResourceAwaitingUnref::ResourceAwaitingUnref(GrGpuResource* resource)
- : fResource(resource), fNumUnrefs(1) {}
-
-inline GrResourceCache::ResourceAwaitingUnref::ResourceAwaitingUnref(ResourceAwaitingUnref&& that) {
- fResource = skstd::exchange(that.fResource, nullptr);
- fNumUnrefs = skstd::exchange(that.fNumUnrefs, 0);
-}
-
-inline GrResourceCache::ResourceAwaitingUnref& GrResourceCache::ResourceAwaitingUnref::operator=(
- ResourceAwaitingUnref&& that) {
- fResource = skstd::exchange(that.fResource, nullptr);
- fNumUnrefs = skstd::exchange(that.fNumUnrefs, 0);
- return *this;
-}
-
-inline GrResourceCache::ResourceAwaitingUnref::~ResourceAwaitingUnref() {
- if (fResource) {
- for (int i = 0; i < fNumUnrefs; ++i) {
- fResource->unref();
- }
- }
-}
-
-inline void GrResourceCache::ResourceAwaitingUnref::addRef() { ++fNumUnrefs; }
-
-inline void GrResourceCache::ResourceAwaitingUnref::unref() {
- SkASSERT(fNumUnrefs > 0);
- fResource->unref();
- --fNumUnrefs;
-}
-
-inline bool GrResourceCache::ResourceAwaitingUnref::finished() { return !fNumUnrefs; }
-
-//////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////
GrResourceCache::GrResourceCache(const GrCaps* caps, GrSingleOwner* singleOwner,
uint32_t contextUniqueID)
@@ -217,9 +179,10 @@
void GrResourceCache::abandonAll() {
AutoValidate av(this);
- // We need to make sure to free any resources that were waiting on a free message but never
- // received one.
- fResourcesAwaitingUnref.reset();
+ for (int i = 0; i < fResourcesWaitingForFreeMsg.count(); ++i) {
+ fResourcesWaitingForFreeMsg[i]->cacheAccess().abandon();
+ }
+ fResourcesWaitingForFreeMsg.reset();
while (fNonpurgeableResources.count()) {
GrGpuResource* back = *(fNonpurgeableResources.end() - 1);
@@ -241,7 +204,7 @@
SkASSERT(!fBudgetedCount);
SkASSERT(!fBudgetedBytes);
SkASSERT(!fPurgeableBytes);
- SkASSERT(!fResourcesAwaitingUnref.count());
+ SkASSERT(!fResourcesWaitingForFreeMsg.count());
}
void GrResourceCache::releaseAll() {
@@ -251,7 +214,10 @@
// We need to make sure to free any resources that were waiting on a free message but never
// received one.
- fResourcesAwaitingUnref.reset();
+ for (int i = 0; i < fResourcesWaitingForFreeMsg.count(); ++i) {
+ fResourcesWaitingForFreeMsg[i]->unref();
+ }
+ fResourcesWaitingForFreeMsg.reset();
SkASSERT(fProxyProvider); // better have called setProxyProvider
// We must remove the uniqueKeys from the proxies here. While they possess a uniqueKey
@@ -278,7 +244,7 @@
SkASSERT(!fBudgetedCount);
SkASSERT(!fBudgetedBytes);
SkASSERT(!fPurgeableBytes);
- SkASSERT(!fResourcesAwaitingUnref.count());
+ SkASSERT(!fResourcesWaitingForFreeMsg.count());
}
class GrResourceCache::AvailableForScratchUse {
@@ -639,14 +605,10 @@
}
}
-void GrResourceCache::insertDelayedResourceUnref(GrGpuResource* resource) {
+void GrResourceCache::insertCrossContextGpuResource(GrGpuResource* resource) {
resource->ref();
- uint32_t id = resource->uniqueID().asUInt();
- if (auto* data = fResourcesAwaitingUnref.find(id)) {
- data->addRef();
- } else {
- fResourcesAwaitingUnref.set(id, {resource});
- }
+ SkASSERT(!fResourcesWaitingForFreeMsg.contains(resource));
+ fResourcesWaitingForFreeMsg.push_back(resource);
}
void GrResourceCache::processFreedGpuResources() {
@@ -654,17 +616,14 @@
fFreedGpuResourceInbox.poll(&msgs);
for (int i = 0; i < msgs.count(); ++i) {
SkASSERT(msgs[i].fOwningUniqueID == fContextUniqueID);
- uint32_t id = msgs[i].fResource->uniqueID().asUInt();
- ResourceAwaitingUnref* info = fResourcesAwaitingUnref.find(id);
+ int index = fResourcesWaitingForFreeMsg.find(msgs[i].fResource);
// If we called release or abandon on the GrContext we will have already released our ref on
// the GrGpuResource. If then the message arrives before the actual GrContext gets destroyed
// we will try to process the message when we destroy the GrContext. This protects us from
// trying to unref the resource twice.
- if (info) {
- info->unref();
- if (info->finished()) {
- fResourcesAwaitingUnref.remove(id);
- }
+ if (index != -1) {
+ fResourcesWaitingForFreeMsg.removeShuffle(index);
+ msgs[i].fResource->unref();
}
}
}
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index 84378e6..c948864 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -16,7 +16,6 @@
#include "SkRefCnt.h"
#include "SkTArray.h"
#include "SkTDPQueue.h"
-#include "SkTHash.h"
#include "SkTInternalLList.h"
#include "SkTMultiMap.h"
@@ -196,7 +195,7 @@
bool requestsFlush() const { return this->overBudget() && !fPurgeableQueue.count(); }
/** Maintain a ref to this resource until we receive a GrGpuResourceFreedMessage. */
- void insertDelayedResourceUnref(GrGpuResource* resource);
+ void insertCrossContextGpuResource(GrGpuResource* resource);
#if GR_CACHE_STATS
struct Stats {
@@ -306,25 +305,6 @@
};
typedef SkTDynamicHash<GrGpuResource, GrUniqueKey, UniqueHashTraits> UniqueHash;
- class ResourceAwaitingUnref {
- public:
- ResourceAwaitingUnref();
- ResourceAwaitingUnref(GrGpuResource* resource);
- ResourceAwaitingUnref(const ResourceAwaitingUnref&) = delete;
- ResourceAwaitingUnref& operator=(const ResourceAwaitingUnref&) = delete;
- ResourceAwaitingUnref(ResourceAwaitingUnref&&);
- ResourceAwaitingUnref& operator=(ResourceAwaitingUnref&&);
- ~ResourceAwaitingUnref();
- void addRef();
- void unref();
- bool finished();
-
- private:
- GrGpuResource* fResource = nullptr;
- int fNumUnrefs = 0;
- };
- using ReourcesAwaitingUnref = SkTHashMap<uint32_t, ResourceAwaitingUnref>;
-
static bool CompareTimestamp(GrGpuResource* const& a, GrGpuResource* const& b) {
return a->cacheAccess().timestamp() < b->cacheAccess().timestamp();
}
@@ -373,7 +353,8 @@
InvalidUniqueKeyInbox fInvalidUniqueKeyInbox;
FreedGpuResourceInbox fFreedGpuResourceInbox;
- ReourcesAwaitingUnref fResourcesAwaitingUnref;
+
+ SkTDArray<GrGpuResource*> fResourcesWaitingForFreeMsg;
uint32_t fContextUniqueID;
GrSingleOwner* fSingleOwner;
diff --git a/src/gpu/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index 3b383a5..8fe7f83 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -60,11 +60,6 @@
return fProxy->fLazyInstantiationType;
}
- bool isSafeToDeinstantiate() const {
- return SkToBool(fProxy->fTarget) && SkToBool(fProxy->fLazyInstantiateCallback) &&
- GrSurfaceProxy::LazyInstantiationType::kDeinstantiate == lazyInstantiationType();
- }
-
static bool SK_WARN_UNUSED_RESULT AttachStencilIfNeeded(GrResourceProvider*, GrSurface*,
bool needsStencil);
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 908be47..ec2e651 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -445,23 +445,12 @@
~PromiseLazyInstantiateCallback() {
if (fIdleCallback) {
- SkASSERT(!fTexture);
// We were never fulfilled. Pass false so done proc is still called.
fIdleCallback->abandon();
}
- // Our destructor can run on any thread. We trigger the unref of fTexture by message.
- if (fTexture) {
- SkASSERT(!fIdleCallback);
- SkMessageBus<GrGpuResourceFreedMessage>::Post({fTexture, fTextureContextID});
- }
}
sk_sp<GrSurface> operator()(GrResourceProvider* resourceProvider) {
- // Our proxy is getting instantiated for the second+ time. We are only allowed to call
- // Fulfill once. So return our cached result.
- if (fTexture) {
- return sk_ref_sp(fTexture);
- }
SkASSERT(fIdleCallback);
PromiseImageTextureContext textureContext = fIdleCallback->context();
sk_sp<SkPromiseImageTexture> promiseTexture = fFulfillProc(textureContext);
@@ -506,20 +495,10 @@
}
tex->addIdleProc(std::move(fIdleCallback));
promiseTexture->addKeyToInvalidate(tex->getContext()->priv().contextID(), key);
- fTexture = tex.get();
- // We need to hold on to the GrTexture in case our proxy gets reinstantiated. However,
- // we can't unref in our destructor because we may be on another thread then. So we
- // let the cache know it is waiting on an unref message. We will send that message from
- // our destructor.
- GrContext* context = fTexture->getContext();
- context->priv().getResourceCache()->insertDelayedResourceUnref(fTexture);
- fTextureContextID = context->priv().contextID();
return std::move(tex);
}
private:
- GrTexture* fTexture = nullptr;
- uint32_t fTextureContextID = SK_InvalidUniqueID;
sk_sp<GrRefCntedCallback> fIdleCallback;
PromiseImageTextureFulfillProc fFulfillProc;
GrPixelConfig fConfig;
@@ -536,5 +515,5 @@
return proxyProvider->createLazyProxy(std::move(callback), backendFormat, desc, origin,
mipMapped, GrInternalSurfaceFlags::kReadOnly,
SkBackingFit::kExact, SkBudgeted::kNo,
- GrSurfaceProxy::LazyInstantiationType::kDeinstantiate);
+ GrSurfaceProxy::LazyInstantiationType::kSingleUse);
}
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index 7241468..87e8704 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -45,7 +45,6 @@
#include "SkShaderBase.h"
#include "SkShaderMaskFilter.h"
#include "SkTableColorFilter.h"
- #include "SkToSRGBColorFilter.h"
#include "SkAlphaThresholdFilter.h"
#include "SkBlurImageFilter.h"
@@ -91,7 +90,6 @@
// Color filters.
SK_REGISTER_FLATTENABLE(SkColorMatrixFilterRowMajor255);
SK_REGISTER_FLATTENABLE(SkLumaColorFilter);
- SK_REGISTER_FLATTENABLE(SkToSRGBColorFilter);
SkColorFilter::RegisterFlattenables();
SkHighContrastFilter::RegisterFlattenables();
SkOverdrawColorFilter::RegisterFlattenables();
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 375d34c..ce12da6 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -488,28 +488,6 @@
// Now that the draw is fully consumed by the GPU, the texture should be idle.
REPORTER_ASSERT(reporter, idleIDs.find(2) != idleIDs.end());
- // Make a proxy that should deinstantiate even if we keep a ref on it.
- auto deinstantiateLazyCB = [&make, &context](GrResourceProvider* rp) {
- return make(context, 3);
- };
- proxy = context->priv().proxyProvider()->createLazyProxy(
- deinstantiateLazyCB, backendFormat, desc,
- GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
- GrInternalSurfaceFlags ::kNone, SkBackingFit::kExact, budgeted,
- GrSurfaceProxy::LazyInstantiationType::kDeinstantiate);
- rtc->drawTexture(GrNoClip(), std::move(proxy), GrSamplerState::Filter::kNearest,
- SkBlendMode::kSrcOver, SkPMColor4f(), SkRect::MakeWH(w, h),
- SkRect::MakeWH(w, h), GrAA::kNo, GrQuadAAFlags::kNone,
- SkCanvas::kFast_SrcRectConstraint, SkMatrix::I(), nullptr);
- // At this point the proxy shouldn't even be instantiated, there is no texture with
- // id 3.
- REPORTER_ASSERT(reporter, idleIDs.find(3) == idleIDs.end());
- context->flush();
- context->priv().getGpu()->testingOnly_flushGpuAndSync();
- // Now that the draw is fully consumed, we should have deinstantiated the proxy and
- // the texture it made should be idle.
- REPORTER_ASSERT(reporter, idleIDs.find(3) != idleIDs.end());
-
// Make sure we make the call during various shutdown scenarios where the texture
// might persist after context is destroyed, abandoned, etc. We test three
// variations of each scenario. One where the texture is just created. Another,
@@ -523,7 +501,7 @@
if (api == GrBackendApi::kVulkan) {
continue;
}
- int id = 4;
+ int id = 3;
enum class DrawType {
kNoDraw,
kDraw,
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 91f7335..f3b90e9 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -249,9 +249,8 @@
using LazyInstantiationType = GrSurfaceProxy::LazyInstantiationType;
for (bool doInstantiate : {true, false}) {
- for (auto lazyType : {LazyInstantiationType::kSingleUse,
- LazyInstantiationType::kMultipleUse,
- LazyInstantiationType::kDeinstantiate}) {
+ for (auto lazyType :
+ {LazyInstantiationType::kSingleUse, LazyInstantiationType::kMultipleUse}) {
int testCount = 0;
// Sets an integer to 1 when the callback is called and -1 when it is deleted.
class TestCallback {
@@ -455,7 +454,7 @@
ctx->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
using LazyType = GrSurfaceProxy::LazyInstantiationType;
- for (auto lazyType : {LazyType::kSingleUse, LazyType::kMultipleUse, LazyType::kDeinstantiate}) {
+ for (auto lazyType : {LazyType::kSingleUse, LazyType::kMultipleUse}) {
sk_sp<GrRenderTargetContext> rtc = ctx->priv().makeDeferredRenderTargetContext(
format, SkBackingFit::kExact, 100, 100,
kRGBA_8888_GrPixelConfig, nullptr);
@@ -498,11 +497,7 @@
ctx->flush();
REPORTER_ASSERT(reporter, 1 == instantiateTestValue);
- if (LazyType::kDeinstantiate == lazyType) {
- REPORTER_ASSERT(reporter, 1 == releaseTestValue);
- } else {
- REPORTER_ASSERT(reporter, 0 == releaseTestValue);
- }
+ REPORTER_ASSERT(reporter, 0 == releaseTestValue);
// This should cause the uninstantiate proxies to be instantiated again but have no effect
// on the others
@@ -511,20 +506,11 @@
rtc->priv().testingOnly_addDrawOp(LazyDeinstantiateTestOp::Make(ctx.get(), lazyProxy));
ctx->flush();
- if (LazyType::kDeinstantiate == lazyType) {
- REPORTER_ASSERT(reporter, 2 == instantiateTestValue);
- REPORTER_ASSERT(reporter, 2 == releaseTestValue);
- } else {
- REPORTER_ASSERT(reporter, 1 == instantiateTestValue);
- REPORTER_ASSERT(reporter, 0 == releaseTestValue);
- }
+ REPORTER_ASSERT(reporter, 1 == instantiateTestValue);
+ REPORTER_ASSERT(reporter, 0 == releaseTestValue);
lazyProxy.reset();
- if (LazyType::kDeinstantiate == lazyType) {
- REPORTER_ASSERT(reporter, 2 == releaseTestValue);
- } else {
- REPORTER_ASSERT(reporter, 1 == releaseTestValue);
- }
+ REPORTER_ASSERT(reporter, 1 == releaseTestValue);
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp
index 789cb24..93a09ca 100644
--- a/tests/PromiseImageTest.cpp
+++ b/tests/PromiseImageTest.cpp
@@ -331,13 +331,6 @@
auto surf = ctx->priv().resourceProvider()->findByUniqueKey<GrSurface>(key);
REPORTER_ASSERT(reporter, !surf);
}
-
- // Must do this to ensure all callbacks occur before the PromiseImageChecker goes out of scope.
- alphaImg.reset();
- grayImg.reset();
- ctx->flush();
- ctx->priv().getGpu()->testingOnly_flushGpuAndSync();
-
gpu->deleteTestingOnlyBackendTexture(backendTex1);
}
@@ -468,10 +461,7 @@
surface->flush();
canvas->drawImage(image, 5, 0);
surface->flush();
- // Must call these to ensure that all callbacks are performed before the checker is destroyed.
- image.reset();
- ctx->flush();
+ // Must call this to ensure that all callbacks are performed before the checker is destroyed.
gpu->testingOnly_flushGpuAndSync();
-
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index a71221d..69118fc 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -10,7 +10,6 @@
#include "Test.h"
#include "GrContextPriv.h"
-#include "GrDeinstantiateProxyTracker.h"
#include "GrGpu.h"
#include "GrProxyProvider.h"
#include "GrResourceAllocator.h"
@@ -90,8 +89,7 @@
// assigned different GrSurfaces.
static void overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider,
GrSurfaceProxy* p1, GrSurfaceProxy* p2, bool expectedResult) {
- GrDeinstantiateProxyTracker deinstantiateTracker;
- GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
+ GrResourceAllocator alloc(resourceProvider);
alloc.addInterval(p1, 0, 4);
alloc.addInterval(p2, 1, 2);
@@ -113,8 +111,7 @@
static void non_overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider,
GrSurfaceProxy* p1, GrSurfaceProxy* p2,
bool expectedResult) {
- GrDeinstantiateProxyTracker deinstantiateTracker;
- GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
+ GrResourceAllocator alloc(resourceProvider);
alloc.addInterval(p1, 0, 2);
alloc.addInterval(p2, 3, 5);
@@ -288,7 +285,7 @@
}
sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrCaps* caps,
- const ProxyParams& p, bool deinstantiate) {
+ const ProxyParams& p) {
GrColorType grCT = SkColorTypeToGrColorType(p.fColorType);
GrPixelConfig config = GrColorTypeToPixelConfig(grCT, GrSRGBEncoded::kNo);
@@ -311,8 +308,7 @@
}
};
const GrBackendFormat format = caps->getBackendFormatFromColorType(p.fColorType);
- auto lazyType = deinstantiate ? GrSurfaceProxy::LazyInstantiationType ::kDeinstantiate
- : GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
+ auto lazyType = GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
return proxyProvider->createLazyProxy(callback, format, desc, p.fOrigin, GrMipMapped::kNo,
flags, p.fFit, SkBudgeted::kNo, lazyType);
@@ -334,28 +330,20 @@
rtParams.fIsRT = true;
auto proxyProvider = context->priv().proxyProvider();
auto caps = context->priv().caps();
- auto p0 = make_lazy(proxyProvider, caps, texParams, true);
- auto p1 = make_lazy(proxyProvider, caps, texParams, false);
+ auto p0 = make_lazy(proxyProvider, caps, texParams);
texParams.fFit = rtParams.fFit = SkBackingFit::kApprox;
- auto p2 = make_lazy(proxyProvider, caps, rtParams, true);
- auto p3 = make_lazy(proxyProvider, caps, rtParams, false);
+ auto p1 = make_lazy(proxyProvider, caps, rtParams);
- GrDeinstantiateProxyTracker deinstantiateTracker;
{
- GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
+ GrResourceAllocator alloc(resourceProvider);
alloc.addInterval(p0.get(), 0, 1);
alloc.addInterval(p1.get(), 0, 1);
- alloc.addInterval(p2.get(), 0, 1);
- alloc.addInterval(p3.get(), 0, 1);
alloc.markEndOfOpList(0);
int startIndex, stopIndex;
GrResourceAllocator::AssignError error;
alloc.assign(&startIndex, &stopIndex, &error);
}
- deinstantiateTracker.deinstantiateAllProxies();
- REPORTER_ASSERT(reporter, !p0->isInstantiated());
+ REPORTER_ASSERT(reporter, p0->isInstantiated());
REPORTER_ASSERT(reporter, p1->isInstantiated());
- REPORTER_ASSERT(reporter, !p2->isInstantiated());
- REPORTER_ASSERT(reporter, p3->isInstantiated());
}
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index a1af2b3..9bd5415 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -1545,18 +1545,18 @@
GrGpu* gpu = context->priv().getGpu();
TestResource* wrapped1 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
- cache->insertDelayedResourceUnref(wrapped1);
+ cache->insertCrossContextGpuResource(wrapped1);
REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
TestResource* wrapped2 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
- cache->insertDelayedResourceUnref(wrapped2);
+ cache->insertCrossContextGpuResource(wrapped2);
// An uncacheable cross-context should not be purged as soon as we drop our ref. This
// is because inserting it as a cross-context resource actually holds a ref until the
// message is received.
TestResource* wrapped3 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kNo);
- cache->insertDelayedResourceUnref(wrapped3);
+ cache->insertCrossContextGpuResource(wrapped3);
REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());
diff --git a/tests/TableColorFilterTest.cpp b/tests/TableColorFilterTest.cpp
deleted file mode 100644
index bb5df60..0000000
--- a/tests/TableColorFilterTest.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "Test.h"
-
-#include "SkColorSpace.h"
-#include "SkTableColorFilter.h"
-#include "SkToSRGBColorFilter.h"
-
-// SkToSRGBColorFilter makes it easy to create out of range (>1, <0) color values.
-// Those can be dangerous as inputs to naive implementation of SkTableColorFilter.
-// This tests that our implementation is safe.
-
-DEF_TEST(TableColorFilter, r) {
- // Using a wide source gamut will make saturated colors go well out of range of sRGB.
- auto rec2020 = SkColorSpace::MakeRGB(SkNamedTransferFn::kSRGB, SkNamedGamut::kRec2020);
- sk_sp<SkColorFilter> to_srgb = SkToSRGBColorFilter::Make(rec2020);
-
- // Any table will work fine here. An identity table makes testing easy.
- uint8_t identity[256];
- for (int i = 0; i < 256; i++) {
- identity[i] = i;
- }
- sk_sp<SkColorFilter> table = SkTableColorFilter::Make(identity);
-
- // The rec2020 primaries are not representable in sRGB, but will clamp to the sRGB primaries.
- SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
- sk_sp<SkColorFilter> composed = table->makeComposed(to_srgb);
- for (auto color : colors) {
- REPORTER_ASSERT(r, composed->filterColor(color) == color);
- }
-}
diff --git a/tests/ToSRGBColorFilter.cpp b/tests/ToSRGBColorFilter.cpp
deleted file mode 100644
index 519ffb8..0000000
--- a/tests/ToSRGBColorFilter.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2017 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorSpace.h"
-#include "SkToSRGBColorFilter.h"
-#include "Test.h"
-
-
-DEF_TEST(SkToSRGBColorFilter, r) {
-
- // sRGB -> sRGB is a no-op.
- REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGB()));
-
- // The transfer function matters just as much as the gamut.
- REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(SkColorSpace::MakeSRGBLinear()));
-
- // We generally interpret nullptr source spaces as sRGB. See also chromium:787718.
- REPORTER_ASSERT(r, nullptr == SkToSRGBColorFilter::Make(nullptr));
-
- // Here's a realistic conversion.
- auto dci_p3 = SkColorSpace::MakeRGB(SkNamedTransferFn::kLinear, SkNamedGamut::kDCIP3);
- REPORTER_ASSERT(r, nullptr != SkToSRGBColorFilter::Make(dci_p3));
-
-}
diff --git a/tools/flags/SkCommonFlags.cpp b/tools/flags/SkCommonFlags.cpp
index 1e7b962..be569f8 100644
--- a/tools/flags/SkCommonFlags.cpp
+++ b/tools/flags/SkCommonFlags.cpp
@@ -166,7 +166,6 @@
"[~]none [~]dashline [~]nvpr [~]ccpr [~]aahairline [~]aaconvex [~]aalinearizing "
"[~]small [~]tess] [~]all");
-DEFINE_bool(disableExplicitAlloc, false, "Disable explicit allocation of GPU resources");
DEFINE_bool(reduceOpListSplitting, false, "Improve opList sorting");
void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
@@ -178,12 +177,6 @@
ctxOptions->fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds;
- if (FLAGS_disableExplicitAlloc) {
- ctxOptions->fExplicitlyAllocateGPUResources = GrContextOptions::Enable::kNo;
- // Can't have sorting enabled when explicit allocation is disabled.
- ctxOptions->fSortRenderTargets = GrContextOptions::Enable::kNo;
- }
-
if (FLAGS_reduceOpListSplitting) {
ctxOptions->fReduceOpListSplitting = GrContextOptions::Enable::kYes;
}
diff --git a/tools/flags/SkCommonFlagsGpu.h b/tools/flags/SkCommonFlagsGpu.h
index 23672dd..d546078 100644
--- a/tools/flags/SkCommonFlagsGpu.h
+++ b/tools/flags/SkCommonFlagsGpu.h
@@ -16,7 +16,6 @@
DECLARE_bool(cachePathMasks);
DECLARE_bool(noGS);
DECLARE_string(pr);
-DECLARE_bool(disableExplicitAlloc);
DECLARE_bool(reduceOpListSplitting);
inline GpuPathRenderers get_named_pathrenderers_flags(const char* name) {