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

Side by Side Diff: src/gpu/GrProcOptInfo.h

Issue 719203002: Add GrProcOptInfo class to track various output information for color and coverage stages. (Closed) Base URL: https://skia.googlesource.com/skia.git@moveIO
Patch Set: initialize values Created 6 years, 1 month 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/GrPaint.cpp ('k') | src/gpu/GrProcOptInfo.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 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 GrProcOptInfo_DEFINED
9 #define GrProcOptInfo_DEFINED
10
11 #include "GrColor.h"
12 #include "GrInvariantOutput.h"
13
14 class GrFragmentStage;
15 class GrGeometryProcessor;
16
17 /**
18 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use d to recognize
19 * optimizations related to eliminating stages and vertex attributes that aren't necessary for a
20 * draw.
21 */
22 class GrProcOptInfo {
23 public:
24 GrProcOptInfo()
25 : fInOut(0, static_cast<GrColorComponentFlags>(0), false)
26 , fFirstEffectStageIndex(0)
27 , fInputColorIsUsed(true)
28 , fInputColor(0)
29 , fRemoveVertexAttrib(false)
30 , fReadsDst(false) {}
31
32 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s tartColor,
33 GrColorComponentFlags flags, bool areCoverageStag es,
34 const GrGeometryProcessor* gp = NULL);
35
36 bool isSolidWhite() const { return fInOut.isSolidWhite(); }
37 bool isOpaque() const { return fInOut.isOpaque(); }
38
39 GrColor color() const { return fInOut.color(); }
40 uint8_t validFlags() const { return fInOut.validFlags(); }
41
42 /**
43 * Returns the index of the first effective color stage. If an intermediate stage doesn't read
44 * its input or has a known output, then we can ignore all earlier stages si nce they will not
45 * affect the final output. Thus the first effective stage index is the inde x to the first stage
46 * that will have an effect on the final output.
47 *
48 * If stages before the firstEffectiveStageIndex are removed, corresponding values from
49 * inputColorIsUsed(), inputColorToEffectiveStage(), removeVertexAttribs(), and readsDst() must
50 * be used when setting up the draw to ensure correct drawing.
51 */
52 int firstEffectiveStageIndex() const { return fFirstEffectStageIndex; }
53
54 /**
55 * True if the first effective stage reads its input, false otherwise.
56 */
57 bool inputColorIsUsed() const { return fInputColorIsUsed; }
58
59 /**
60 * If input color is used and per-vertex colors are not used, this is the in put color to the
61 * first effective stage.
62 */
63 GrColor inputColorToEffectiveStage() const { return fInputColor; }
64
65 /**
66 * Given the set of optimizations determined by GrProcOptInfo, should the ca ller remove the
67 * color/coverage vertex attribute that was input to the first stage.
68 */
69 bool removeVertexAttrib() const { return fRemoveVertexAttrib; }
70
71 /**
72 * Returns true if any of the stages preserved by GrProcOptInfo read the dst color.
73 */
74 bool readsDst() const { return fReadsDst; }
75
76 private:
77 GrInvariantOutput fInOut;
78 int fFirstEffectStageIndex;
79 bool fInputColorIsUsed;
80 GrColor fInputColor;
81 bool fRemoveVertexAttrib;
82 bool fReadsDst;
83 };
84
85 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPaint.cpp ('k') | src/gpu/GrProcOptInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698