aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-17 11:40:14 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-17 17:04:26 +0000
commit777707be8445b7d2f9cb235cd040cd1994dd2996 (patch)
tree3b7ee9039c39b1c77e75e6a880210f5a856a146b /tests
parent95379ebc0dfa6fe5af14dbebe251aec43c5ce919 (diff)
Move GrSurfaceProxy::MakeLazy to GrProxyProvider::createLazy
This is pretty much a straight up move of the GrSurfaceProxy code with some plumbing to get the ProxyProvider in the right places. Change-Id: I63cecb242dada503f97dbd1c0ce7ede75323100d Reviewed-on: https://skia-review.googlesource.com/94200 Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GrCCPRTest.cpp6
-rw-r--r--tests/LazyProxyTest.cpp33
2 files changed, 24 insertions, 15 deletions
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index 36bd9dd5ff..9f770d6b50 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -33,9 +33,11 @@ public:
CCPRClip(GrCoverageCountingPathRenderer* ccpr, const SkPath& path) : fCCPR(ccpr), fPath(path) {}
private:
- bool apply(GrContext*, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out,
+ bool apply(GrContext* context, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out,
SkRect* bounds) const override {
- out->addCoverageFP(fCCPR->makeClipProcessor(rtc->priv().testingOnly_getOpListID(), fPath,
+ GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ out->addCoverageFP(fCCPR->makeClipProcessor(proxyProvider,
+ rtc->priv().testingOnly_getOpListID(), fPath,
SkIRect::MakeWH(rtc->width(), rtc->height()),
rtc->width(), rtc->height()));
return true;
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 1fe4fc4cb0..d43f07d959 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -11,6 +11,7 @@
#include "GrClip.h"
#include "GrContextPriv.h"
+#include "GrProxyProvider.h"
#include "GrOnFlushResourceProvider.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
@@ -54,9 +55,10 @@ public:
public:
DEFINE_OP_CLASS_ID
- Op(LazyProxyTest* test, bool nullTexture) : GrDrawOp(ClassID()), fTest(test) {
- fProxy = GrSurfaceProxy::MakeFullyLazy([this, nullTexture](GrResourceProvider* rp,
- GrSurfaceOrigin* origin) {
+ Op(GrProxyProvider* proxyProvider, LazyProxyTest* test, bool nullTexture)
+ : GrDrawOp(ClassID()), fTest(test) {
+ fProxy = proxyProvider->createFullyLazyProxy([this, nullTexture](
+ GrResourceProvider* rp, GrSurfaceOrigin* origin) {
REPORTER_ASSERT(fTest->fReporter, !fTest->fHasOpTexture);
fTest->fHasOpTexture = true;
*origin = kTopLeft_GrSurfaceOrigin;
@@ -72,7 +74,7 @@ public:
REPORTER_ASSERT(fTest->fReporter, texture);
return texture;
}
- }, GrSurfaceProxy::Renderable::kNo, kRGB_565_GrPixelConfig);
+ }, GrProxyProvider::Renderable::kNo, kRGB_565_GrPixelConfig);
this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo, GrOp::IsZeroArea::kNo);
}
@@ -102,18 +104,19 @@ public:
class ClipFP : public GrFragmentProcessor {
public:
- ClipFP(LazyProxyTest* test, GrTextureProxy* atlas)
+ ClipFP(GrProxyProvider* proxyProvider, LazyProxyTest* test, GrTextureProxy* atlas)
: GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags)
+ , fProxyProvider(proxyProvider)
, fTest(test)
, fAtlas(atlas) {
- fLazyProxy = GrSurfaceProxy::MakeFullyLazy([this](GrResourceProvider* rp,
- GrSurfaceOrigin* origin) {
+ fLazyProxy = proxyProvider->createFullyLazyProxy([this](GrResourceProvider* rp,
+ GrSurfaceOrigin* origin) {
REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture);
fTest->fHasClipTexture = true;
*origin = kBottomLeft_GrSurfaceOrigin;
fAtlas->instantiate(rp);
return sk_ref_sp(fAtlas->priv().peekTexture());
- }, GrSurfaceProxy::Renderable::kYes, kAlpha_half_GrPixelConfig);
+ }, GrProxyProvider::Renderable::kYes, kAlpha_half_GrPixelConfig);
fAccess.reset(fLazyProxy, GrSamplerState::Filter::kNearest,
GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag);
this->addTextureSampler(&fAccess);
@@ -122,12 +125,13 @@ public:
private:
const char* name() const override { return "LazyProxyTest::ClipFP"; }
std::unique_ptr<GrFragmentProcessor> clone() const override {
- return skstd::make_unique<ClipFP>(fTest, fAtlas);
+ return skstd::make_unique<ClipFP>(fProxyProvider, fTest, fAtlas);
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return nullptr; }
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
bool onIsEqual(const GrFragmentProcessor&) const override { return false; }
+ GrProxyProvider* const fProxyProvider;
LazyProxyTest* const fTest;
GrTextureProxy* const fAtlas;
sk_sp<GrTextureProxy> fLazyProxy;
@@ -142,9 +146,10 @@ public:
, fAtlas(atlas) {}
private:
- bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
+ bool apply(GrContext* context, GrRenderTargetContext*, bool, bool, GrAppliedClip* out,
SkRect* bounds) const override {
- out->addCoverageFP(skstd::make_unique<ClipFP>(fTest, fAtlas));
+ GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
+ out->addCoverageFP(skstd::make_unique<ClipFP>(proxyProvider, fTest, fAtlas));
return true;
}
bool quickContains(const SkRect&) const final { return false; }
@@ -171,6 +176,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true;
mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true;
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
+ GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider();
for (bool nullTexture : {false, true}) {
LazyProxyTest test(reporter);
ctx->contextPriv().addOnFlushCallbackObject(&test);
@@ -183,7 +189,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
kAlpha_half_GrPixelConfig, nullptr);
REPORTER_ASSERT(reporter, mockAtlas);
rtc->priv().testingOnly_addDrawOp(LazyProxyTest::Clip(&test, mockAtlas->asTextureProxy()),
- skstd::make_unique<LazyProxyTest::Op>(&test, nullTexture));
+ skstd::make_unique<LazyProxyTest::Op>(proxyProvider, &test, nullTexture));
ctx->contextPriv().testingOnly_flushAndRemoveOnFlushCallbackObject(&test);
}
}
@@ -191,6 +197,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) {
DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
GrMockOptions mockOptions;
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
+ auto proxyProvider = ctx->contextPriv().proxyProvider();
GrSurfaceDesc desc;
desc.fWidth = 16;
@@ -200,7 +207,7 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) {
for (bool doInstantiate : {true, false}) {
int testCount = 0;
int* testCountPtr = &testCount;
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeLazy(
+ sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
[testCountPtr](GrResourceProvider* resourceProvider, GrSurfaceOrigin* outOrigin) {
if (!resourceProvider) {
*testCountPtr = -1;