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

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

Issue 759713002: Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: rebase Created 6 years 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/SkGpuDevice.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 "GrFragmentProcessor.h"
11 #include "GrFragmentStage.h"
10 #include "GrGeometryProcessor.h" 12 #include "GrGeometryProcessor.h"
11 #include "GrFragmentStage.h"
12 13
13 void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages, 14 void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages,
14 int stageCount, 15 int stageCount,
15 GrColor startColor, 16 GrColor startColor,
16 GrColorComponentFlags flags, 17 GrColorComponentFlags flags,
17 bool areCoverageStages, 18 bool areCoverageStages,
18 const GrGeometryProcessor* gp) { 19 const GrGeometryProcessor* gp) {
19 fInOut.reset(startColor, flags, areCoverageStages); 20 fInOut.reset(startColor, flags, areCoverageStages);
20 fFirstEffectStageIndex = 0; 21 fFirstEffectStageIndex = 0;
21 fInputColorIsUsed = true; 22 fInputColorIsUsed = true;
22 fInputColor = startColor; 23 fInputColor = startColor;
23 fRemoveVertexAttrib = false; 24 fRemoveVertexAttrib = false;
24 fReadsDst = false; 25 fReadsDst = false;
26 fReadsFragPosition = false;
25 27
26 if (areCoverageStages && gp) { 28 if (areCoverageStages && gp) {
27 gp->computeInvariantOutput(&fInOut); 29 gp->computeInvariantOutput(&fInOut);
28 } 30 }
29 31
30 for (int i = 0; i < stageCount; ++i) { 32 for (int i = 0; i < stageCount; ++i) {
31 const GrFragmentProcessor* processor = stages[i].getProcessor(); 33 const GrFragmentProcessor* processor = stages[i].getProcessor();
32 fInOut.resetWillUseInputColor(); 34 fInOut.resetWillUseInputColor();
33 processor->computeInvariantOutput(&fInOut); 35 processor->computeInvariantOutput(&fInOut);
34 #ifdef SK_DEBUG 36 #ifdef SK_DEBUG
35 fInOut.validate(); 37 fInOut.validate();
36 #endif 38 #endif
37 if (!fInOut.willUseInputColor()) { 39 if (!fInOut.willUseInputColor()) {
38 fFirstEffectStageIndex = i; 40 fFirstEffectStageIndex = i;
39 fInputColorIsUsed = false; 41 fInputColorIsUsed = false;
40 fReadsDst = false; // Reset this since we don't care if previous sta ges read dst 42 // Reset these since we don't care if previous stages read these val ues
43 fReadsDst = false;
44 fReadsFragPosition = false;
41 } 45 }
42 if (processor->willReadDstColor()) { 46 if (processor->willReadDstColor()) {
43 fReadsDst = true; 47 fReadsDst = true;
44 } 48 }
49 if (processor->willReadFragmentPosition()) {
50 fReadsFragPosition = true;
51 }
45 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { 52 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
46 fFirstEffectStageIndex = i + 1; 53 fFirstEffectStageIndex = i + 1;
47 fInputColor = fInOut.color(); 54 fInputColor = fInOut.color();
48 fInputColorIsUsed = true; 55 fInputColorIsUsed = true;
49 fRemoveVertexAttrib = true; 56 fRemoveVertexAttrib = true;
50 // Since we are clearing all previous color stages we are in a state where we have found 57 // Since we are clearing all previous color stages we are in a state where we have found
51 // zero stages that don't multiply the inputColor. 58 // zero stages that don't multiply the inputColor.
52 fInOut.resetNonMulStageFound(); 59 fInOut.resetNonMulStageFound();
53 fReadsDst = false; // Reset this since we don't care if previous sta ges read dst 60 // Reset these since we don't care if previous stages read these val ues
61 fReadsDst = false;
62 fReadsFragPosition = false;
54 } 63 }
55 } 64 }
56 } 65 }
66
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698