diff options
author | 2016-07-07 08:49:11 -0700 | |
---|---|---|
committer | 2016-07-07 08:49:11 -0700 | |
commit | a7f29640f6ab4eb50962a9d9f12d01ac2ce8b471 (patch) | |
tree | b2ab8bb78abede727cf680cfeca76e385bd7205b /src/gpu/GrGpu.h | |
parent | d5f6e9a759891473b8211efb90f665b14a85b830 (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/GrGpu.h')
-rw-r--r-- | src/gpu/GrGpu.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index e7c2196c62..be8a59a738 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -39,6 +39,8 @@ class GrStencilSettings; class GrSurface; class GrTexture; +namespace gr_instanced { class InstancedRendering; } + class GrGpu : public SkRefCnt { public: /** @@ -148,6 +150,13 @@ public: const void* data = nullptr); /** + * Creates an instanced rendering object if it is supported on this platform. + */ + virtual gr_instanced::InstancedRendering* createInstancedRenderingIfSupported() { + return nullptr; + } + + /** * Resolves MSAA. */ void resolveRenderTarget(GrRenderTarget* target); @@ -591,6 +600,7 @@ private: GrContext* fContext; friend class GrPathRendering; + friend class gr_instanced::InstancedRendering; typedef SkRefCnt INHERITED; }; |