Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: src/gpu/effects/GrInstanceProcessor.h

Issue 1897203002: Implement instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_requireHWAA
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrInstanceProcessor_DEFINED
9 #define GrInstanceProcessor_DEFINED
10
11 #include "GrBufferAccess.h"
12 #include "GrGeometryProcessor.h"
13 #include "GrInstancedRenderingTypes.h"
14
15 /**
16 * This class provides a GP implementation that uses instanced rendering. Is sen ds geometry in as
17 * basic, pre-baked canonical shapes, and uses instanced vertex attribs to contr ol how these shapes
18 * are transformed and drawn. MSAA is accomplished with the sample mask rather t han finely
19 * tesselated geometry.
20 */
21 class GrInstanceProcessor : public GrGeometryProcessor, private GrInstancedRende ringTypes {
22 public:
23 static uint32_t GetSupportedAAModes(const GrGLSLCaps&, const GrCaps&);
24
25 GrInstanceProcessor(BatchTracker, GrBuffer* paramsBuffer, AntialiasMode, boo l canDiscard);
26
27 const char* name() const override { return "Instance Processor"; }
28 BatchTracker tracker() const { return fTracker; }
29 AntialiasMode antialiasMode() const { return fAntialiasMode; }
30 bool canDiscard() const { return fCanDiscard; }
31
32 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override;
33 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de;
34
35 /**
36 * Returns a buffer of ShapeVertex that defines the canonical instanced geom etry.
37 */
38 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateVertexBuffer(GrGpu* );
39
40 /**
41 * Returns a buffer of 8-bit indices for the canonical instanced geometry. T he client can call
42 * GetIndexRangeForXXX to know which indices to use for a specific shape.
43 */
44 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateIndex8Buffer(GrGpu* );
45
46 static void GetIndexRangeForRect(AntialiasMode, uint32_t* firstIndex, uint32 _t* count);
47 static void GetIndexRangeForOval(AntialiasMode, const SkRect& devBounds, uin t32_t* firstIndex,
48 uint32_t* count);
49 static void GetIndexRangeForRRect(AntialiasMode, uint32_t* firstIndex, uint3 2_t* count);
50
51 private:
52 const BatchTracker fTracker;
53 const AntialiasMode fAntialiasMode;
54 const bool fCanDiscard;
55 GrBufferAccess fParamsAccess;
56
57 typedef GrGeometryProcessor INHERITED;
58 };
59
60 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698