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

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

Issue 1132373003: Add function for logging blend info on XP. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning? Created 5 years, 7 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 | « include/gpu/GrXferProcessor.h ('k') | src/gpu/effects/GrCustomXfermode.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 2015 Google Inc. 2 * Copyright 2015 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 "GrXferProcessor.h" 8 #include "GrXferProcessor.h"
9 #include "gl/GrGLCaps.h" 9 #include "gl/GrGLCaps.h"
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) { 57 if (static_cast<const GrSurface*>(rt) == this->getDstCopyTexture()) {
58 // Texture barriers are required when a shader reads and renders to the same texture. 58 // Texture barriers are required when a shader reads and renders to the same texture.
59 SkASSERT(rt); 59 SkASSERT(rt);
60 SkASSERT(caps.textureBarrierSupport()); 60 SkASSERT(caps.textureBarrierSupport());
61 *outBarrierType = kTexture_GrXferBarrierType; 61 *outBarrierType = kTexture_GrXferBarrierType;
62 return true; 62 return true;
63 } 63 }
64 return this->onWillNeedXferBarrier(rt, caps, outBarrierType); 64 return this->onWillNeedXferBarrier(rt, caps, outBarrierType);
65 } 65 }
66 66
67 #ifdef SK_DEBUG
68 static const char* equation_string(GrBlendEquation eq) {
69 switch (eq) {
70 case kAdd_GrBlendEquation:
71 return "add";
72 case kSubtract_GrBlendEquation:
73 return "subtract";
74 case kReverseSubtract_GrBlendEquation:
75 return "reverse_subtract";
76 case kScreen_GrBlendEquation:
77 return "screen";
78 case kOverlay_GrBlendEquation:
79 return "overlay";
80 case kDarken_GrBlendEquation:
81 return "darken";
82 case kLighten_GrBlendEquation:
83 return "lighten";
84 case kColorDodge_GrBlendEquation:
85 return "color_dodge";
86 case kColorBurn_GrBlendEquation:
87 return "color_burn";
88 case kHardLight_GrBlendEquation:
89 return "hard_light";
90 case kSoftLight_GrBlendEquation:
91 return "soft_light";
92 case kDifference_GrBlendEquation:
93 return "difference";
94 case kExclusion_GrBlendEquation:
95 return "exclusion";
96 case kMultiply_GrBlendEquation:
97 return "multiply";
98 case kHSLHue_GrBlendEquation:
99 return "hsl_hue";
100 case kHSLSaturation_GrBlendEquation:
101 return "hsl_saturation";
102 case kHSLColor_GrBlendEquation:
103 return "hsl_color";
104 case kHSLLuminosity_GrBlendEquation:
105 return "hsl_luminosity";
106 };
107 return "";
108 }
109
110 static const char* coeff_string(GrBlendCoeff coeff) {
111 switch (coeff) {
112 case kZero_GrBlendCoeff:
113 return "zero";
114 case kOne_GrBlendCoeff:
115 return "one";
116 case kSC_GrBlendCoeff:
117 return "src_color";
118 case kISC_GrBlendCoeff:
119 return "inv_src_color";
120 case kDC_GrBlendCoeff:
121 return "dst_color";
122 case kIDC_GrBlendCoeff:
123 return "inv_dst_color";
124 case kSA_GrBlendCoeff:
125 return "src_alpha";
126 case kISA_GrBlendCoeff:
127 return "inv_src_alpha";
128 case kDA_GrBlendCoeff:
129 return "dst_alpha";
130 case kIDA_GrBlendCoeff:
131 return "inv_dst_alpha";
132 case kConstC_GrBlendCoeff:
133 return "const_color";
134 case kIConstC_GrBlendCoeff:
135 return "inv_const_color";
136 case kConstA_GrBlendCoeff:
137 return "const_alpha";
138 case kIConstA_GrBlendCoeff:
139 return "inv_const_alpha";
140 case kS2C_GrBlendCoeff:
141 return "src2_color";
142 case kIS2C_GrBlendCoeff:
143 return "inv_src2_color";
144 case kS2A_GrBlendCoeff:
145 return "src2_alpha";
146 case kIS2A_GrBlendCoeff:
147 return "inv_src2_alpha";
148 }
149 return "";
150 }
151
152 SkString GrXferProcessor::BlendInfo::dump() const {
153 SkString out;
154 out.printf("write_color(%d) equation(%s) src_coeff(%s) dst_coeff:(%s) const( 0x%08x)",
155 fWriteColor, equation_string(fEquation), coeff_string(fSrcBlend),
156 coeff_string(fDstBlend), fBlendConstant);
157 return out;
158 }
159 #endif
160
67 /////////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////////
68 162
69 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI, 163 GrXferProcessor* GrXPFactory::createXferProcessor(const GrProcOptInfo& colorPOI,
70 const GrProcOptInfo& coverageP OI, 164 const GrProcOptInfo& coverageP OI,
71 const GrDeviceCoordTexture* ds tCopy, 165 const GrDeviceCoordTexture* ds tCopy,
72 const GrDrawTargetCaps& caps) const { 166 const GrDrawTargetCaps& caps) const {
73 #ifdef SK_DEBUG 167 #ifdef SK_DEBUG
74 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) { 168 if (this->willReadDstColor(caps, colorPOI, coveragePOI)) {
75 if (!caps.shaderCaps()->dstReadInShaderSupport()) { 169 if (!caps.shaderCaps()->dstReadInShaderSupport()) {
76 SkASSERT(dstCopy && dstCopy->texture()); 170 SkASSERT(dstCopy && dstCopy->texture());
77 } else { 171 } else {
78 SkASSERT(!dstCopy || !dstCopy->texture()); 172 SkASSERT(!dstCopy || !dstCopy->texture());
79 } 173 }
80 } else { 174 } else {
81 SkASSERT(!dstCopy || !dstCopy->texture()); 175 SkASSERT(!dstCopy || !dstCopy->texture());
82 } 176 }
83 #endif 177 #endif
84 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); 178 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy);
85 } 179 }
86 180
87 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI nfo& colorPOI, 181 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI nfo& colorPOI,
88 const GrProcOptInfo& coveragePOI) const { 182 const GrProcOptInfo& coveragePOI) const {
89 return (this->willReadDstColor(caps, colorPOI, coveragePOI) 183 return (this->willReadDstColor(caps, colorPOI, coveragePOI)
90 && !caps.shaderCaps()->dstReadInShaderSupport()); 184 && !caps.shaderCaps()->dstReadInShaderSupport());
91 } 185 }
92 186
OLDNEW
« no previous file with comments | « include/gpu/GrXferProcessor.h ('k') | src/gpu/effects/GrCustomXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698