Major refactor of runtime effects
Adds SkRuntimeEffect, a ref-counted object to hold SkSL,
a Compiler, and compiled Program, along with uniform info.
Removes the old SkSLFP factory and factory cache types.
Caching is done by simply holding on to the effect (or
the shader/color filter factories, which own an effect).
The effect class is simply ref'd by the factories, the
shader and color filter types, and the FP.
NOTE: Changes to public headers only affect private functions.
Change-Id: I0c1401505cb234e83943ad4ef2db6680f4c69fb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259336
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrLegacyDirectContext.cpp b/src/gpu/GrLegacyDirectContext.cpp
index b760e02..b951dca 100644
--- a/src/gpu/GrLegacyDirectContext.cpp
+++ b/src/gpu/GrLegacyDirectContext.cpp
@@ -12,7 +12,6 @@
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
#include "src/gpu/GrGpu.h"
-#include "src/gpu/GrSkSLFPFactoryCache.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/gpu/gl/GrGLGpu.h"
@@ -69,17 +68,16 @@
}
protected:
- bool init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) override {
- SkASSERT(caps && !FPFactoryCache);
+ bool init(sk_sp<const GrCaps> caps) override {
+ SkASSERT(caps);
SkASSERT(!fThreadSafeProxy);
- FPFactoryCache.reset(new GrSkSLFPFactoryCache(caps->refShaderCaps()));
fThreadSafeProxy = GrContextThreadSafeProxyPriv::Make(this->backend(),
this->options(),
this->contextID(),
- caps, FPFactoryCache);
+ caps);
- if (!INHERITED::init(std::move(caps), std::move(FPFactoryCache))) {
+ if (!INHERITED::init(std::move(caps))) {
return false;
}
@@ -147,7 +145,7 @@
return nullptr;
}
- if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ if (!context->init(context->fGpu->refCaps())) {
return nullptr;
}
return context;
@@ -168,7 +166,7 @@
return nullptr;
}
- if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ if (!context->init(context->fGpu->refCaps())) {
return nullptr;
}
@@ -201,7 +199,7 @@
return nullptr;
}
- if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ if (!context->init(context->fGpu->refCaps())) {
return nullptr;
}
return context;
@@ -224,7 +222,7 @@
return nullptr;
}
- if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ if (!context->init(context->fGpu->refCaps())) {
return nullptr;
}
return context;
@@ -245,7 +243,7 @@
return nullptr;
}
- if (!context->init(context->fGpu->refCaps(), nullptr)) {
+ if (!context->init(context->fGpu->refCaps())) {
return nullptr;
}
return context;