aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-12-07 15:05:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-07 20:42:49 +0000
commit1e41f4a111e5b19e55d688033e7b857caef658e6 (patch)
tree2e6891897f2165b43b5f53c505a44269c9e8e0ab
parent5b7b49f6e1ec08cbbe2eb43bf95a984e33d50f55 (diff)
Rename batch->op in GrOpList and subclasses
Change-Id: I9c82483c4ac0dc140fb1e5e3650d6ff1e5917e99 Reviewed-on: https://skia-review.googlesource.com/5646 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/gpu/GrDrawingManager.cpp4
-rw-r--r--src/gpu/GrOpList.h6
-rw-r--r--src/gpu/GrRenderTargetContext.cpp46
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp229
-rw-r--r--src/gpu/GrRenderTargetOpList.h36
-rw-r--r--src/gpu/GrTextureContext.cpp4
-rw-r--r--src/gpu/GrTextureOpList.cpp60
-rw-r--r--src/gpu/GrTextureOpList.h10
-rw-r--r--tools/gpu/GrTest.cpp2
9 files changed, 197 insertions, 200 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index e1dff8b14f..c82f49ab7f 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -80,7 +80,7 @@ void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) {
SkASSERT(result);
for (int i = 0; i < fOpLists.count(); ++i) {
- fOpLists[i]->prepareBatches(&fFlushState);
+ fOpLists[i]->prepareOps(&fFlushState);
}
// Enable this to print out verbose batching information
@@ -94,7 +94,7 @@ void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) {
fFlushState.preIssueDraws();
for (int i = 0; i < fOpLists.count(); ++i) {
- if (fOpLists[i]->drawBatches(&fFlushState)) {
+ if (fOpLists[i]->executeOps(&fFlushState)) {
flushed = true;
}
}
diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h
index 313807d63c..873cdcb650 100644
--- a/src/gpu/GrOpList.h
+++ b/src/gpu/GrOpList.h
@@ -26,8 +26,8 @@ public:
~GrOpList() override;
// These two methods are invoked as flush time
- virtual void prepareBatches(GrBatchFlushState* flushState) = 0;
- virtual bool drawBatches(GrBatchFlushState* flushState) = 0;
+ virtual void prepareOps(GrBatchFlushState* flushState) = 0;
+ virtual bool executeOps(GrBatchFlushState* flushState) = 0;
virtual void makeClosed() {
// We only close GrOpLists when MDB is enabled. When MDB is disabled there is only
@@ -82,7 +82,7 @@ private:
friend class GrDrawingManager; // for resetFlag & TopoSortTraits
enum Flags {
- kClosed_Flag = 0x01, //!< This GrOpList can't accept any more batches
+ kClosed_Flag = 0x01, //!< This GrOpList can't accept any more ops
kWasOutput_Flag = 0x02, //!< Flag for topological sorting
kTempMark_Flag = 0x04, //!< Flag for topological sorting
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 90cc6cbd9e..6ea4f1b651 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -278,7 +278,7 @@ void GrRenderTargetContext::internalClear(const GrFixedClip& clip,
if (!batch) {
return;
}
- this->getOpList()->addBatch(std::move(batch));
+ this->getOpList()->addOp(std::move(batch));
}
}
@@ -433,7 +433,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -451,7 +451,7 @@ bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -577,7 +577,7 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
snapToPixelCenters);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -693,7 +693,7 @@ void GrRenderTargetContext::fillRectToRect(const GrClip& clip,
fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -752,7 +752,7 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -767,7 +767,7 @@ void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
sk_sp<GrDrawOp> batch(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix,
localMatrix, croppedRect));
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
@@ -817,7 +817,7 @@ void GrRenderTargetContext::drawVertices(const GrClip& clip,
colors, texCoords, bounds));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -840,7 +840,7 @@ void GrRenderTargetContext::drawAtlas(const GrClip& clip,
xform, texRect, colors));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
///////////////////////////////////////////////////////////////////////////////
@@ -885,7 +885,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
&useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, *clip, batch.get());
return;
}
}
@@ -900,7 +900,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip,
shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, *clip, batch.get());
return;
}
}
@@ -942,7 +942,7 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip,
// &useHWAA));
// if (batch) {
// GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- // this->getOpList()->drawBatch(pipelineBuilder, this, *clip, batch);
+ // this->getOpList()->addDrawOp(pipelineBuilder, this, *clip, batch);
// return;
// }
//}
@@ -957,7 +957,7 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip,
shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -986,7 +986,7 @@ bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
fInstancedPipelineInfo, &useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paintIn, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return true;
}
}
@@ -1101,7 +1101,7 @@ void GrRenderTargetContext::drawRegion(const GrClip& clip,
sk_sp<GrDrawOp> batch(GrRegionBatch::Create(paint.getColor(), viewMatrix, region));
GrPipelineBuilder pipelineBuilder(paint, false);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
void GrRenderTargetContext::drawOval(const GrClip& clip,
@@ -1132,7 +1132,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip,
&useHWAA));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1146,7 +1146,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip,
shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1178,7 +1178,7 @@ void GrRenderTargetContext::drawArc(const GrClip& clip,
shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1208,7 +1208,7 @@ void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
std::move(iter), dst));
GrPipelineBuilder pipelineBuilder(paint, this->mustUseHWAA(paint));
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
void GrRenderTargetContext::prepareForExternalIO() {
@@ -1245,7 +1245,7 @@ void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip,
if (ss) {
pipelineBuilder.setUserStencil(ss);
}
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
bool GrRenderTargetContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer,
@@ -1372,7 +1372,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
paint.getColor(), viewMatrix, rects));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
}
return;
}
@@ -1389,7 +1389,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip,
shaderCaps));
if (batch) {
GrPipelineBuilder pipelineBuilder(paint, useHWAA);
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch.get());
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch.get());
return;
}
}
@@ -1562,5 +1562,5 @@ void GrRenderTargetContext::drawBatch(const GrPipelineBuilder& pipelineBuilder,
SkDEBUGCODE(this->validate();)
GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawBatch");
- this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
+ this->getOpList()->addDrawOp(pipelineBuilder, this, clip, batch);
}
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index ce2f3a982c..226bfed99c 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -50,17 +50,17 @@ GrRenderTargetOpList::GrRenderTargetOpList(GrRenderTargetProxy* rtp, GrGpu* gpu,
GrResourceProvider* resourceProvider,
GrAuditTrail* auditTrail, const Options& options)
: INHERITED(rtp, auditTrail)
- , fLastFullClearBatch(nullptr)
+ , fLastFullClearOp(nullptr)
, fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
, fLastClipStackGenID(SK_InvalidUniqueID) {
// TODO: Stop extracting the context (currently needed by GrClip)
fContext = fGpu->getContext();
- fClipBatchToBounds = options.fClipBatchToBounds;
- fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
+ fClipOpToBounds = options.fClipBatchToBounds;
+ fMaxOpLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
options.fMaxBatchLookback;
- fMaxBatchLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLookahead :
+ fMaxOpLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLookahead :
options.fMaxBatchLookahead;
if (GrCaps::InstancedSupport::kNone != this->caps()->instancedSupport()) {
@@ -78,16 +78,16 @@ GrRenderTargetOpList::~GrRenderTargetOpList() {
void GrRenderTargetOpList::dump() const {
INHERITED::dump();
- SkDebugf("batches (%d):\n", fRecordedBatches.count());
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
+ SkDebugf("ops (%d):\n", fRecordedOps.count());
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
SkDebugf("*******************************\n");
- if (!fRecordedBatches[i].fBatch) {
+ if (!fRecordedOps[i].fOp) {
SkDebugf("%d: <combined forward>\n", i);
} else {
- SkDebugf("%d: %s\n", i, fRecordedBatches[i].fBatch->name());
- SkString str = fRecordedBatches[i].fBatch->dumpInfo();
+ SkDebugf("%d: %s\n", i, fRecordedOps[i].fOp->name());
+ SkString str = fRecordedOps[i].fOp->dumpInfo();
SkDebugf("%s\n", str.c_str());
- const SkRect& clippedBounds = fRecordedBatches[i].fClippedBounds;
+ const SkRect& clippedBounds = fRecordedOps[i].fClippedBounds;
SkDebugf("ClippedBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight,
clippedBounds.fBottom);
@@ -151,17 +151,17 @@ void GrRenderTargetOpList::setupDstTexture(GrRenderTarget* rt,
dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
}
-void GrRenderTargetOpList::prepareBatches(GrBatchFlushState* flushState) {
+void GrRenderTargetOpList::prepareOps(GrBatchFlushState* flushState) {
// Semi-usually the GrOpLists are already closed at this point, but sometimes Ganesh
// needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed
// but need to be flushed anyway. Closing such GrOpLists here will mean new
// GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again.
this->makeClosed();
- // Loop over the batches that haven't yet generated their geometry
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
- if (fRecordedBatches[i].fBatch) {
- fRecordedBatches[i].fBatch->prepare(flushState);
+ // Loop over the ops that haven't yet been prepared.
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
+ if (fRecordedOps[i].fOp) {
+ fRecordedOps[i].fOp->prepare(flushState);
}
}
@@ -172,26 +172,26 @@ void GrRenderTargetOpList::prepareBatches(GrBatchFlushState* flushState) {
// TODO: this is where GrOp::renderTarget is used (which is fine since it
// is at flush time). However, we need to store the RenderTargetProxy in the
-// Batches and instantiate them here.
-bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
- if (0 == fRecordedBatches.count()) {
+// Ops and instantiate them here.
+bool GrRenderTargetOpList::executeOps(GrBatchFlushState* flushState) {
+ if (0 == fRecordedOps.count()) {
return false;
}
// Draw all the generated geometry.
SkRandom random;
GrGpuResource::UniqueID currentRTID = GrGpuResource::UniqueID::InvalidID();
std::unique_ptr<GrGpuCommandBuffer> commandBuffer;
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
- if (!fRecordedBatches[i].fBatch) {
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
+ if (!fRecordedOps[i].fOp) {
continue;
}
- if (fRecordedBatches[i].fBatch->renderTargetUniqueID() != currentRTID) {
+ if (fRecordedOps[i].fOp->renderTargetUniqueID() != currentRTID) {
if (commandBuffer) {
commandBuffer->end();
commandBuffer->submit();
commandBuffer.reset();
}
- currentRTID = fRecordedBatches[i].fBatch->renderTargetUniqueID();
+ currentRTID = fRecordedOps[i].fOp->renderTargetUniqueID();
if (!currentRTID.isInvalid()) {
static const GrGpuCommandBuffer::LoadAndStoreInfo kBasicLoadStoreInfo
{ GrGpuCommandBuffer::LoadOp::kLoad,GrGpuCommandBuffer::StoreOp::kStore,
@@ -201,7 +201,7 @@ bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
}
flushState->setCommandBuffer(commandBuffer.get());
}
- fRecordedBatches[i].fBatch->draw(flushState, fRecordedBatches[i].fClippedBounds);
+ fRecordedOps[i].fOp->draw(flushState, fRecordedOps[i].fClippedBounds);
}
if (commandBuffer) {
commandBuffer->end();
@@ -214,8 +214,8 @@ bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
}
void GrRenderTargetOpList::reset() {
- fLastFullClearBatch = nullptr;
- fRecordedBatches.reset();
+ fLastFullClearOp = nullptr;
+ fRecordedOps.reset();
if (fInstancedRendering) {
fInstancedRendering->endFlush();
}
@@ -261,13 +261,13 @@ static void batch_bounds(SkRect* bounds, const GrOp* batch) {
}
}
-void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
+void GrRenderTargetOpList::addDrawOp(const GrPipelineBuilder& pipelineBuilder,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- GrDrawOp* batch) {
+ GrDrawOp* op) {
// Setup clip
SkRect bounds;
- batch_bounds(&bounds, batch);
+ batch_bounds(&bounds, op);
GrAppliedClip appliedClip(bounds);
if (!clip.apply(fContext, renderTargetContext, pipelineBuilder.isHWAntialias(),
pipelineBuilder.hasUserStencilSettings(), &appliedClip)) {
@@ -297,21 +297,21 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
args.fPipelineBuilder = &pipelineBuilder;
args.fRenderTargetContext = renderTargetContext;
args.fCaps = this->caps();
- batch->getPipelineOptimizations(&args.fOpts);
- if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) {
+ op->getPipelineOptimizations(&args.fOpts);
+ if (args.fOpts.fOverrides.fUsePLSDstRead || fClipOpToBounds) {
GrGLIRect viewport;
viewport.fLeft = 0;
viewport.fBottom = 0;
viewport.fWidth = renderTargetContext->width();
viewport.fHeight = renderTargetContext->height();
SkIRect ibounds;
- ibounds.fLeft = SkTPin(SkScalarFloorToInt(batch->bounds().fLeft), viewport.fLeft,
+ ibounds.fLeft = SkTPin(SkScalarFloorToInt(op->bounds().fLeft), viewport.fLeft,
viewport.fWidth);
- ibounds.fTop = SkTPin(SkScalarFloorToInt(batch->bounds().fTop), viewport.fBottom,
+ ibounds.fTop = SkTPin(SkScalarFloorToInt(op->bounds().fTop), viewport.fBottom,
viewport.fHeight);
- ibounds.fRight = SkTPin(SkScalarCeilToInt(batch->bounds().fRight), viewport.fLeft,
+ ibounds.fRight = SkTPin(SkScalarCeilToInt(op->bounds().fRight), viewport.fLeft,
viewport.fWidth);
- ibounds.fBottom = SkTPin(SkScalarCeilToInt(batch->bounds().fBottom), viewport.fBottom,
+ ibounds.fBottom = SkTPin(SkScalarCeilToInt(op->bounds().fBottom), viewport.fBottom,
viewport.fHeight);
if (!appliedClip.addScissor(ibounds)) {
return;
@@ -331,22 +331,22 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
}
if (pipelineBuilder.willXPNeedDstTexture(*this->caps(), args.fOpts)) {
- this->setupDstTexture(renderTargetContext->accessRenderTarget(), clip, batch->bounds(),
+ this->setupDstTexture(renderTargetContext->accessRenderTarget(), clip, op->bounds(),
&args.fDstTexture);
if (!args.fDstTexture.texture()) {
return;
}
}
- if (!batch->installPipeline(args)) {
+ if (!op->installPipeline(args)) {
return;
}
#ifdef ENABLE_MDB
SkASSERT(fSurface);
- batch->pipeline()->addDependenciesTo(fSurface);
+ op->pipeline()->addDependenciesTo(fSurface);
#endif
- this->recordBatch(batch, appliedClip.clippedDrawBounds());
+ this->recordOp(op, appliedClip.clippedDrawBounds());
}
void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContext,
@@ -367,7 +367,7 @@ void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContex
if (!clip.apply(fContext, renderTargetContext, useHWAA, true, &appliedClip)) {
return;
}
- // TODO: respect fClipBatchToBounds if we ever start computing bounds here.
+ // TODO: respect fClipOpToBounds if we ever start computing bounds here.
// Coverage AA does not make sense when rendering to the stencil buffer. The caller should never
// attempt this in a situation that would require coverage AA.
@@ -383,48 +383,46 @@ void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContex
return;
}
- GrOp* batch = GrStencilPathBatch::Create(viewMatrix,
- useHWAA,
- path->getFillType(),
- appliedClip.hasStencilClip(),
- stencilAttachment->bits(),
- appliedClip.scissorState(),
- renderTargetContext->accessRenderTarget(),
- path);
- this->recordBatch(batch, appliedClip.clippedDrawBounds());
- batch->unref();
+ GrOp* op = GrStencilPathBatch::Create(viewMatrix,
+ useHWAA,
+ path->getFillType(),
+ appliedClip.hasStencilClip(),
+ stencilAttachment->bits(),
+ appliedClip.scissorState(),
+ renderTargetContext->accessRenderTarget(),
+ path);
+ this->recordOp(op, appliedClip.clippedDrawBounds());
+ op->unref();
}
-void GrRenderTargetOpList::addBatch(sk_sp<GrOp> batch) {
- this->recordBatch(batch.get(), batch->bounds());
-}
+void GrRenderTargetOpList::addOp(sk_sp<GrOp> op) { this->recordOp(op.get(), op->bounds()); }
void GrRenderTargetOpList::fullClear(GrRenderTarget* renderTarget, GrColor color) {
- // Currently this just inserts or updates the last clear batch. However, once in MDB this can
- // remove all the previously recorded batches and change the load op to clear with supplied
+ // Currently this just inserts or updates the last clear op. However, once in MDB this can
+ // remove all the previously recorded ops and change the load op to clear with supplied
// color.
// TODO: this needs to be updated to use GrSurfaceProxy::UniqueID
- if (fLastFullClearBatch &&
- fLastFullClearBatch->renderTargetUniqueID() == renderTarget->uniqueID()) {
- // As currently implemented, fLastFullClearBatch should be the last batch because we would
- // have cleared it when another batch was recorded.
- SkASSERT(fRecordedBatches.back().fBatch.get() == fLastFullClearBatch);
- fLastFullClearBatch->setColor(color);
+ if (fLastFullClearOp &&
+ fLastFullClearOp->renderTargetUniqueID() == renderTarget->uniqueID()) {
+ // As currently implemented, fLastFullClearOp should be the last op because we would
+ // have cleared it when another op was recorded.
+ SkASSERT(fRecordedOps.back().fOp.get() == fLastFullClearOp);
+ fLastFullClearOp->setColor(color);
return;
}
- sk_sp<GrClearBatch> batch(GrClearBatch::Make(GrFixedClip::Disabled(), color, renderTarget));
- if (batch.get() == this->recordBatch(batch.get(), batch->bounds())) {
- fLastFullClearBatch = batch.get();
+ sk_sp<GrClearBatch> op(GrClearBatch::Make(GrFixedClip::Disabled(), color, renderTarget));
+ if (op.get() == this->recordOp(op.get(), op->bounds())) {
+ fLastFullClearOp = op.get();
}
}
void GrRenderTargetOpList::discard(GrRenderTarget* renderTarget) {
- // Currently this just inserts a discard batch. However, once in MDB this can remove all the
- // previously recorded batches and change the load op to discard.
+ // Currently this just inserts a discard op. However, once in MDB this can remove all the
+ // previously recorded ops and change the load op to discard.
if (this->caps()->discardRenderTargetSupport()) {
- GrOp* batch = new GrDiscardBatch(renderTarget);
- this->recordBatch(batch, batch->bounds());
- batch->unref();
+ GrOp* op = new GrDiscardBatch(renderTarget);
+ this->recordOp(op, op->bounds());
+ op->unref();
}
}
@@ -434,16 +432,16 @@ bool GrRenderTargetOpList::copySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- GrOp* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
- if (!batch) {
+ GrOp* op = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
+ if (!op) {
return false;
}
#ifdef ENABLE_MDB
this->addDependency(src);
#endif
- this->recordBatch(batch, batch->bounds());
- batch->unref();
+ this->recordOp(op, op->bounds());
+ op->unref();
return true;
}
@@ -461,47 +459,47 @@ static void join(SkRect* out, const SkRect& a, const SkRect& b) {
out->fBottom = SkTMax(a.fBottom, b.fBottom);
}
-GrOp* GrRenderTargetOpList::recordBatch(GrOp* batch, const SkRect& clippedBounds) {
- // A closed GrOpList should never receive new/more batches
+GrOp* GrRenderTargetOpList::recordOp(GrOp* op, const SkRect& clippedBounds) {
+ // A closed GrOpList should never receive new/more ops
SkASSERT(!this->isClosed());
- // Check if there is a Batch Draw we can batch with by linearly searching back until we either
- // 1) check every draw
+ // Check if there is an op we can combine with by linearly searching back until we either
+ // 1) check every op
// 2) intersect with something
// 3) find a 'blocker'
- GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch);
+ GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, op);
GrOP_INFO("Re-Recording (%s, B%u)\n"
"\tBounds LRTB (%f, %f, %f, %f)\n",
- batch->name(),
- batch->uniqueID(),
- batch->bounds().fLeft, batch->bounds().fRight,
- batch->bounds().fTop, batch->bounds().fBottom);
- GrOP_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
+ op->name(),
+ op->uniqueID(),
+ op->bounds().fLeft, op->bounds().fRight,
+ op->bounds().fTop, op->bounds().fBottom);
+ GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
GrOP_INFO("\tClipped Bounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight,
clippedBounds.fBottom);
GrOP_INFO("\tOutcome:\n");
- int maxCandidates = SkTMin(fMaxBatchLookback, fRecordedBatches.count());
+ int maxCandidates = SkTMin(fMaxOpLookback, fRecordedOps.count());
if (maxCandidates) {
int i = 0;
while (true) {
- GrOp* candidate = fRecordedBatches.fromBack(i).fBatch.get();
+ GrOp* candidate = fRecordedOps.fromBack(i).fOp.get();
// We cannot continue to search backwards if the render target changes
- if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID()) {
+ if (candidate->renderTargetUniqueID() != op->renderTargetUniqueID()) {
GrOP_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n",
candidate->name(), candidate->uniqueID());
break;
}
- if (candidate->combineIfPossible(batch, *this->caps())) {
+ if (candidate->combineIfPossible(op, *this->caps())) {
GrOP_INFO("\t\tCombining with (%s, B%u)\n", candidate->name(),
candidate->uniqueID());
- GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate, batch);
- join(&fRecordedBatches.fromBack(i).fClippedBounds,
- fRecordedBatches.fromBack(i).fClippedBounds, clippedBounds);
+ GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate, op);
+ join(&fRecordedOps.fromBack(i).fClippedBounds,
+ fRecordedOps.fromBack(i).fClippedBounds, clippedBounds);
return candidate;
}
// Stop going backwards if we would cause a painter's order violation.
- const SkRect& candidateBounds = fRecordedBatches.fromBack(i).fClippedBounds;
+ const SkRect& candidateBounds = fRecordedOps.fromBack(i).fClippedBounds;
if (!can_reorder(candidateBounds, clippedBounds)) {
GrOP_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name(),
candidate->uniqueID());
@@ -509,52 +507,51 @@ GrOp* GrRenderTargetOpList::recordBatch(GrOp* batch, const SkRect& clippedBounds
}
++i;
if (i == maxCandidates) {
- GrOP_INFO("\t\tReached max lookback or beginning of batch array %d\n", i);
+ GrOP_INFO("\t\tReached max lookback or beginning of op array %d\n", i);
break;
}
}
} else {
- GrOP_INFO("\t\tFirstBatch\n");
+ GrOP_INFO("\t\tFirstOp\n");
}
- GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, batch);
- fRecordedBatches.emplace_back(RecordedBatch{sk_ref_sp(batch), clippedBounds});
- fLastFullClearBatch = nullptr;
- return batch;
+ GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, op);
+ fRecordedOps.emplace_back(RecordedOp{sk_ref_sp(op), clippedBounds});
+ fLastFullClearOp = nullptr;
+ return op;
}
void GrRenderTargetOpList::forwardCombine() {
- if (fMaxBatchLookahead <= 0) {
+ if (fMaxOpLookahead <= 0) {
return;
}
- for (int i = 0; i < fRecordedBatches.count() - 2; ++i) {
- GrOp* batch = fRecordedBatches[i].fBatch.get();
- const SkRect& batchBounds = fRecordedBatches[i].fClippedBounds;
- int maxCandidateIdx = SkTMin(i + fMaxBatchLookahead, fRecordedBatches.count() - 1);
+ for (int i = 0; i < fRecordedOps.count() - 2; ++i) {
+ GrOp* op = fRecordedOps[i].fOp.get();
+ const SkRect& opBounds = fRecordedOps[i].fClippedBounds;
+ int maxCandidateIdx = SkTMin(i + fMaxOpLookahead, fRecordedOps.count() - 1);
int j = i + 1;
while (true) {
- GrOp* candidate = fRecordedBatches[j].fBatch.get();
+ GrOp* candidate = fRecordedOps[j].fOp.get();
// We cannot continue to search if the render target changes
- if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID()) {
+ if (candidate->renderTargetUniqueID() != op->renderTargetUniqueID()) {
GrOP_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n",
candidate->name(), candidate->uniqueID());
break;
}
if (j == i +1) {
- // We assume batch would have combined with candidate when the candidate was added
- // via backwards combining in recordBatch.
- SkASSERT(!batch->combineIfPossible(candidate, *this->caps()));
- } else if (batch->combineIfPossible(candidate, *this->caps())) {
+ // We assume op would have combined with candidate when the candidate was added
+ // via backwards combining in recordOp.
+ SkASSERT(!op->combineIfPossible(candidate, *this->caps()));
+ } else if (op->combineIfPossible(candidate, *this->caps())) {
GrOP_INFO("\t\tCombining with (%s, B%u)\n", candidate->name(),
candidate->uniqueID());
- GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, batch, candidate);
- fRecordedBatches[j].fBatch = std::move(fRecordedBatches[i].fBatch);
- join(&fRecordedBatches[j].fClippedBounds, fRecordedBatches[j].fClippedBounds,
- batchBounds);
+ GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, op, candidate);
+ fRecordedOps[j].fOp = std::move(fRecordedOps[i].fOp);
+ join(&fRecordedOps[j].fClippedBounds, fRecordedOps[j].fClippedBounds, opBounds);
break;
}
// Stop going traversing if we would cause a painter's order violation.
- const SkRect& candidateBounds = fRecordedBatches[j].fClippedBounds;
- if (!can_reorder(candidateBounds, batchBounds)) {
+ const SkRect& candidateBounds = fRecordedOps[j].fClippedBounds;
+ if (!can_reorder(candidateBounds, opBounds)) {
GrOP_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name(),
candidate->uniqueID());
break;
@@ -573,7 +570,7 @@ void GrRenderTargetOpList::forwardCombine() {
void GrRenderTargetOpList::clearStencilClip(const GrFixedClip& clip,
bool insideStencilMask,
GrRenderTarget* rt) {
- GrOp* batch = new GrClearStencilClipBatch(clip, insideStencilMask, rt);
- this->recordBatch(batch, batch->bounds());
- batch->unref();
+ GrOp* op = new GrClearStencilClipBatch(clip, insideStencilMask, rt);
+ this->recordOp(op, op->bounds());
+ op->unref();
}
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index c4c492802b..5029b4bdaf 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -58,7 +58,7 @@ public:
void makeClosed() override {
INHERITED::makeClosed();
- fLastFullClearBatch = nullptr;
+ fLastFullClearOp = nullptr;
this->forwardCombine();
}
@@ -72,19 +72,19 @@ public:
/**
* Together these two functions flush all queued up draws to GrCommandBuffer. The return value
- * of drawBatches() indicates whether any commands were actually issued to the GPU.
+ * of executeOps() indicates whether any commands were actually issued to the GPU.
*/
- void prepareBatches(GrBatchFlushState* flushState) override;
- bool drawBatches(GrBatchFlushState* flushState) override;
+ void prepareOps(GrBatchFlushState* flushState) override;
+ bool executeOps(GrBatchFlushState* flushState) override;
/**
* Gets the capabilities of the draw target.
*/
const GrCaps* caps() const { return fGpu->caps(); }
- void drawBatch(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&, GrDrawOp*);
+ void addDrawOp(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&, GrDrawOp*);
- void addBatch(sk_sp<GrOp>);
+ void addOp(sk_sp<GrOp>);
/**
* Draws the path into user stencil bits. Upon return, all user stencil values
@@ -132,9 +132,9 @@ public:
private:
friend class GrRenderTargetContextPriv; // for clearStencilClip and stencil clip state.
- // Returns the batch that the input batch was combined with or the input batch if it wasn't
- // combined.
- GrOp* recordBatch(GrOp*, const SkRect& clippedBounds);
+ // If the input op is combined with an earlier op, this returns the combined op. Otherwise, it
+ // returns the input op.
+ GrOp* recordOp(GrOp*, const SkRect& clippedBounds);
void forwardCombine();
// Makes a copy of the dst if it is necessary for the draw and returns the texture that should
@@ -142,26 +142,26 @@ private:
// a texture copy could not be made.
void setupDstTexture(GrRenderTarget*,
const GrClip&,
- const SkRect& batchBounds,
+ const SkRect& drawOpBounds,
GrXferProcessor::DstTexture*);
// Used only via GrRenderTargetContextPriv.
void clearStencilClip(const GrFixedClip&, bool insideStencilMask, GrRenderTarget*);
- struct RecordedBatch {
- sk_sp<GrOp> fBatch;
- SkRect fClippedBounds;
+ struct RecordedOp {
+ sk_sp<GrOp> fOp;
+ SkRect fClippedBounds;
};
- SkSTArray<256, RecordedBatch, true> fRecordedBatches;
- GrClearBatch* fLastFullClearBatch;
+ SkSTArray<256, RecordedOp, true> fRecordedOps;
+ GrClearBatch* fLastFullClearOp;
// The context is only in service of the GrClip, remove once it doesn't need this.
GrContext* fContext;
GrGpu* fGpu;
GrResourceProvider* fResourceProvider;
- bool fClipBatchToBounds;
- int fMaxBatchLookback;
- int fMaxBatchLookahead;
+ bool fClipOpToBounds;
+ int fMaxOpLookback;
+ int fMaxOpLookahead;
std::unique_ptr<gr_instanced::InstancedRendering> fInstancedRendering;
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 5c0c17b728..66030f9ee0 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -74,8 +74,8 @@ bool GrTextureContext::copySurface(GrSurface* src, const SkIRect& srcRect,
#ifndef ENABLE_MDB
GrBatchFlushState flushState(fContext->getGpu(), nullptr);
- opList->prepareBatches(&flushState);
- opList->drawBatches(&flushState);
+ opList->prepareOps(&flushState);
+ opList->executeOps(&flushState);
opList->reset();
#endif
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index ffffa0b031..e9021da895 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -30,13 +30,13 @@ GrTextureOpList::~GrTextureOpList() {
void GrTextureOpList::dump() const {
INHERITED::dump();
- SkDebugf("batches (%d):\n", fRecordedBatches.count());
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
+ SkDebugf("ops (%d):\n", fRecordedOps.count());
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
SkDebugf("*******************************\n");
- SkDebugf("%d: %s\n", i, fRecordedBatches[i]->name());
- SkString str = fRecordedBatches[i]->dumpInfo();
+ SkDebugf("%d: %s\n", i, fRecordedOps[i]->name());
+ SkString str = fRecordedOps[i]->dumpInfo();
SkDebugf("%s\n", str.c_str());
- const SkRect& clippedBounds = fRecordedBatches[i]->bounds();
+ const SkRect& clippedBounds = fRecordedOps[i]->bounds();
SkDebugf("ClippedBounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
clippedBounds.fLeft, clippedBounds.fTop, clippedBounds.fRight,
clippedBounds.fBottom);
@@ -44,28 +44,28 @@ void GrTextureOpList::dump() const {
}
#endif
-void GrTextureOpList::prepareBatches(GrBatchFlushState* flushState) {
+void GrTextureOpList::prepareOps(GrBatchFlushState* flushState) {
// Semi-usually the GrOpLists are already closed at this point, but sometimes Ganesh
// needs to flush mid-draw. In that case, the SkGpuDevice's GrOpLists won't be closed
// but need to be flushed anyway. Closing such GrOpLists here will mean new
// GrOpLists will be created to replace them if the SkGpuDevice(s) write to them again.
this->makeClosed();
- // Loop over the batches that haven't yet generated their geometry
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
- if (fRecordedBatches[i]) {
- fRecordedBatches[i]->prepare(flushState);
+ // Loop over the ops that haven't yet generated their geometry
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
+ if (fRecordedOps[i]) {
+ fRecordedOps[i]->prepare(flushState);
}
}
}
-bool GrTextureOpList::drawBatches(GrBatchFlushState* flushState) {
- if (0 == fRecordedBatches.count()) {
+bool GrTextureOpList::executeOps(GrBatchFlushState* flushState) {
+ if (0 == fRecordedOps.count()) {
return false;
}
- for (int i = 0; i < fRecordedBatches.count(); ++i) {
- fRecordedBatches[i]->draw(flushState, fRecordedBatches[i]->bounds());
+ for (int i = 0; i < fRecordedOps.count(); ++i) {
+ fRecordedOps[i]->draw(flushState, fRecordedOps[i]->bounds());
}
fGpu->finishOpList();
@@ -73,7 +73,7 @@ bool GrTextureOpList::drawBatches(GrBatchFlushState* flushState) {
}
void GrTextureOpList::reset() {
- fRecordedBatches.reset();
+ fRecordedOps.reset();
}
////////////////////////////////////////////////////////////////////////////////
@@ -82,32 +82,32 @@ bool GrTextureOpList::copySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- GrOp* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
- if (!batch) {
+ GrOp* op = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
+ if (!op) {
return false;
}
#ifdef ENABLE_MDB
this->addDependency(src);
#endif
- this->recordBatch(batch);
- batch->unref();
+ this->recordOp(op);
+ op->unref();
return true;
}
-void GrTextureOpList::recordBatch(GrOp* batch) {
- // A closed GrOpList should never receive new/more batches
+void GrTextureOpList::recordOp(GrOp* op) {
+ // A closed GrOpList should never receive new/more ops
SkASSERT(!this->isClosed());
- GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch);
+ GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, op);
GrOP_INFO("Re-Recording (%s, B%u)\n"
"\tBounds LRTB (%f, %f, %f, %f)\n",
- batch->name(),
- batch->uniqueID(),
- batch->bounds().fLeft, batch->bounds().fRight,
- batch->bounds().fTop, batch->bounds().fBottom);
- GrOP_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
- GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, batch);
-
- fRecordedBatches.emplace_back(sk_ref_sp(batch));
+ op->name(),
+ op->uniqueID(),
+ op->bounds().fLeft, op->bounds().fRight,
+ op->bounds().fTop, op->bounds().fBottom);
+ GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
+ GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(fAuditTrail, op);
+
+ fRecordedOps.emplace_back(sk_ref_sp(op));
}
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index 934c4b0211..0b28421aa1 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -35,10 +35,10 @@ public:
/**
* Together these two functions flush all queued up draws to GrCommandBuffer. The return value
- * of drawBatches() indicates whether any commands were actually issued to the GPU.
+ * of drawOps() indicates whether any commands were actually issued to the GPU.
*/
- void prepareBatches(GrBatchFlushState* flushState) override;
- bool drawBatches(GrBatchFlushState* flushState) override;
+ void prepareOps(GrBatchFlushState* flushState) override;
+ bool executeOps(GrBatchFlushState* flushState) override;
/**
* Copies a pixel rectangle from one surface to another. This call may finalize
@@ -60,9 +60,9 @@ public:
SkDEBUGCODE(void dump() const override;)
private:
- void recordBatch(GrOp*);
+ void recordOp(GrOp*);
- SkSTArray<2, sk_sp<GrOp>, true> fRecordedBatches;
+ SkSTArray<2, sk_sp<GrOp>, true> fRecordedOps;
GrGpu* fGpu;
typedef GrOpList INHERITED;
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 2a2eea5438..8ab4c9be22 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -261,7 +261,7 @@ void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint,
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag, true);
}
- fRenderTargetContext->getOpList()->drawBatch(pipelineBuilder, fRenderTargetContext, GrNoClip(),
+ fRenderTargetContext->getOpList()->addDrawOp(pipelineBuilder, fRenderTargetContext, GrNoClip(),
batch);
}