Remove GrTestTarget
Change-Id: I4d2e1aa54732ff75b44a197255035c0e04548219 Reviewed-on: https://skia-review.googlesource.com/7327 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
80a08dd2e5
commit
77505da160
@ -36,7 +36,6 @@ class GrPipelineBuilder;
|
||||
class GrResourceEntry;
|
||||
class GrResourceCache;
|
||||
class GrResourceProvider;
|
||||
class GrTestTarget;
|
||||
class GrTextBlobCache;
|
||||
class GrTextContext;
|
||||
class GrSamplerParams;
|
||||
@ -341,9 +340,6 @@ public:
|
||||
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
|
||||
GrResourceCache* getResourceCache() { return fResourceCache; }
|
||||
|
||||
// Called by tests that draw directly to the context via GrRenderTargetContext
|
||||
void getTestTarget(GrTestTarget*, sk_sp<GrRenderTargetContext>);
|
||||
|
||||
/** Reset GPU stats */
|
||||
void resetGpuStats() const ;
|
||||
|
||||
|
@ -391,7 +391,6 @@ private:
|
||||
|
||||
friend class GrDrawingManager; // for ctor
|
||||
friend class GrRenderTargetContextPriv;
|
||||
friend class GrTestTarget; // for access to getOpList
|
||||
friend class GrSWMaskHelper; // for access to addDrawOp
|
||||
|
||||
// All the path renderers currently make their own ops
|
||||
|
@ -7,18 +7,19 @@
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
#include "SkPath.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrTest.h"
|
||||
#include "SkPath.h"
|
||||
#include "ops/GrAADistanceFieldPathRenderer.h"
|
||||
|
||||
// This test case including path coords and matrix taken from crbug.com/627443.
|
||||
// Because of inaccuracies in large floating point values this causes the
|
||||
// the path renderer to attempt to add a path DF to its atlas that is larger
|
||||
// than the plot size which used to crash rather than fail gracefully.
|
||||
static void test_far_from_origin(GrRenderTargetContext* renderTargetContext, GrPathRenderer* pr,
|
||||
GrResourceProvider* rp) {
|
||||
static void test_far_from_origin(GrResourceProvider* rp,
|
||||
GrRenderTargetContext* renderTargetContext,
|
||||
GrPathRenderer* pr) {
|
||||
SkPath path;
|
||||
path.lineTo(49.0255089839f, 0.473541f);
|
||||
// This extra line wasn't in the original bug but was added to fake out GrShape's special
|
||||
@ -58,12 +59,12 @@ static void test_far_from_origin(GrRenderTargetContext* renderTargetContext, GrP
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(AADistanceFieldPathRenderer, reporter, ctxInfo) {
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
// The DF PR only works with contexts that support derivatives
|
||||
if (!ctxInfo.grContext()->caps()->shaderCaps()->shaderDerivativeSupport()) {
|
||||
if (!ctx->caps()->shaderCaps()->shaderDerivativeSupport()) {
|
||||
return;
|
||||
}
|
||||
sk_sp<GrRenderTargetContext> rtc(ctxInfo.grContext()->makeRenderTargetContext(
|
||||
SkBackingFit::kApprox,
|
||||
sk_sp<GrRenderTargetContext> rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox,
|
||||
800, 800,
|
||||
kRGBA_8888_GrPixelConfig,
|
||||
nullptr,
|
||||
@ -74,11 +75,9 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(AADistanceFieldPathRenderer, reporter, ctxInfo)
|
||||
}
|
||||
|
||||
GrAADistanceFieldPathRenderer dfpr;
|
||||
GrTestTarget tt;
|
||||
ctxInfo.grContext()->getTestTarget(&tt, rtc);
|
||||
GrResourceProvider* rp = tt.resourceProvider();
|
||||
|
||||
test_far_from_origin(rtc.get(), &dfpr, rp);
|
||||
ctxInfo.grContext()->flush();
|
||||
ctx->flush();
|
||||
test_far_from_origin(ctx->resourceProvider(), rtc.get(), &dfpr);
|
||||
ctx->flush();
|
||||
}
|
||||
#endif
|
||||
|
@ -5,12 +5,12 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
#include "SkPath.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrContext.h"
|
||||
#include "GrTest.h"
|
||||
#include "Test.h"
|
||||
#include "ops/GrTessellatingPathRenderer.h"
|
||||
|
||||
/*
|
||||
@ -249,7 +249,7 @@ static SkPath create_path_16() {
|
||||
return path;
|
||||
}
|
||||
|
||||
static void test_path(GrRenderTargetContext* renderTargetContext, GrResourceProvider* rp,
|
||||
static void test_path(GrResourceProvider* rp, GrRenderTargetContext* renderTargetContext,
|
||||
const SkPath& path) {
|
||||
GrTessellatingPathRenderer tess;
|
||||
|
||||
@ -272,8 +272,8 @@ static void test_path(GrRenderTargetContext* renderTargetContext, GrResourceProv
|
||||
}
|
||||
|
||||
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
||||
sk_sp<GrRenderTargetContext> rtc(ctxInfo.grContext()->makeRenderTargetContext(
|
||||
SkBackingFit::kApprox,
|
||||
GrContext* ctx = ctxInfo.grContext();
|
||||
sk_sp<GrRenderTargetContext> rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox,
|
||||
800, 800,
|
||||
kRGBA_8888_GrPixelConfig,
|
||||
nullptr,
|
||||
@ -283,26 +283,25 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
GrTestTarget tt;
|
||||
ctxInfo.grContext()->getTestTarget(&tt, rtc);
|
||||
GrResourceProvider* rp = tt.resourceProvider();
|
||||
GrResourceProvider* rp = ctx->resourceProvider();
|
||||
|
||||
test_path(rtc.get(), rp, create_path_0());
|
||||
test_path(rtc.get(), rp, create_path_1());
|
||||
test_path(rtc.get(), rp, create_path_2());
|
||||
test_path(rtc.get(), rp, create_path_3());
|
||||
test_path(rtc.get(), rp, create_path_4());
|
||||
test_path(rtc.get(), rp, create_path_5());
|
||||
test_path(rtc.get(), rp, create_path_6());
|
||||
test_path(rtc.get(), rp, create_path_7());
|
||||
test_path(rtc.get(), rp, create_path_8());
|
||||
test_path(rtc.get(), rp, create_path_9());
|
||||
test_path(rtc.get(), rp, create_path_10());
|
||||
test_path(rtc.get(), rp, create_path_11());
|
||||
test_path(rtc.get(), rp, create_path_12());
|
||||
test_path(rtc.get(), rp, create_path_13());
|
||||
test_path(rtc.get(), rp, create_path_14());
|
||||
test_path(rtc.get(), rp, create_path_15());
|
||||
test_path(rtc.get(), rp, create_path_16());
|
||||
ctx->flush();
|
||||
test_path(rp, rtc.get(), create_path_0());
|
||||
test_path(rp, rtc.get(), create_path_1());
|
||||
test_path(rp, rtc.get(), create_path_2());
|
||||
test_path(rp, rtc.get(), create_path_3());
|
||||
test_path(rp, rtc.get(), create_path_4());
|
||||
test_path(rp, rtc.get(), create_path_5());
|
||||
test_path(rp, rtc.get(), create_path_6());
|
||||
test_path(rp, rtc.get(), create_path_7());
|
||||
test_path(rp, rtc.get(), create_path_8());
|
||||
test_path(rp, rtc.get(), create_path_9());
|
||||
test_path(rp, rtc.get(), create_path_10());
|
||||
test_path(rp, rtc.get(), create_path_11());
|
||||
test_path(rp, rtc.get(), create_path_12());
|
||||
test_path(rp, rtc.get(), create_path_13());
|
||||
test_path(rp, rtc.get(), create_path_14());
|
||||
test_path(rp, rtc.get(), create_path_15());
|
||||
test_path(rp, rtc.get(), create_path_16());
|
||||
}
|
||||
#endif
|
||||
|
@ -55,13 +55,6 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
|
||||
}
|
||||
};
|
||||
|
||||
void GrTestTarget::init(GrContext* ctx, sk_sp<GrRenderTargetContext> renderTargetContext) {
|
||||
SkASSERT(!fContext);
|
||||
|
||||
fContext.reset(SkRef(ctx));
|
||||
fRenderTargetContext = renderTargetContext;
|
||||
}
|
||||
|
||||
bool GrSurfaceProxy::isWrapped_ForTesting() const {
|
||||
return SkToBool(fTarget);
|
||||
}
|
||||
@ -70,16 +63,6 @@ bool GrRenderTargetContext::isWrapped_ForTesting() const {
|
||||
return fRenderTargetProxy->isWrapped_ForTesting();
|
||||
}
|
||||
|
||||
void GrContext::getTestTarget(GrTestTarget* tar, sk_sp<GrRenderTargetContext> renderTargetContext) {
|
||||
this->flush();
|
||||
SkASSERT(renderTargetContext);
|
||||
// We could create a proxy GrOpList that passes through to fGpu until ~GrTextTarget() and
|
||||
// then disconnects. This would help prevent test writers from mixing using the returned
|
||||
// GrOpList and regular drawing. We could also assert or fail in GrContext drawing methods
|
||||
// until ~GrTestTarget().
|
||||
tar->init(this, std::move(renderTargetContext));
|
||||
}
|
||||
|
||||
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
|
||||
fTextBlobCache->setBudget(bytes);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#define GrTest_DEFINED
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrRenderTargetContext.h"
|
||||
|
||||
namespace GrTest {
|
||||
/**
|
||||
@ -19,21 +18,4 @@ namespace GrTest {
|
||||
void SetupAlwaysEvictAtlas(GrContext*);
|
||||
};
|
||||
|
||||
/** TODO Please do not use this if you can avoid it. We are in the process of deleting it.
|
||||
Allows a test to temporarily draw to a GrOpList owned by a GrContext. Tests that use this
|
||||
should be careful not to mix using the GrOpList directly and drawing via SkCanvas or
|
||||
GrContext. In the future this object may provide some guards to prevent this. */
|
||||
class GrTestTarget {
|
||||
public:
|
||||
GrTestTarget() {}
|
||||
|
||||
void init(GrContext*, sk_sp<GrRenderTargetContext>);
|
||||
|
||||
GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
|
||||
|
||||
private:
|
||||
sk_sp<GrContext> fContext;
|
||||
sk_sp<GrRenderTargetContext> fRenderTargetContext;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user