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

Side by Side Diff: src/gpu/instanced/InstanceProcessor.h

Issue 2066993003: Begin instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rix perf regressions Created 4 years, 5 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
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.cpp ('k') | src/gpu/instanced/InstanceProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 gr_instanced_InstanceProcessor_DEFINED
9 #define gr_instanced_InstanceProcessor_DEFINED
10
11 #include "GrBufferAccess.h"
12 #include "GrGeometryProcessor.h"
13 #include "instanced/InstancedRenderingTypes.h"
14
15 namespace gr_instanced {
16
17 /**
18 * This class provides a GP implementation that uses instanced rendering. Is sen ds geometry in as
19 * basic, pre-baked canonical shapes, and uses instanced vertex attribs to contr ol how these shapes
20 * are transformed and drawn. MSAA is accomplished with the sample mask rather t han finely
21 * tesselated geometry.
22 */
23 class InstanceProcessor : public GrGeometryProcessor {
24 public:
25 static bool IsSupported(const GrGLSLCaps&, const GrCaps&, AntialiasMode* las tSupportedAAMode);
26
27 InstanceProcessor(BatchInfo, GrBuffer* paramsBuffer);
28
29 const char* name() const override { return "Instance Processor"; }
30 BatchInfo batchInfo() const { return fBatchInfo; }
31
32 void getGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override {
33 b->add32(fBatchInfo.fData);
34 }
35 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri de;
36
37 /**
38 * Returns a buffer of ShapeVertex that defines the canonical instanced geom etry.
39 */
40 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateVertexBuffer(GrGpu* );
41
42 /**
43 * Returns a buffer of 8-bit indices for the canonical instanced geometry. T he client can call
44 * GetIndexRangeForXXX to know which indices to use for a specific shape.
45 */
46 static const GrBuffer* SK_WARN_UNUSED_RESULT FindOrCreateIndex8Buffer(GrGpu* );
47
48 static IndexRange GetIndexRangeForRect(AntialiasMode);
49 static IndexRange GetIndexRangeForOval(AntialiasMode, const SkRect& devBound s);
50 static IndexRange GetIndexRangeForRRect(AntialiasMode);
51
52 static const char* GetNameOfIndexRange(IndexRange);
53
54 private:
55 const BatchInfo fBatchInfo;
56 GrBufferAccess fParamsAccess;
57
58 typedef GrGeometryProcessor INHERITED;
59 };
60
61 }
62
63 #endif
OLDNEW
« no previous file with comments | « src/gpu/instanced/GLInstancedRendering.cpp ('k') | src/gpu/instanced/InstanceProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698