OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2014 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 GrDefaultGeoProcFactory_DEFINED | |
9 #define GrDefaultGeoProcFactory_DEFINED | |
10 | |
11 #include "GrGeometryProcessor.h" | |
12 | |
13 class GrDrawState; | |
14 | |
15 /* | |
16 * A factory for creating default Geometry Processors which simply multiply posi
tion by the uniform | |
17 * view matrix and wire through color, coverage, UV coords if requested. Right
now this is only | |
18 * used in the creation of optimized draw states because adding default GPs to t
he drawstate can | |
19 * interfere with batching due to updating the drawstate. | |
20 * TODO When we track geometry state separately from the draw state, we should b
e able use a default | |
21 * GP with every draw call | |
22 */ | |
23 class GrDefaultGeoProcFactory { | |
24 public: | |
25 // Structs for adding vertex attributes | |
26 struct PositionAttr { | |
27 SkPoint fPosition; | |
28 }; | |
29 | |
30 struct PositionCoverageAttr { | |
31 SkPoint fPosition; | |
32 GrColor fCoverage; | |
33 }; | |
34 | |
35 struct PositionColorAttr { | |
36 SkPoint fPosition; | |
37 SkColor fColor; | |
38 }; | |
39 | |
40 struct PositionColorCoverageAttr { | |
41 SkPoint fPosition; | |
42 SkColor fColor; | |
43 GrColor fCoverage; | |
44 }; | |
45 | |
46 struct PositionLocalCoordAttr { | |
47 SkPoint fPosition; | |
48 SkPoint fLocalCoord; | |
49 }; | |
50 | |
51 struct PositionLocalCoordCoverageAttr { | |
52 SkPoint fPosition; | |
53 SkPoint fLocalCoord; | |
54 GrColor fCoverage; | |
55 }; | |
56 | |
57 struct PositionColorLocalCoordAttr { | |
58 SkPoint fPosition; | |
59 GrColor fColor; | |
60 SkPoint fLocalCoord; | |
61 }; | |
62 | |
63 struct PositionColorLocalCoordCoverage { | |
64 SkPoint fPosition; | |
65 GrColor fColor; | |
66 SkPoint fLocalCoord; | |
67 GrColor fCoverage; | |
68 }; | |
69 | |
70 enum GPType { | |
71 kPosition_GPType = 0x0, // we ALWAYS have position | |
72 kColor_GPType = 0x01, | |
73 kLocalCoord_GPType = 0x02, | |
74 kCoverage_GPType= 0x04, | |
75 kLastGPType = kCoverage_GPType | |
76 }; | |
77 | |
78 // YOU MUST UNREF | |
79 static const GrGeometryProcessor* CreateAndSetAttribs(GrDrawState*, uint32_t
GPTypeFlags); | |
80 static const GrGeometryProcessor* Create(); | |
81 }; | |
82 | |
83 #endif | |
OLD | NEW |