aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/AlternatingColorPatternBench.cpp4
-rw-r--r--bench/SKPBench.cpp2
-rw-r--r--dm/DMSrcSink.cpp13
-rw-r--r--gm/croppedrects.cpp4
-rw-r--r--gm/drawminibitmaprect.cpp4
-rw-r--r--gm/dstreadshuffle.cpp4
-rw-r--r--gm/textblobblockreordering.cpp9
-rw-r--r--gm/variedtext.cpp2
-rw-r--r--gn/gpu.gni2
-rw-r--r--gyp/gmslides.gypi1
-rw-r--r--include/gpu/GrContextOptions.h8
-rw-r--r--include/gpu/GrProgramElement.h2
-rw-r--r--include/gpu/GrXferProcessor.h10
-rw-r--r--samplecode/SampleCode.cpp2
-rw-r--r--samplecode/SampleManyRects.cpp7
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.h4
-rw-r--r--src/gpu/GrDrawingManager.cpp2
-rw-r--r--src/gpu/GrGeometryProcessor.h1
-rw-r--r--src/gpu/GrGpuCommandBuffer.h2
-rw-r--r--src/gpu/GrOpFlushState.h4
-rw-r--r--src/gpu/GrPipeline.h6
-rw-r--r--src/gpu/GrPipelineBuilder.h2
-rw-r--r--src/gpu/GrPrimitiveProcessor.h2
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp32
-rw-r--r--src/gpu/GrRenderTargetOpList.h12
-rw-r--r--src/gpu/GrResourceProvider.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp4
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp8
-rw-r--r--src/gpu/gl/GrGLCaps.cpp6
-rw-r--r--src/gpu/gl/GrGLGpu.cpp2
-rw-r--r--src/gpu/ops/GrAtlasTextOp.cpp6
-rw-r--r--src/gpu/text/GrAtlasTextBlob.cpp16
-rw-r--r--src/gpu/text/GrAtlasTextBlob.h12
-rw-r--r--src/gpu/text/GrAtlasTextBlob_regenInOp.cpp (renamed from src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp)14
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp4
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp2
-rw-r--r--tests/ClearTest.cpp2
-rw-r--r--tests/GrPorterDuffTest.cpp2
-rw-r--r--tests/PrimitiveProcessorTest.cpp22
-rw-r--r--tests/ProxyRefTest.cpp10
41 files changed, 123 insertions, 136 deletions
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index 147dc3607b..3777f2bbf3 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -70,8 +70,8 @@ static void makebm(SkBitmap* bm, int w, int h) {
*
* The bench is used to test a few things. First it can test any optimizations made for a specific
* color pattern (for example drawing an opaque bitmap versus one with partial alpha). Also it can
- * be used to test the cost of program switching and/or batching when alternating between different
- * patterns when on the gpu.
+ * be used to test the cost of program switching and/or GrDrawOp combining when alternating between
+ * different patterns when on the gpu.
*/
class AlternatingColorPatternBench : public Benchmark {
public:
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 7d92c9e738..9d4dcc5b1a 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -120,7 +120,7 @@ void SKPBench::onDraw(int loops, SkCanvas* canvas) {
break;
}
#if SK_SUPPORT_GPU
- // Ensure the GrContext doesn't batch across draw loops.
+ // Ensure the GrContext doesn't combine ops across draw loops.
if (GrContext* context = canvas->getGrContext()) {
context->flush();
}
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 50b916395d..594a4b7182 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1222,17 +1222,16 @@ GPUSink::GPUSink(GrContextFactory::ContextType ct,
, fThreaded(threaded) {}
DEFINE_bool(imm, false, "Run gpu configs in immediate mode.");
-DEFINE_bool(batchClip, false, "Clip each GrOp to its device bounds for testing.");
-DEFINE_int32(batchLookback, -1, "Maximum GrOp lookback for combining, negative means default.");
-DEFINE_int32(batchLookahead, -1, "Maximum GrOp lookahead for combining, negative means "
- "default.");
+DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
+DEFINE_int32(opLookback, -1, "Maximum GrOp lookback for combining, negative means default.");
+DEFINE_int32(opLookahead, -1, "Maximum GrOp lookahead for combining, negative means default.");
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const {
GrContextOptions grOptions;
grOptions.fImmediateMode = FLAGS_imm;
- grOptions.fClipBatchToBounds = FLAGS_batchClip;
- grOptions.fMaxBatchLookback = FLAGS_batchLookback;
- grOptions.fMaxBatchLookahead = FLAGS_batchLookahead;
+ grOptions.fClipDrawOpsToBounds = FLAGS_drawOpClip;
+ grOptions.fMaxOpCombineLookback = FLAGS_opLookback;
+ grOptions.fMaxOpCombineLookahead = FLAGS_opLookahead;
src.modifyGrContextOptions(&grOptions);
diff --git a/gm/croppedrects.cpp b/gm/croppedrects.cpp
index 246251919f..ce7ff4b519 100644
--- a/gm/croppedrects.cpp
+++ b/gm/croppedrects.cpp
@@ -22,7 +22,7 @@ constexpr SkRect kSrcImageClip{75, 75, 275, 275};
*
* The test creates an image of a green square surrounded by red background, then draws this image
* in various ways with the red clipped out. The test is successful if there is no visible red
- * background, scissor is never used, and ideally, all the rectangles draw in one batch.
+ * background, scissor is never used, and ideally, all the rectangles draw in one GrDrawOp.
*/
class CroppedRectsGM : public GM {
private:
@@ -95,7 +95,7 @@ private:
canvas->drawPath(path, paint);
}
- // TODO: assert the draw target only has one batch in the post-MDB world.
+ // TODO: assert the draw target only has one op in the post-MDB world.
}
sk_sp<SkImage> fSrcImage;
diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp
index eccf04c352..4a1417ce29 100644
--- a/gm/drawminibitmaprect.cpp
+++ b/gm/drawminibitmaprect.cpp
@@ -63,8 +63,8 @@ static sk_sp<SkImage> makebm(SkCanvas* caller, int w, int h) {
constexpr int gSize = 1024;
constexpr int gSurfaceSize = 2048;
-// This GM calls drawImageRect several times using the same texture. This is
-// intended to exercise batching of these calls.
+// This GM calls drawImageRect several times using the same texture. This is intended to exercise
+// combining GrDrawOps during these calls.
class DrawMiniBitmapRectGM : public skiagm::GM {
public:
DrawMiniBitmapRectGM(bool antiAlias) : fAA(antiAlias) {
diff --git a/gm/dstreadshuffle.cpp b/gm/dstreadshuffle.cpp
index b038fdb1f7..11aa2913df 100644
--- a/gm/dstreadshuffle.cpp
+++ b/gm/dstreadshuffle.cpp
@@ -156,8 +156,8 @@ protected:
SkPaint p;
p.setAntiAlias(true);
p.setColor(color);
- // In order to get some batching on the GPU backend we do 2 src over for
- // each xfer mode which requires a dst read
+ // In order to get some op combining on the GPU backend we do 2 src over
+ // for each xfer mode which requires a dst read
p.setBlendMode(r % 3 == 0 ? SkBlendMode::kLighten :
SkBlendMode::kSrcOver);
SetStyle(&p, style, width);
diff --git a/gm/textblobblockreordering.cpp b/gm/textblobblockreordering.cpp
index c581e135a6..b1658f84d1 100644
--- a/gm/textblobblockreordering.cpp
+++ b/gm/textblobblockreordering.cpp
@@ -46,9 +46,9 @@ protected:
return SkISize::Make(kWidth, kHeight);
}
- // This draws the same text blob 3 times. The second draw used a different
- // xfer mode so it doens't get batched with the first and third.
- // ultimately thye iwll be flushed in the order first, third, and then second
+ // This draws the same text blob 3 times. The second draw used a different xfer mode so its
+ // GrDrawOp doesn't get combined with the first and third. Ultimately, they will be flushed in
+ // the order first, third, and then second.
void onDraw(SkCanvas* canvas) override {
canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorGRAY));
@@ -63,8 +63,7 @@ protected:
canvas->translate(SkIntToScalar(xDelta), SkIntToScalar(yDelta));
- // draw a rect where the text should be, and then twiddle the xfermode
- // so we don't batch
+ // Draw a rect where the text should be, and then twiddle the xfermode so we don't combine.
SkPaint redPaint;
redPaint.setColor(SK_ColorRED);
canvas->drawRect(bounds, redPaint);
diff --git a/gm/variedtext.cpp b/gm/variedtext.cpp
index b17bb7012a..9ee8ff6583 100644
--- a/gm/variedtext.cpp
+++ b/gm/variedtext.cpp
@@ -13,7 +13,7 @@
/**
* Draws text with random parameters. The text draws each get their own clip rect. It is also
- * used as a bench to measure how well the GPU backend batches text draws.
+ * used as a bench to measure how well the GPU backend combines draw ops for text draws.
*/
class VariedTextGM : public skiagm::GM {
diff --git a/gn/gpu.gni b/gn/gpu.gni
index eee90031c9..a635401f96 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -348,7 +348,7 @@ skia_gpu_sources = [
"$_src/gpu/text/GrAtlasGlyphCache.cpp",
"$_src/gpu/text/GrAtlasGlyphCache.h",
"$_src/gpu/text/GrAtlasTextBlob.cpp",
- "$_src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp",
+ "$_src/gpu/text/GrAtlasTextBlob_regenInOp.cpp",
"$_src/gpu/text/GrAtlasTextBlob.h",
"$_src/gpu/text/GrAtlasTextContext.cpp",
"$_src/gpu/text/GrAtlasTextContext.h",
diff --git a/gyp/gmslides.gypi b/gyp/gmslides.gypi
index d318a53532..66cfc6cc39 100644
--- a/gyp/gmslides.gypi
+++ b/gyp/gmslides.gypi
@@ -22,7 +22,6 @@
'<!@(python find.py "*.c*" ../gm)',
# Files needed by particular GMs
- '../src/gpu/batches/GrTestBatch.h',
'../tools/debugger/SkDrawCommand.h',
'../tools/debugger/SkDrawCommand.cpp',
'../tools/debugger/SkDebugCanvas.h',
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 65daf72ead..ac384703a3 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -39,14 +39,14 @@ struct GrContextOptions {
immediately. Intended to ease debugging. */
bool fImmediateMode = false;
- /** For debugging purposes turn each GrOp's bounds into a clip rect. This is used to
+ /** For debugging purposes turn each GrDrawOp's bounds into a clip rect. This is used to
verify that the clip bounds are conservative. */
- bool fClipBatchToBounds = false;
+ bool fClipDrawOpsToBounds = false;
/** For debugging, override the default maximum look-back or look-ahead window for GrOp
combining. */
- int fMaxBatchLookback = -1;
- int fMaxBatchLookahead = -1;
+ int fMaxOpCombineLookback = -1;
+ int fMaxOpCombineLookahead = -1;
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
swizzling. */
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index ba9daf7154..ce09762693 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -27,7 +27,7 @@ class GrGpuResourceRef;
* While a GrProgramElement is ref'ed any resources it owns are also ref'ed. However, once it gets
* into the state where it has pending executions AND no refs then it converts its ownership of
* its GrGpuResources from refs to pending IOs. The pending IOs allow the cache to track when it is
- * safe to recycle a resource even though we still have buffered GrBatches that read or write to the
+ * safe to recycle a resource even though we still have buffered GrOps that read or write to the
* the resource.
*
* To make this work all GrGpuResource objects owned by a GrProgramElement or derived classes
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 9a920a2491..d5fa9e03eb 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -107,21 +107,21 @@ public:
/**
* The draw can be skipped completely.
*/
- kSkipDraw_OptFlag = 0x1,
+ kSkipDraw_OptFlag = 0x1,
/**
* GrXferProcessor will ignore color, thus no need to provide
*/
- kIgnoreColor_OptFlag = 0x2,
+ kIgnoreColor_OptFlag = 0x2,
/**
* GrXferProcessor will ignore coverage, thus no need to provide
*/
- kIgnoreCoverage_OptFlag = 0x4,
+ kIgnoreCoverage_OptFlag = 0x4,
/**
* Clear color stages and override input color to that returned by getOptimizations
*/
- kOverrideColor_OptFlag = 0x8,
+ kOverrideColor_OptFlag = 0x8,
/**
- * Can tweak alpha for coverage. Currently this flag should only be used by a batch
+ * Can tweak alpha for coverage. Currently this flag should only be used by a GrDrawOp.
*/
kCanTweakAlphaForCoverage_OptFlag = 0x20,
};
diff --git a/samplecode/SampleCode.cpp b/samplecode/SampleCode.cpp
index bb551190d2..a64c0e244a 100644
--- a/samplecode/SampleCode.cpp
+++ b/samplecode/SampleCode.cpp
@@ -153,7 +153,7 @@ void SampleView::onDraw(SkCanvas* canvas) {
SkAutoCanvasRestore acr(canvas, true);
this->onDrawContent(canvas);
#if SK_SUPPORT_GPU
- // Ensure the GrContext doesn't batch across draw loops.
+ // Ensure the GrContext doesn't combine GrDrawOps across draw loops.
if (GrContext* context = canvas->getGrContext()) {
context->flush();
}
diff --git a/samplecode/SampleManyRects.cpp b/samplecode/SampleManyRects.cpp
index b5eb6b00bf..66274a483a 100644
--- a/samplecode/SampleManyRects.cpp
+++ b/samplecode/SampleManyRects.cpp
@@ -12,7 +12,7 @@
#include "SkView.h"
/**
- * Animated sample used to develop batched rect implementation in GrBufferedDrawTarget.
+ * Animated sample used to develop a predecessor of GrDrawOp combining.
*/
class ManyRectsView : public SampleView {
private:
@@ -44,8 +44,7 @@ protected:
canvas->save();
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
- // Rotation messes up the GPU batching because of the clip below. We don't notice
- // that the rect is inside the clip so the clip changes interrupt batching.
+ // Uncomment to test rotated rect draw combining.
if (false) {
SkMatrix rotate;
rotate.setRotate(fRandom.nextUScalar1() * 360,
@@ -54,7 +53,7 @@ protected:
canvas->concat(rotate);
}
SkRect clipRect = rect;
- // This clip will always contain the entire rect. It's here to give the GPU batching
+ // This clip will always contain the entire rect. It's here to give the GPU op combining
// code a little more challenge.
clipRect.outset(10, 10);
canvas->clipRect(clipRect);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f1a080f6c4..8cbe7011c6 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -94,9 +94,9 @@ void GrContext::initCommon(const GrContextOptions& options) {
fDidTestPMConversions = false;
GrRenderTargetOpList::Options rtOpListOptions;
- rtOpListOptions.fClipBatchToBounds = options.fClipBatchToBounds;
- rtOpListOptions.fMaxBatchLookback = options.fMaxBatchLookback;
- rtOpListOptions.fMaxBatchLookahead = options.fMaxBatchLookahead;
+ rtOpListOptions.fClipDrawOpsToBounds = options.fClipDrawOpsToBounds;
+ rtOpListOptions.fMaxOpCombineLookback = options.fMaxOpCombineLookback;
+ rtOpListOptions.fMaxOpCombineLookahead = options.fMaxOpCombineLookahead;
GrPathRendererChain::Options prcOptions;
prcOptions.fDisableDistanceFieldRenderer = options.fDisableDistanceFieldPaths;
prcOptions.fAllowPathMaskCaching = options.fAllowPathMaskCaching;
diff --git a/src/gpu/GrDefaultGeoProcFactory.h b/src/gpu/GrDefaultGeoProcFactory.h
index 022930b659..688fcc99c7 100644
--- a/src/gpu/GrDefaultGeoProcFactory.h
+++ b/src/gpu/GrDefaultGeoProcFactory.h
@@ -12,9 +12,7 @@
/*
* A factory for creating default Geometry Processors which simply multiply position by the uniform
- * view matrix and wire through color, coverage, UV coords if requested. Right now this is only
- * used in the creation of optimized draw states because adding default GPs to the drawstate can
- * interfere with batching due to updating the drawstate.
+ * view matrix and wire through color, coverage, UV coords if requested.
*/
namespace GrDefaultGeoProcFactory {
// Structs for adding vertex attributes
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 9cbdbbe93a..515e26e92b 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -83,8 +83,8 @@ void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) {
fOpLists[i]->prepareOps(&fFlushState);
}
- // Enable this to print out verbose batching information
#if 0
+ // Enable this to print out verbose GrOp information
for (int i = 0; i < fOpLists.count(); ++i) {
SkDEBUGCODE(fOpLists[i]->dump();)
}
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index bc6f6ebbe4..2711b9a608 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -64,7 +64,6 @@ protected:
* 1) LocalCoordTransform * Position - in Shader
* 2) LocalCoordTransform * ExplicitLocalCoords- in Shader
* 3) A transformation on the CPU uploaded via vertex attribute
- * TODO make this GrBatches responsibility
*/
enum LocalCoordsType {
kUnused_LocalCoordsType,
diff --git a/src/gpu/GrGpuCommandBuffer.h b/src/gpu/GrGpuCommandBuffer.h
index 879de49d84..332b0e54cd 100644
--- a/src/gpu/GrGpuCommandBuffer.h
+++ b/src/gpu/GrGpuCommandBuffer.h
@@ -24,7 +24,7 @@ struct SkRect;
/**
* The GrGpuCommandBuffer is a series of commands (draws, clears, and discards), which all target
* the same render target. It is possible that these commands execute immediately (GL), or get
- * buffered up for later execution (Vulkan). GrBatches will execute their draw commands into a
+ * buffered up for later execution (Vulkan). GrOps will execute their draw commands into a
* GrGpuCommandBuffer.
*
* Ideally we'd know the GrRenderTarget, or at least its properties when the GrGpuCommandBuffer, is
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index 16d3968ea6..ed77c3b468 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrBatchBuffer_DEFINED
-#define GrBatchBuffer_DEFINED
+#ifndef GrOpFlushState_DEFINED
+#define GrOpFlushState_DEFINED
#include "GrBufferAllocPool.h"
#include "GrGpu.h"
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index e95c7c22ae..e49dad4cf3 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -96,9 +96,9 @@ public:
static bool AreEqual(const GrPipeline& a, const GrPipeline& b);
/**
- * Allows a GrOp subclass to determine whether two GrBatches can combine. This is a stricter
- * test than isEqual because it also considers blend barriers when the two batches' bounds
- * overlap
+ * Allows a GrOp subclass to determine whether two GrOp instances can combine. This is a
+ * stricter test than isEqual because it also considers blend barriers when the two ops'
+ * bounds overlap
*/
static bool CanCombine(const GrPipeline& a, const SkRect& aBounds,
const GrPipeline& b, const SkRect& bBounds,
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index f5f159f85b..1bc9002c70 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -292,7 +292,7 @@ public:
///////////////////////////////////////////////////////////////////////////
- bool usePLSDstRead(const GrDrawOp* batch) const;
+ bool usePLSDstRead(const GrDrawOp*) const;
private:
// Some of the auto restore objects assume that no effects are removed during their lifetime.
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index 4cc1112820..ed2b2e3a0e 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -18,7 +18,7 @@
* responsible for providing a color and coverage input into the Ganesh rendering pipeline. Through
* optimization, Ganesh may decide a different color, no color, and / or no coverage are required
* from the GrPrimitiveProcessor, so the GrPrimitiveProcessor must be able to support this
- * functionality. We also use the GrPrimitiveProcessor to make batching decisions.
+ * functionality.
*
* There are two feedback loops between the GrFragmentProcessors, the GrXferProcessor, and the
* GrPrimitiveProcessor. These loops run on the CPU and compute any invariant components which
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 4eeef5728f..0d380a176a 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -42,9 +42,9 @@ using gr_instanced::InstancedRendering;
////////////////////////////////////////////////////////////////////////////////
-// Experimentally we have found that most batching occurs within the first 10 comparisons.
-static const int kDefaultMaxBatchLookback = 10;
-static const int kDefaultMaxBatchLookahead = 10;
+// Experimentally we have found that most combining occurs within the first 10 comparisons.
+static const int kDefaultMaxOpLookback = 10;
+static const int kDefaultMaxOpLookahead = 10;
GrRenderTargetOpList::GrRenderTargetOpList(GrRenderTargetProxy* rtp, GrGpu* gpu,
GrResourceProvider* resourceProvider,
@@ -57,11 +57,11 @@ GrRenderTargetOpList::GrRenderTargetOpList(GrRenderTargetProxy* rtp, GrGpu* gpu,
// TODO: Stop extracting the context (currently needed by GrClip)
fContext = fGpu->getContext();
- fClipOpToBounds = options.fClipBatchToBounds;
- fMaxOpLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
- options.fMaxBatchLookback;
- fMaxOpLookahead = (options.fMaxBatchLookahead < 0) ? kDefaultMaxBatchLookahead :
- options.fMaxBatchLookahead;
+ fClipOpToBounds = options.fClipDrawOpsToBounds;
+ fMaxOpLookback = (options.fMaxOpCombineLookback < 0) ? kDefaultMaxOpLookback
+ : options.fMaxOpCombineLookback;
+ fMaxOpLookahead = (options.fMaxOpCombineLookahead < 0) ? kDefaultMaxOpLookahead
+ : options.fMaxOpCombineLookahead;
if (GrCaps::InstancedSupport::kNone != this->caps()->instancedSupport()) {
fInstancedRendering.reset(fGpu->createInstancedRendering());
@@ -98,9 +98,9 @@ void GrRenderTargetOpList::dump() const {
void GrRenderTargetOpList::setupDstTexture(GrRenderTarget* rt,
const GrClip& clip,
- const SkRect& batchBounds,
+ const SkRect& opBounds,
GrXferProcessor::DstTexture* dstTexture) {
- SkRect bounds = batchBounds;
+ SkRect bounds = opBounds;
bounds.outset(0.5f, 0.5f);
if (this->caps()->textureBarrierSupport()) {
@@ -235,10 +235,10 @@ void GrRenderTargetOpList::freeGpuResources() {
}
}
-static void batch_bounds(SkRect* bounds, const GrOp* batch) {
- *bounds = batch->bounds();
- if (batch->hasZeroArea()) {
- if (batch->hasAABloat()) {
+static void op_bounds(SkRect* bounds, const GrOp* op) {
+ *bounds = op->bounds();
+ if (op->hasZeroArea()) {
+ if (op->hasAABloat()) {
bounds->outset(0.5f, 0.5f);
} else {
// We don't know which way the particular GPU will snap lines or points at integer
@@ -267,7 +267,7 @@ void GrRenderTargetOpList::addDrawOp(const GrPipelineBuilder& pipelineBuilder,
sk_sp<GrDrawOp> op) {
// Setup clip
SkRect bounds;
- batch_bounds(&bounds, op.get());
+ op_bounds(&bounds, op.get());
GrAppliedClip appliedClip(bounds);
if (!clip.apply(fContext, renderTargetContext, pipelineBuilder.isHWAntialias(),
pipelineBuilder.hasUserStencilSettings(), &appliedClip)) {
@@ -554,7 +554,7 @@ void GrRenderTargetOpList::forwardCombine() {
}
++j;
if (j > maxCandidateIdx) {
- GrOP_INFO("\t\tReached max lookahead or end of batch array %d\n", i);
+ GrOP_INFO("\t\tReached max lookahead or end of op array %d\n", i);
break;
}
}
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 5b2e5e1098..a2b323f118 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -41,13 +41,9 @@ class GrRenderTargetOpList final : public GrOpList {
public:
/** Options for GrRenderTargetOpList behavior. */
struct Options {
- Options ()
- : fClipBatchToBounds(false)
- , fMaxBatchLookback(-1)
- , fMaxBatchLookahead(-1) {}
- bool fClipBatchToBounds;
- int fMaxBatchLookback;
- int fMaxBatchLookahead;
+ bool fClipDrawOpsToBounds = false;
+ int fMaxOpCombineLookback = -1;
+ int fMaxOpCombineLookahead = -1;
};
GrRenderTargetOpList(GrRenderTargetProxy*, GrGpu*, GrResourceProvider*,
@@ -150,7 +146,7 @@ private:
// a texture copy could not be made.
void setupDstTexture(GrRenderTarget*,
const GrClip&,
- const SkRect& drawOpBounds,
+ const SkRect& opBounds,
GrXferProcessor::DstTexture*);
// Used only via GrRenderTargetContextPriv.
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index e18718e446..d74807a7e7 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -33,7 +33,7 @@ const GrBuffer* GrResourceProvider::createInstancedIndexBuffer(const uint16_t* p
const GrUniqueKey& key) {
size_t bufferSize = patternSize * reps * sizeof(uint16_t);
- // This is typically used in GrBatchs, so we assume kNoPendingIO.
+ // This is typically used in GrMeshDrawOps, so we assume kNoPendingIO.
GrBuffer* buffer = this->createBuffer(bufferSize, kIndex_GrBufferType, kStatic_GrAccessPattern,
kNoPendingIO_Flag);
if (!buffer) {
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8adc76e2eb..b08224135b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -666,8 +666,8 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
// Path-based stroking looks better for thin rects
SkScalar strokeWidth = draw.fMatrix->getMaxScale() * paint.getStrokeWidth();
if (strokeWidth >= 1.0f) {
- // Round capping support is currently disabled b.c. it would require
- // a RRect batch that takes a localMatrix.
+ // Round capping support is currently disabled b.c. it would require a RRect
+ // GrDrawOp that takes a localMatrix.
this->drawStrokedLine(points, draw, paint);
return;
}
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 7dc08931b6..9556146018 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -152,10 +152,10 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
const SkMatrix& srcToDstMatrix,
const GrClip& clip,
const SkPaint& paint) {
- // Specifying the texture coords as local coordinates is an attempt to enable more batching
- // by not baking anything about the srcRect, dstRect, or viewMatrix, into the texture FP. In
- // the future this should be an opaque optimization enabled by the combination of batch/GP and
- // FP.
+ // Specifying the texture coords as local coordinates is an attempt to enable more GrDrawOp
+ // combining by not baking anything about the srcRect, dstRect, or viewMatrix, into the texture
+ // FP. In the future this should be an opaque optimization enabled by the combination of
+ // GrDrawOp/GP and FP.
const SkMaskFilter* mf = paint.getMaskFilter();
// The shader expects proper local coords, so we can't replace local coords with texture coords
// if the shader will be used. If we have a mask filter we will change the underlying geometry
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 5a0864e8cf..d3adc28d4c 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -436,10 +436,10 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
// On many GPUs, map memory is very expensive, so we effectively disable it here by setting the
// threshold to the maximum unless the client gives us a hint that map memory is cheap.
if (fBufferMapThreshold < 0) {
- // We think mapping on Chromium will be cheaper once we know ahead of time how much space
- // we will use for all GrBatchs. Right now we might wind up mapping a large buffer and using
- // a small subset.
#if 0
+ // We think mapping on Chromium will be cheaper once we know ahead of time how much space
+ // we will use for all GrMeshDrawOps. Right now we might wind up mapping a large buffer and
+ // using a small subset.
fBufferMapThreshold = kChromium_GrGLDriver == ctxInfo.driver() ? 0 : SK_MaxS32;
#else
fBufferMapThreshold = SK_MaxS32;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 80c7f612a4..577aca844f 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -2810,7 +2810,7 @@ void GrGLGpu::draw(const GrPipeline& pipeline,
sizeof(uint16_t) * nonInstMesh->startIndex());
// info.startVertex() was accounted for by setupGeometry.
if (this->glCaps().drawRangeElementsSupport()) {
- // We assume here that the batch that generated the mesh used the full
+ // We assume here that the GrMeshDrawOps that generated the mesh used the full
// 0..vertexCount()-1 range.
int start = 0;
int end = nonInstMesh->vertexCount() - 1;
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index bd05d441d8..c4c9170bde 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -131,9 +131,9 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) const {
size_t byteCount;
void* blobVertices;
int subRunGlyphCount;
- blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun, &glyphCache,
- vertexStride, args.fViewMatrix, args.fX, args.fY, args.fColor,
- &blobVertices, &byteCount, &subRunGlyphCount);
+ blob->regenInOp(target, fFontCache, &helper, args.fRun, args.fSubRun, &glyphCache,
+ vertexStride, args.fViewMatrix, args.fX, args.fY, args.fColor,
+ &blobVertices, &byteCount, &subRunGlyphCount);
// now copy all vertices
memcpy(currVertex, blobVertices, byteCount);
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index bf42d5dcf7..9aca37a436 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -268,7 +268,7 @@ inline sk_sp<GrDrawOp> GrAtlasTextBlob::makeOp(
subRunColor = color;
}
- sk_sp<GrAtlasTextOp> batch;
+ sk_sp<GrAtlasTextOp> op;
if (info.drawAsDistanceFields()) {
SkColor filteredColor;
SkColorFilter* colorFilter = skPaint.getColorFilter();
@@ -278,13 +278,13 @@ inline sk_sp<GrDrawOp> GrAtlasTextBlob::makeOp(
filteredColor = skPaint.getColor();
}
bool useBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
- batch = GrAtlasTextOp::MakeDistanceField(glyphCount, cache, distanceAdjustTable,
- useGammaCorrectDistanceTable, filteredColor,
- info.hasUseLCDText(), useBGR);
+ op = GrAtlasTextOp::MakeDistanceField(glyphCount, cache, distanceAdjustTable,
+ useGammaCorrectDistanceTable, filteredColor,
+ info.hasUseLCDText(), useBGR);
} else {
- batch = GrAtlasTextOp::MakeBitmap(format, glyphCount, cache);
+ op = GrAtlasTextOp::MakeBitmap(format, glyphCount, cache);
}
- GrAtlasTextOp::Geometry& geometry = batch->geometry();
+ GrAtlasTextOp::Geometry& geometry = op->geometry();
geometry.fViewMatrix = viewMatrix;
geometry.fBlob = SkRef(this);
geometry.fRun = run;
@@ -292,9 +292,9 @@ inline sk_sp<GrDrawOp> GrAtlasTextBlob::makeOp(
geometry.fColor = subRunColor;
geometry.fX = x;
geometry.fY = y;
- batch->init();
+ op->init();
- return std::move(batch);
+ return std::move(op);
}
inline
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 0028cc1f98..9b3f59c834 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -260,14 +260,14 @@ public:
}
/**
- * Consecutive calls to regenInBatch often use the same SkGlyphCache. If the same instance of
- * SkAutoGlyphCache is passed to multiple calls of regenInBatch then it can save the cost of
+ * Consecutive calls to regenInOp often use the same SkGlyphCache. If the same instance of
+ * SkAutoGlyphCache is passed to multiple calls of regenInOp then it can save the cost of
* multiple detach/attach operations of SkGlyphCache.
*/
- void regenInBatch(GrDrawOp::Target* target, GrAtlasGlyphCache* fontCache,
- GrBlobRegenHelper *helper, int run, int subRun, SkAutoGlyphCache*,
- size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
- GrColor color, void** vertices, size_t* byteCount, int* glyphCount);
+ void regenInOp(GrDrawOp::Target* target, GrAtlasGlyphCache* fontCache,
+ GrBlobRegenHelper* helper, int run, int subRun, SkAutoGlyphCache*,
+ size_t vertexStride, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
+ GrColor color, void** vertices, size_t* byteCount, int* glyphCount);
const Key& key() const { return fKey; }
diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInOp.cpp
index 9a37e42bf9..3150988fdb 100644
--- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp
+++ b/src/gpu/text/GrAtlasTextBlob_regenInOp.cpp
@@ -241,13 +241,13 @@ enum RegenMask {
#define REGEN_ARGS target, fontCache, helper, &run, &info, lazyCache, \
*glyphCount, vertexStride, color, transX, transY
-void GrAtlasTextBlob::regenInBatch(GrDrawOp::Target* target,
- GrAtlasGlyphCache* fontCache,
- GrBlobRegenHelper *helper,
- int runIndex, int subRunIndex, SkAutoGlyphCache* lazyCache,
- size_t vertexStride, const SkMatrix& viewMatrix,
- SkScalar x, SkScalar y, GrColor color,
- void** vertices, size_t* byteCount, int* glyphCount) {
+void GrAtlasTextBlob::regenInOp(GrDrawOp::Target* target,
+ GrAtlasGlyphCache* fontCache,
+ GrBlobRegenHelper* helper,
+ int runIndex, int subRunIndex, SkAutoGlyphCache* lazyCache,
+ size_t vertexStride, const SkMatrix& viewMatrix,
+ SkScalar x, SkScalar y, GrColor color,
+ void** vertices, size_t* byteCount, int* glyphCount) {
Run& run = fRuns[runIndex];
Run::SubRunInfo& info = run.fSubRunInfo[subRunIndex];
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index e1a3675d40..3c155e3290 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -417,8 +417,8 @@ DRAW_OP_TEST_DEFINE(TextBlobOp) {
SkScalar x = SkIntToScalar(xInt);
SkScalar y = SkIntToScalar(yInt);
- // right now we don't handle textblobs, nor do we handle drawPosText. Since we only
- // intend to test the batch with this unit test, that is okay.
+ // right now we don't handle textblobs, nor do we handle drawPosText. Since we only intend to
+ // test the text op with this unit test, that is okay.
sk_sp<GrAtlasTextBlob> blob(GrAtlasTextContext::CreateDrawTextBlob(
context->getTextBlobCache(), context->getAtlasGlyphCache(),
*context->caps()->shaderCaps(), grPaint, skPaint,
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index ed77e5cb3d..e3ad1a7b3e 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -629,7 +629,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
// the entire dst. Realistically this is a moot point, because any context that supports
// NV_path_rendering will also support NV_blend_equation_advanced.
// For clipping we'll just skip any optimizations based on the bounds. This does, however,
- // hurt batching.
+ // hurt GrOp combining.
const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(),
renderTargetContext->height());
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index d43e65ff0f..3530b88cea 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -60,7 +60,7 @@ static bool reset_rtc(sk_sp<GrRenderTargetContext>* rtc, GrContext* context, int
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 e1910f4ca7..ce89793347 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1094,7 +1094,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
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 0c7c142151..9cb2f8a6a8 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 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
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 77ec2db0df..c285721959 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -102,7 +102,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
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();