DM: Add a per-sink MemoryCache to all GPU sinks
This isolates the caches per config, so we don't try to reuse cached binaries across different GL versions (or different D3D backend versions on ANGLE bots, etc). Locally, this sped up ANGLE significantly Looking at a sample bot (NUC6i5SYK), it dropped DM from 36m to 31m. Change-Id: I95db18c6ea85041e6adbc972f0118233c82818fb Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223985 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
f803878add
commit
a7b224d3a3
@ -1331,6 +1331,7 @@ static DEFINE_bool(releaseAndAbandonGpuContext, false,
|
||||
"Test releasing all gpu resources and abandoning the GrContext "
|
||||
"after running each test");
|
||||
static DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
|
||||
static DEFINE_bool(programBinaryCache, true, "Use in-memory program binary cache");
|
||||
|
||||
GPUSink::GPUSink(GrContextFactory::ContextType ct,
|
||||
GrContextFactory::ContextOverrides overrides,
|
||||
@ -1351,7 +1352,11 @@ GPUSink::GPUSink(GrContextFactory::ContextType ct,
|
||||
, fAlphaType(alphaType)
|
||||
, fColorSpace(std::move(colorSpace))
|
||||
, fThreaded(threaded)
|
||||
, fBaseContextOptions(grCtxOptions) {}
|
||||
, fBaseContextOptions(grCtxOptions) {
|
||||
if (FLAGS_programBinaryCache) {
|
||||
fBaseContextOptions.fPersistentCache = &fMemoryCache;
|
||||
}
|
||||
}
|
||||
|
||||
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream* dstStream, SkString* log) const {
|
||||
return this->onDraw(src, dst, dstStream, log, fBaseContextOptions);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/core/SkBBoxHierarchy.h"
|
||||
#include "src/utils/SkMultiPictureDocument.h"
|
||||
#include "tools/flags/CommonFlagsConfig.h"
|
||||
#include "tools/gpu/MemoryCache.h"
|
||||
|
||||
//#define TEST_VIA_SVG
|
||||
|
||||
@ -363,6 +364,7 @@ private:
|
||||
sk_sp<SkColorSpace> fColorSpace;
|
||||
bool fThreaded;
|
||||
GrContextOptions fBaseContextOptions;
|
||||
sk_gpu_test::MemoryCache fMemoryCache;
|
||||
};
|
||||
|
||||
class GPUThreadTestingSink : public GPUSink {
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "include/core/SkExecutor.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "tools/flags/CommonFlags.h"
|
||||
#include "tools/gpu/MemoryCache.h"
|
||||
|
||||
|
||||
DEFINE_int(gpuThreads,
|
||||
2,
|
||||
@ -34,8 +32,6 @@ static DEFINE_bool(disableDriverCorrectnessWorkarounds, false,
|
||||
static DEFINE_bool(reduceOpListSplitting, false, "Improve opList sorting");
|
||||
static DEFINE_bool(dontReduceOpListSplitting, false, "Allow more opList splitting");
|
||||
|
||||
static DEFINE_bool(programBinaryCache, false, "Use in-memory program binary cache");
|
||||
|
||||
static GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
|
||||
if (!strcmp(name, "none")) {
|
||||
return GpuPathRenderers::kNone;
|
||||
@ -94,11 +90,6 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
|
||||
ctxOptions->fGpuPathRenderers = collect_gpu_path_renderers_from_flags();
|
||||
ctxOptions->fDisableDriverCorrectnessWorkarounds = FLAGS_disableDriverCorrectnessWorkarounds;
|
||||
|
||||
if (FLAGS_programBinaryCache) {
|
||||
static sk_gpu_test::MemoryCache gMemoryCache;
|
||||
ctxOptions->fPersistentCache = &gMemoryCache;
|
||||
}
|
||||
|
||||
if (FLAGS_reduceOpListSplitting) {
|
||||
SkASSERT(!FLAGS_dontReduceOpListSplitting);
|
||||
ctxOptions->fReduceOpListSplitting = GrContextOptions::Enable::kYes;
|
||||
|
Loading…
Reference in New Issue
Block a user