Misc batch->op cleanup Part 1 of 2
Change-Id: I80f951976558a284e55386e0a368f08bd835d8ca
Reviewed-on: https://skia-review.googlesource.com/6359
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index d43e65f..3530b88 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -60,7 +60,7 @@
return *rtc != nullptr;
}
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
static const int kW = 10;
static const int kH = 10;
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index e1910f4..ce89793 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1094,7 +1094,7 @@
TestLCDCoverageOp() : INHERITED(ClassID()) {}
- const char* name() const override { return "Test LCD Text Batch"; }
+ const char* name() const override { return "Test LCD Text Op"; }
private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 0c7c142..9cb2f8a 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -25,19 +25,19 @@
#include "ops/GrMeshDrawOp.h"
namespace {
-class Batch : public GrMeshDrawOp {
+class Op : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- const char* name() const override { return "Dummy Batch"; }
+ const char* name() const override { return "Dummy Op"; }
- Batch(int numAttribs)
- : INHERITED(ClassID())
- , fNumAttribs(numAttribs) {
+ static sk_sp<GrDrawOp> Make(int numAttribs) { return sk_sp<GrDrawOp>(new Op(numAttribs)); }
+
+private:
+ Op(int numAttribs) : INHERITED(ClassID()), fNumAttribs(numAttribs) {
this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo);
}
-private:
void getPipelineAnalysisInput(GrPipelineAnalysisDrawOpInput* input) const override {
input->pipelineColorInput()->setUnknownFourComponents();
input->pipelineCoverageInput()->setUnknownSingleComponent();
@@ -121,20 +121,18 @@
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
#endif
- sk_sp<GrDrawOp> op;
GrPaint grPaint;
// This one should succeed.
- op.reset(new Batch(attribCnt));
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
+ renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+ Op::Make(attribCnt));
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0);
#endif
context->resetGpuStats();
- // This one should fail.
- op.reset(new Batch(attribCnt+1));
- renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op));
+ renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone,
+ Op::Make(attribCnt + 1));
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 77ec2db..c285721 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -102,7 +102,7 @@
check_refs(reporter, sProxy.get(), 1, 1, 0, 1);
- // In the deferred case, the discard batch created on instantiation adds an
+ // In the deferred case, the discard op created on instantiation adds an
// extra ref and write
bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
caps.discardRenderTargetSupport();
@@ -122,7 +122,7 @@
check_refs(reporter, sProxy.get(), 1, 1, 1, 0);
- // In the deferred case, the discard batch created on instantiation adds an
+ // In the deferred case, the discard op created on instantiation adds an
// extra ref and write
bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
caps.discardRenderTargetSupport();
@@ -142,7 +142,7 @@
check_refs(reporter, sProxy.get(), 1, 1, 1, 1);
- // In the deferred case, the discard batch created on instantiation adds an
+ // In the deferred case, the discard op created on instantiation adds an
// extra ref and write
bool proxyGetsDiscardRef = !sProxy->isWrapped_ForTesting() &&
caps.discardRenderTargetSupport();
@@ -150,7 +150,7 @@
sProxy->instantiate(provider);
- // In the deferred case, this checks that the refs transfered to the GrSurface
+ // In the deferred case, this checks that the refs transferred to the GrSurface
check_refs(reporter, sProxy.get(), 1, 1, 1, expectedWrites);
}
@@ -168,7 +168,7 @@
sProxy->instantiate(provider);
- // In the deferred case, this checks that the refs transfered to the GrSurface
+ // In the deferred case, this checks that the refs transferred to the GrSurface
check_refs(reporter, sProxy.get(), 3, 3, 0, expectedWrites);
sProxy->unref();