aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.h
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-07-07 08:49:11 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-07 08:49:11 -0700
commita7f29640f6ab4eb50962a9d9f12d01ac2ce8b471 (patch)
treeb2ab8bb78abede727cf680cfeca76e385bd7205b /src/gpu/GrDrawTarget.h
parentd5f6e9a759891473b8211efb90f665b14a85b830 (diff)
Begin instanced rendering for simple shapes
Adds a module that performs instanced rendering and starts using it for a select subset of draws on Mac GL platforms. The instance processor can currently handle rects, ovals, round rects, and double round rects. It can generalize shapes as round rects in order to improve batching. The instance processor also employs new drawing algorithms, irrespective of instanced rendering, that improve GPU-side performance (e.g. sample mask, different triangle layouts, etc.). This change only scratches the surface of instanced rendering. The majority of draws still only have one instance. Future work may include: * Passing coord transforms through the texel buffer. * Sending FP uniforms through instanced vertex attribs. * Using instanced rendering for more draws (stencil writes, drawAtlas, etc.). * Adding more shapes to the instance processor’s repertoire. * Batching draws that have mismatched scissors (analyzing draw bounds, inserting clip planes, etc.). * Bindless textures. * Uber shaders. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2066993003 Committed: https://skia.googlesource.com/skia/+/42eafa4bc00354b132ad114d22ed6b95d8849891 Review-Url: https://codereview.chromium.org/2066993003
Diffstat (limited to 'src/gpu/GrDrawTarget.h')
-rw-r--r--src/gpu/GrDrawTarget.h33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 64c8a3345c..2a5bbde1a3 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -144,6 +144,11 @@ public:
const SkIRect& srcRect,
const SkIPoint& dstPoint);
+ /**
+ * Gets the shape rendering object if it is supported on this platform.
+ */
+ gr_instanced::InstancedRendering* instancedRendering() const { return fInstancedRendering; }
+
private:
friend class GrDrawingManager; // for resetFlag & TopoSortTraits
friend class GrDrawContextPriv; // for clearStencilClip
@@ -209,24 +214,26 @@ private:
// Used only by drawContextPriv.
void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*);
- SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches;
+ SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches;
// The context is only in service of the clip mask manager, remove once CMM doesn't need this.
- GrContext* fContext;
- GrGpu* fGpu;
- GrResourceProvider* fResourceProvider;
- GrAuditTrail* fAuditTrail;
+ GrContext* fContext;
+ GrGpu* fGpu;
+ GrResourceProvider* fResourceProvider;
+ GrAuditTrail* fAuditTrail;
- SkDEBUGCODE(int fDebugID;)
- uint32_t fFlags;
+ SkDEBUGCODE(int fDebugID;)
+ uint32_t fFlags;
// 'this' drawTarget relies on the output of the drawTargets in 'fDependencies'
- SkTDArray<GrDrawTarget*> fDependencies;
- GrRenderTarget* fRenderTarget;
+ SkTDArray<GrDrawTarget*> fDependencies;
+ GrRenderTarget* fRenderTarget;
+
+ bool fClipBatchToBounds;
+ bool fDrawBatchBounds;
+ int fMaxBatchLookback;
+ int fMaxBatchLookahead;
- bool fClipBatchToBounds;
- bool fDrawBatchBounds;
- int fMaxBatchLookback;
- int fMaxBatchLookahead;
+ SkAutoTDelete<gr_instanced::InstancedRendering> fInstancedRendering;
typedef SkRefCnt INHERITED;
};