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

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

Issue 1734163002: Replace fWillReadFragmentPosition with a bitfield (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: BuiltInState -> RequiredFeatures Created 4 years, 9 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/gl/GrGLProgramDesc.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::calcWithInitialValues(const GrFragmentProcessor * const proc essors[], 14 void GrProcOptInfo::calcWithInitialValues(const GrFragmentProcessor * const proc essors[],
15 int cnt, 15 int cnt,
16 GrColor startColor, 16 GrColor startColor,
17 GrColorComponentFlags flags, 17 GrColorComponentFlags flags,
18 bool areCoverageStages, 18 bool areCoverageStages,
19 bool isLCD) { 19 bool isLCD) {
20 GrInitInvariantOutput out; 20 GrInitInvariantOutput out;
21 out.fIsSingleComponent = areCoverageStages; 21 out.fIsSingleComponent = areCoverageStages;
22 out.fColor = startColor; 22 out.fColor = startColor;
23 out.fValidFlags = flags; 23 out.fValidFlags = flags;
24 out.fIsLCDCoverage = isLCD; 24 out.fIsLCDCoverage = isLCD;
25 fInOut.reset(out); 25 fInOut.reset(out);
26 this->internalCalc(processors, cnt, false); 26 this->internalCalc(processors, cnt);
27 } 27 }
28 28
29 void GrProcOptInfo::initUsingInvariantOutput(GrInitInvariantOutput invOutput) { 29 void GrProcOptInfo::initUsingInvariantOutput(GrInitInvariantOutput invOutput) {
30 fInOut.reset(invOutput); 30 fInOut.reset(invOutput);
31 } 31 }
32 32
33 void GrProcOptInfo::completeCalculations(const GrFragmentProcessor * const proce ssors[], int cnt) { 33 void GrProcOptInfo::completeCalculations(const GrFragmentProcessor * const proce ssors[], int cnt) {
34 this->internalCalc(processors, cnt, false); 34 this->internalCalc(processors, cnt);
35 } 35 }
36 36
37 void GrProcOptInfo::internalCalc(const GrFragmentProcessor* const processors[], 37 void GrProcOptInfo::internalCalc(const GrFragmentProcessor* const processors[], int cnt) {
38 int cnt,
39 bool initWillReadFragmentPosition) {
40 fFirstEffectiveProcessorIndex = 0; 38 fFirstEffectiveProcessorIndex = 0;
41 fInputColorIsUsed = true; 39 fInputColorIsUsed = true;
42 fInputColor = fInOut.color(); 40 fInputColor = fInOut.color();
43 fReadsFragPosition = initWillReadFragmentPosition;
44 41
45 for (int i = 0; i < cnt; ++i) { 42 for (int i = 0; i < cnt; ++i) {
46 const GrFragmentProcessor* processor = processors[i]; 43 const GrFragmentProcessor* processor = processors[i];
47 fInOut.resetWillUseInputColor(); 44 fInOut.resetWillUseInputColor();
48 processor->computeInvariantOutput(&fInOut); 45 processor->computeInvariantOutput(&fInOut);
49 SkDEBUGCODE(fInOut.validate()); 46 SkDEBUGCODE(fInOut.validate());
50 if (!fInOut.willUseInputColor()) { 47 if (!fInOut.willUseInputColor()) {
51 fFirstEffectiveProcessorIndex = i; 48 fFirstEffectiveProcessorIndex = i;
52 fInputColorIsUsed = false; 49 fInputColorIsUsed = false;
53 // Reset these since we don't care if previous stages read these val ues
54 fReadsFragPosition = initWillReadFragmentPosition;
55 }
56 if (processor->willReadFragmentPosition()) {
57 fReadsFragPosition = true;
58 } 50 }
59 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { 51 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
60 fFirstEffectiveProcessorIndex = i + 1; 52 fFirstEffectiveProcessorIndex = i + 1;
61 fInputColor = fInOut.color(); 53 fInputColor = fInOut.color();
62 fInputColorIsUsed = true; 54 fInputColorIsUsed = true;
63 // Since we are clearing all previous color stages we are in a state where we have found 55 // Since we are clearing all previous color stages we are in a state where we have found
64 // zero stages that don't multiply the inputColor. 56 // zero stages that don't multiply the inputColor.
65 fInOut.resetNonMulStageFound(); 57 fInOut.resetNonMulStageFound();
66 // Reset these since we don't care if previous stages read these val ues
67 fReadsFragPosition = initWillReadFragmentPosition;
68 } 58 }
69 } 59 }
70 } 60 }
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698