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

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

Issue 1306803003: Revert of Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrProcOptInfo.h" 8 #include "GrProcOptInfo.h"
9 9
10 #include "GrGeometryProcessor.h" 10 #include "GrGeometryProcessor.h"
11 11
12 #include "batches/GrDrawBatch.h" 12 #include "batches/GrDrawBatch.h"
13 13
14 void GrProcOptInfo::calcColorWithBatch(const GrDrawBatch* batch, 14 void GrProcOptInfo::calcColorWithBatch(const GrDrawBatch* batch,
15 const GrFragmentProcessor* const processo rs[], 15 const GrFragmentStage* stages,
16 int cnt) { 16 int stageCount) {
17 GrInitInvariantOutput out; 17 GrInitInvariantOutput out;
18 batch->getInvariantOutputColor(&out); 18 batch->getInvariantOutputColor(&out);
19 fInOut.reset(out); 19 fInOut.reset(out);
20 this->internalCalc(processors, cnt, batch->willReadFragmentPosition()); 20 this->internalCalc(stages, stageCount, batch->willReadFragmentPosition());
21 } 21 }
22 22
23 void GrProcOptInfo::calcCoverageWithBatch(const GrDrawBatch* batch, 23 void GrProcOptInfo::calcCoverageWithBatch(const GrDrawBatch* batch,
24 const GrFragmentProcessor* const proce ssors[], 24 const GrFragmentStage* stages,
25 int cnt) { 25 int stageCount) {
26 GrInitInvariantOutput out; 26 GrInitInvariantOutput out;
27 batch->getInvariantOutputCoverage(&out); 27 batch->getInvariantOutputCoverage(&out);
28 fInOut.reset(out); 28 fInOut.reset(out);
29 this->internalCalc(processors, cnt, batch->willReadFragmentPosition()); 29 this->internalCalc(stages, stageCount, batch->willReadFragmentPosition());
30 } 30 }
31 31
32 void GrProcOptInfo::calcColorWithPrimProc(const GrPrimitiveProcessor* primProc, 32 void GrProcOptInfo::calcColorWithPrimProc(const GrPrimitiveProcessor* primProc,
33 const GrFragmentProcessor * const proc essors[], 33 const GrFragmentStage* stages,
34 int cnt) { 34 int stageCount) {
35 GrInitInvariantOutput out; 35 GrInitInvariantOutput out;
36 primProc->getInvariantOutputColor(&out); 36 primProc->getInvariantOutputColor(&out);
37 fInOut.reset(out); 37 fInOut.reset(out);
38 this->internalCalc(processors, cnt, primProc->willReadFragmentPosition()); 38 this->internalCalc(stages, stageCount, primProc->willReadFragmentPosition()) ;
39 } 39 }
40 40
41 void GrProcOptInfo::calcCoverageWithPrimProc(const GrPrimitiveProcessor* primPro c, 41 void GrProcOptInfo::calcCoverageWithPrimProc(const GrPrimitiveProcessor* primPro c,
42 const GrFragmentProcessor * const p rocessors[], 42 const GrFragmentStage* stages,
43 int cnt) { 43 int stageCount) {
44 GrInitInvariantOutput out; 44 GrInitInvariantOutput out;
45 primProc->getInvariantOutputCoverage(&out); 45 primProc->getInvariantOutputCoverage(&out);
46 fInOut.reset(out); 46 fInOut.reset(out);
47 this->internalCalc(processors, cnt, primProc->willReadFragmentPosition()); 47 this->internalCalc(stages, stageCount, primProc->willReadFragmentPosition()) ;
48 } 48 }
49 49
50 void GrProcOptInfo::calcWithInitialValues(const GrFragmentProcessor * const proc essors[], 50 void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages,
51 int cnt, 51 int stageCount,
52 GrColor startColor, 52 GrColor startColor,
53 GrColorComponentFlags flags, 53 GrColorComponentFlags flags,
54 bool areCoverageStages) { 54 bool areCoverageStages) {
55 GrInitInvariantOutput out; 55 GrInitInvariantOutput out;
56 out.fIsSingleComponent = areCoverageStages; 56 out.fIsSingleComponent = areCoverageStages;
57 out.fColor = startColor; 57 out.fColor = startColor;
58 out.fValidFlags = flags; 58 out.fValidFlags = flags;
59 fInOut.reset(out); 59 fInOut.reset(out);
60 this->internalCalc(processors, cnt, false); 60 this->internalCalc(stages, stageCount, false);
61 } 61 }
62 62
63 void GrProcOptInfo::internalCalc(const GrFragmentProcessor* const processors[], 63 void GrProcOptInfo::internalCalc(const GrFragmentStage* stages,
64 int cnt, 64 int stageCount,
65 bool initWillReadFragmentPosition) { 65 bool initWillReadFragmentPosition) {
66 fFirstEffectiveProcessorIndex = 0; 66 fFirstEffectStageIndex = 0;
67 fInputColorIsUsed = true; 67 fInputColorIsUsed = true;
68 fInputColor = fInOut.color(); 68 fInputColor = fInOut.color();
69 fReadsFragPosition = initWillReadFragmentPosition; 69 fReadsFragPosition = initWillReadFragmentPosition;
70 70
71 for (int i = 0; i < cnt; ++i) { 71 for (int i = 0; i < stageCount; ++i) {
72 const GrFragmentProcessor* processor = processors[i]; 72 const GrFragmentProcessor* processor = stages[i].processor();
73 fInOut.resetWillUseInputColor(); 73 fInOut.resetWillUseInputColor();
74 processor->computeInvariantOutput(&fInOut); 74 processor->computeInvariantOutput(&fInOut);
75 SkDEBUGCODE(fInOut.validate()); 75 SkDEBUGCODE(fInOut.validate());
76 if (!fInOut.willUseInputColor()) { 76 if (!fInOut.willUseInputColor()) {
77 fFirstEffectiveProcessorIndex = i; 77 fFirstEffectStageIndex = i;
78 fInputColorIsUsed = false; 78 fInputColorIsUsed = false;
79 // Reset these since we don't care if previous stages read these val ues 79 // Reset these since we don't care if previous stages read these val ues
80 fReadsFragPosition = initWillReadFragmentPosition; 80 fReadsFragPosition = initWillReadFragmentPosition;
81 } 81 }
82 if (processor->willReadFragmentPosition()) { 82 if (processor->willReadFragmentPosition()) {
83 fReadsFragPosition = true; 83 fReadsFragPosition = true;
84 } 84 }
85 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { 85 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
86 fFirstEffectiveProcessorIndex = i + 1; 86 fFirstEffectStageIndex = i + 1;
87 fInputColor = fInOut.color(); 87 fInputColor = fInOut.color();
88 fInputColorIsUsed = true; 88 fInputColorIsUsed = true;
89 // Since we are clearing all previous color stages we are in a state where we have found 89 // Since we are clearing all previous color stages we are in a state where we have found
90 // zero stages that don't multiply the inputColor. 90 // zero stages that don't multiply the inputColor.
91 fInOut.resetNonMulStageFound(); 91 fInOut.resetNonMulStageFound();
92 // Reset these since we don't care if previous stages read these val ues 92 // Reset these since we don't care if previous stages read these val ues
93 fReadsFragPosition = initWillReadFragmentPosition; 93 fReadsFragPosition = initWillReadFragmentPosition;
94 } 94 }
95 } 95 }
96 } 96 }
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698