blob: 0d9e4670335eff6530770582fb5227835a803918 [file] [log] [blame]
joshualitt30ba4362014-08-21 20:18:45 -07001/*
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
Brian Salomon201cdbb2019-08-14 17:00:30 -04008#include "src/gpu/GrRenderTarget.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -05009#include "src/gpu/GrRenderTargetPriv.h"
10#include "src/gpu/GrShaderCaps.h"
11#include "src/gpu/gl/GrGLGpu.h"
12#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
13#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
14#include "src/gpu/glsl/GrGLSLUniformHandler.h"
15#include "src/gpu/glsl/GrGLSLVarying.h"
joshualitt47bb3822014-10-07 16:43:25 -070016
egdaniel138c2632016-08-17 10:59:00 -070017const char* GrGLSLFragmentShaderBuilder::kDstColorName = "_dstColor";
joshualitt30ba4362014-08-21 20:18:45 -070018
cdalton8917d622015-05-06 13:40:21 -070019static const char* specific_layout_qualifier_name(GrBlendEquation equation) {
20 SkASSERT(GrBlendEquationIsAdvanced(equation));
21
22 static const char* kLayoutQualifierNames[] = {
23 "blend_support_screen",
24 "blend_support_overlay",
25 "blend_support_darken",
26 "blend_support_lighten",
27 "blend_support_colordodge",
28 "blend_support_colorburn",
29 "blend_support_hardlight",
30 "blend_support_softlight",
31 "blend_support_difference",
32 "blend_support_exclusion",
33 "blend_support_multiply",
34 "blend_support_hsl_hue",
35 "blend_support_hsl_saturation",
36 "blend_support_hsl_color",
37 "blend_support_hsl_luminosity"
38 };
39 return kLayoutQualifierNames[equation - kFirstAdvancedGrBlendEquation];
40
Brian Salomon4dea72a2019-12-18 10:43:10 -050041 static_assert(0 == kScreen_GrBlendEquation - kFirstAdvancedGrBlendEquation);
42 static_assert(1 == kOverlay_GrBlendEquation - kFirstAdvancedGrBlendEquation);
43 static_assert(2 == kDarken_GrBlendEquation - kFirstAdvancedGrBlendEquation);
44 static_assert(3 == kLighten_GrBlendEquation - kFirstAdvancedGrBlendEquation);
45 static_assert(4 == kColorDodge_GrBlendEquation - kFirstAdvancedGrBlendEquation);
46 static_assert(5 == kColorBurn_GrBlendEquation - kFirstAdvancedGrBlendEquation);
47 static_assert(6 == kHardLight_GrBlendEquation - kFirstAdvancedGrBlendEquation);
48 static_assert(7 == kSoftLight_GrBlendEquation - kFirstAdvancedGrBlendEquation);
49 static_assert(8 == kDifference_GrBlendEquation - kFirstAdvancedGrBlendEquation);
50 static_assert(9 == kExclusion_GrBlendEquation - kFirstAdvancedGrBlendEquation);
51 static_assert(10 == kMultiply_GrBlendEquation - kFirstAdvancedGrBlendEquation);
52 static_assert(11 == kHSLHue_GrBlendEquation - kFirstAdvancedGrBlendEquation);
53 static_assert(12 == kHSLSaturation_GrBlendEquation - kFirstAdvancedGrBlendEquation);
54 static_assert(13 == kHSLColor_GrBlendEquation - kFirstAdvancedGrBlendEquation);
55 static_assert(14 == kHSLLuminosity_GrBlendEquation - kFirstAdvancedGrBlendEquation);
Mike Klein36743362018-11-06 08:23:30 -050056 // There's an illegal GrBlendEquation at the end there, hence the -1.
Brian Salomon4dea72a2019-12-18 10:43:10 -050057 static_assert(SK_ARRAY_COUNT(kLayoutQualifierNames) ==
58 kGrBlendEquationCnt - kFirstAdvancedGrBlendEquation - 1);
cdalton8917d622015-05-06 13:40:21 -070059}
60
Robert Phillips7f861922018-01-30 13:13:42 +000061uint8_t GrGLSLFragmentShaderBuilder::KeyForSurfaceOrigin(GrSurfaceOrigin origin) {
62 SkASSERT(kTopLeft_GrSurfaceOrigin == origin || kBottomLeft_GrSurfaceOrigin == origin);
63 return origin + 1;
64
Brian Salomon4dea72a2019-12-18 10:43:10 -050065 static_assert(0 == kTopLeft_GrSurfaceOrigin);
66 static_assert(1 == kBottomLeft_GrSurfaceOrigin);
Robert Phillips7f861922018-01-30 13:13:42 +000067}
68
cdalton28f45b92016-03-07 13:58:26 -080069GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program)
Chris Daltond7291ba2019-03-07 14:17:03 -070070 : GrGLSLFragmentBuilder(program) {
cdalton85285412016-02-18 12:37:07 -080071 fSubstageIndices.push_back(0);
cdalton87332102016-02-26 12:22:02 -080072}
73
bsalomon1a1aa932016-09-12 09:30:36 -070074SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords) {
Brian Salomonbf5c0c02019-11-11 14:55:28 -050075 if (!coords.getName().size()) {
76 return SkString("_coords");
77 }
Ethan Nicholas8aa45692017-09-20 11:24:15 -040078 if (kFloat3_GrSLType != coords.getType() && kHalf3_GrSLType != coords.getType()) {
79 SkASSERT(kFloat2_GrSLType == coords.getType() || kHalf2_GrSLType == coords.getType());
bsalomon1a1aa932016-09-12 09:30:36 -070080 return coords.getName();
joshualitt30ba4362014-08-21 20:18:45 -070081 }
82
bsalomon1a1aa932016-09-12 09:30:36 -070083 SkString coords2D;
84 coords2D.printf("%s_ensure2D", coords.c_str());
Ethan Nicholas8aa45692017-09-20 11:24:15 -040085 this->codeAppendf("\tfloat2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(),
bsalomon1a1aa932016-09-12 09:30:36 -070086 coords.c_str());
joshualitt30ba4362014-08-21 20:18:45 -070087 return coords2D;
88}
89
Chris Daltond7291ba2019-03-07 14:17:03 -070090const char* GrGLSLFragmentShaderBuilder::sampleOffsets() {
Robert Phillips7de13332019-10-09 15:44:54 -040091 SkASSERT(CustomFeatures::kSampleLocations & fProgramBuilder->processorFeatures());
Chris Daltond7291ba2019-03-07 14:17:03 -070092 SkDEBUGCODE(fUsedProcessorFeaturesThisStage_DebugOnly |= CustomFeatures::kSampleLocations);
93 SkDEBUGCODE(fUsedProcessorFeaturesAllStages_DebugOnly |= CustomFeatures::kSampleLocations);
94 return "_sampleOffsets";
95}
96
Chris Dalton0dffbab2019-03-27 13:08:50 -060097void GrGLSLFragmentShaderBuilder::maskOffMultisampleCoverage(
98 const char* mask, ScopeFlags scopeFlags) {
Chris Daltond31b5e72019-02-26 18:02:16 -070099 const GrShaderCaps& shaderCaps = *fProgramBuilder->shaderCaps();
Chris Dalton8a64a442019-10-29 18:54:58 -0600100 if (!shaderCaps.sampleMaskSupport()) {
Chris Daltond31b5e72019-02-26 18:02:16 -0700101 SkDEBUGFAIL("Attempted to mask sample coverage without support.");
102 return;
103 }
104 if (const char* extension = shaderCaps.sampleVariablesExtensionString()) {
105 this->addFeature(1 << kSampleVariables_GLSLPrivateFeature, extension);
106 }
107
Chris Dalton0dffbab2019-03-27 13:08:50 -0600108 if (!fHasModifiedSampleMask) {
109 fHasModifiedSampleMask = true;
110 if (ScopeFlags::kTopLevel != scopeFlags) {
Chris Daltonb0fd4b12019-10-29 13:41:22 -0600111 this->codePrependf("sk_SampleMask[0] = ~0;");
Chris Dalton0dffbab2019-03-27 13:08:50 -0600112 }
113 if (!(ScopeFlags::kInsideLoop & scopeFlags)) {
Chris Daltonb0fd4b12019-10-29 13:41:22 -0600114 this->codeAppendf("sk_SampleMask[0] = (%s);", mask);
Chris Dalton0dffbab2019-03-27 13:08:50 -0600115 return;
116 }
Chris Daltond31b5e72019-02-26 18:02:16 -0700117 }
Chris Dalton0dffbab2019-03-27 13:08:50 -0600118
Chris Daltonb0fd4b12019-10-29 13:41:22 -0600119 this->codeAppendf("sk_SampleMask[0] &= (%s);", mask);
Chris Daltond31b5e72019-02-26 18:02:16 -0700120}
121
Chris Dalton0dffbab2019-03-27 13:08:50 -0600122void GrGLSLFragmentShaderBuilder::applyFnToMultisampleMask(
123 const char* fn, const char* grad, ScopeFlags scopeFlags) {
Robert Phillips7de13332019-10-09 15:44:54 -0400124 SkASSERT(CustomFeatures::kSampleLocations & fProgramBuilder->processorFeatures());
Chris Dalton0dffbab2019-03-27 13:08:50 -0600125 SkDEBUGCODE(fUsedProcessorFeaturesThisStage_DebugOnly |= CustomFeatures::kSampleLocations);
126 SkDEBUGCODE(fUsedProcessorFeaturesAllStages_DebugOnly |= CustomFeatures::kSampleLocations);
127
128 int sampleCnt = fProgramBuilder->effectiveSampleCnt();
129 SkASSERT(sampleCnt > 1);
130
131 this->codeAppendf("{");
132
133 if (!grad) {
134 SkASSERT(fProgramBuilder->shaderCaps()->shaderDerivativeSupport());
135 // In order to use HW derivatives, our neighbors within the same primitive must also be
136 // executing the same code. A per-pixel branch makes this pre-condition impossible to
137 // fulfill.
138 SkASSERT(!(ScopeFlags::kInsidePerPixelBranch & scopeFlags));
Chris Daltonc3318f02019-07-19 14:20:53 -0600139 this->codeAppendf("float2 grad = float2(dFdx(%s), dFdy(%s));", fn, fn);
140 this->codeAppendf("float fnwidth = fwidth(%s);", fn);
Chris Dalton0dffbab2019-03-27 13:08:50 -0600141 grad = "grad";
142 } else {
143 this->codeAppendf("float fnwidth = abs(%s.x) + abs(%s.y);", grad, grad);
144 }
145
146 this->codeAppendf("int mask = 0;");
147 this->codeAppendf("if (%s*2 < fnwidth) {", fn); // Are ANY samples inside the implicit fn?
148 this->codeAppendf( "if (%s*-2 >= fnwidth) {", fn); // Are ALL samples inside the implicit?
149 this->codeAppendf( "mask = ~0;");
150 this->codeAppendf( "} else for (int i = 0; i < %i; ++i) {", sampleCnt);
151 this->codeAppendf( "float fnsample = dot(%s, _sampleOffsets[i]) + %s;", grad, fn);
152 this->codeAppendf( "if (fnsample < 0) {");
153 this->codeAppendf( "mask |= (1 << i);");
154 this->codeAppendf( "}");
155 this->codeAppendf( "}");
156 this->codeAppendf("}");
157 this->maskOffMultisampleCoverage("mask", scopeFlags);
158
159 this->codeAppendf("}");
160}
161
Ethan Nicholasc6dce5a2019-07-24 16:51:36 -0400162SkString GrGLSLFPFragmentBuilder::writeProcessorFunction(GrGLSLFragmentProcessor* fp,
163 GrGLSLFragmentProcessor::EmitArgs& args) {
164 this->onBeforeChildProcEmitCode();
165 this->nextStage();
Brian Salomon7d8b3972019-11-26 22:34:44 -0500166 if (!args.fFp.coordTransformsApplyToLocalCoords() && args.fTransformedCoords.count() > 0) {
Ethan Nicholasd4efe682019-08-29 16:10:13 -0400167 // we currently only support overriding a single coordinate pair
168 SkASSERT(args.fTransformedCoords.count() == 1);
169 const GrGLSLProgramDataManager::UniformHandle& mat =
170 args.fTransformedCoords[0].fUniformMatrix;
171 if (mat.isValid()) {
172 args.fUniformHandler->updateUniformVisibility(mat, kFragment_GrShaderFlag);
Brian Salomon7eabfe82019-12-02 14:20:20 -0500173 this->codeAppendf("_coords = (%s * float3(_coords, 1)).xy;\n",
Ethan Nicholasd4efe682019-08-29 16:10:13 -0400174 args.fTransformedCoords[0].fMatrixCode.c_str());
175 }
176 }
Ethan Nicholasc6dce5a2019-07-24 16:51:36 -0400177 this->codeAppendf("half4 %s;\n", args.fOutputColor);
178 fp->emitCode(args);
Ethan Nicholasd4efe682019-08-29 16:10:13 -0400179 this->codeAppendf("return %s;\n", args.fOutputColor);
180 GrShaderVar params[] = { GrShaderVar(args.fInputColor, kHalf4_GrSLType),
181 GrShaderVar("_coords", kFloat2_GrSLType) };
Ethan Nicholasc6dce5a2019-07-24 16:51:36 -0400182 SkString result;
183 this->emitFunction(kHalf4_GrSLType,
184 "stage",
Brian Salomon7d8b3972019-11-26 22:34:44 -0500185 args.fFp.coordTransformsApplyToLocalCoords() ? 1 : 2,
Ethan Nicholasd4efe682019-08-29 16:10:13 -0400186 params,
Ethan Nicholasc6dce5a2019-07-24 16:51:36 -0400187 this->code().c_str(),
188 &result);
189 this->deleteStage();
190 this->onAfterChildProcEmitCode();
191 return result;
192}
193
egdaniel2d721d32015-11-11 13:06:05 -0800194const char* GrGLSLFragmentShaderBuilder::dstColor() {
Chris Daltond7291ba2019-03-07 14:17:03 -0700195 SkDEBUGCODE(fHasReadDstColorThisStage_DebugOnly = true;)
joshualitt47bb3822014-10-07 16:43:25 -0700196
Brian Salomon1edc5b92016-11-29 13:43:46 -0500197 const GrShaderCaps* shaderCaps = fProgramBuilder->shaderCaps();
198 if (shaderCaps->fbFetchSupport()) {
cdaltonc08f1962016-02-12 12:14:06 -0800199 this->addFeature(1 << kFramebufferFetch_GLSLPrivateFeature,
Brian Salomon1edc5b92016-11-29 13:43:46 -0500200 shaderCaps->fbFetchExtensionString());
joshualittb4384b92014-10-21 12:53:15 -0700201
joshualitt3c1096f2015-01-13 13:13:59 -0800202 // Some versions of this extension string require declaring custom color output on ES 3.0+
Ethan Nicholaseab2baa2018-04-13 15:16:27 -0400203 const char* fbFetchColorName = "sk_LastFragColor";
Brian Salomon1edc5b92016-11-29 13:43:46 -0500204 if (shaderCaps->fbFetchNeedsCustomOutput()) {
joshualittb4384b92014-10-21 12:53:15 -0700205 this->enableCustomOutput();
206 fOutputs[fCustomColorOutputIndex].setTypeModifier(GrShaderVar::kInOut_TypeModifier);
egdaniel8dcdedc2015-11-11 06:27:20 -0800207 fbFetchColorName = DeclaredColorOutputName();
egdaniel138c2632016-08-17 10:59:00 -0700208 // Set the dstColor to an intermediate variable so we don't override it with the output
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400209 this->codeAppendf("half4 %s = %s;", kDstColorName, fbFetchColorName);
egdanielbd4121a2016-08-17 12:55:30 -0700210 } else {
211 return fbFetchColorName;
joshualittb4384b92014-10-21 12:53:15 -0700212 }
halcanary9d524f22016-03-29 09:03:52 -0700213 }
egdaniel138c2632016-08-17 10:59:00 -0700214 return kDstColorName;
joshualitt47bb3822014-10-07 16:43:25 -0700215}
216
egdaniel2d721d32015-11-11 13:06:05 -0800217void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) {
cdalton8917d622015-05-06 13:40:21 -0700218 SkASSERT(GrBlendEquationIsAdvanced(equation));
219
Brian Salomon94efbf52016-11-29 13:43:05 -0500220 const GrShaderCaps& caps = *fProgramBuilder->shaderCaps();
cdalton8917d622015-05-06 13:40:21 -0700221 if (!caps.mustEnableAdvBlendEqs()) {
222 return;
223 }
224
225 this->addFeature(1 << kBlendEquationAdvanced_GLSLPrivateFeature,
226 "GL_KHR_blend_equation_advanced");
227 if (caps.mustEnableSpecificAdvBlendEqs()) {
228 this->addLayoutQualifier(specific_layout_qualifier_name(equation), kOut_InterfaceQualifier);
229 } else {
230 this->addLayoutQualifier("blend_support_all_equations", kOut_InterfaceQualifier);
231 }
232}
233
egdaniel2d721d32015-11-11 13:06:05 -0800234void GrGLSLFragmentShaderBuilder::enableCustomOutput() {
joshualittb4384b92014-10-21 12:53:15 -0700235 if (!fHasCustomColorOutput) {
236 fHasCustomColorOutput = true;
237 fCustomColorOutputIndex = fOutputs.count();
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400238 fOutputs.push_back().set(kHalf4_GrSLType, DeclaredColorOutputName(),
Brian Salomon99938a82016-11-21 13:41:08 -0500239 GrShaderVar::kOut_TypeModifier);
Ben Wagner63fd7602017-10-09 15:45:33 -0400240 fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back());
joshualittb4384b92014-10-21 12:53:15 -0700241 }
joshualitt47bb3822014-10-07 16:43:25 -0700242}
243
egdaniel2d721d32015-11-11 13:06:05 -0800244void GrGLSLFragmentShaderBuilder::enableSecondaryOutput() {
joshualitt47bb3822014-10-07 16:43:25 -0700245 SkASSERT(!fHasSecondaryOutput);
246 fHasSecondaryOutput = true;
Brian Salomon94efbf52016-11-29 13:43:05 -0500247 const GrShaderCaps& caps = *fProgramBuilder->shaderCaps();
egdaniel8dcdedc2015-11-11 06:27:20 -0800248 if (const char* extension = caps.secondaryOutputExtensionString()) {
249 this->addFeature(1 << kBlendFuncExtended_GLSLPrivateFeature, extension);
kkinnunend94708e2015-07-30 22:47:04 -0700250 }
251
252 // If the primary output is declared, we must declare also the secondary output
253 // and vice versa, since it is not allowed to use a built-in gl_FragColor and a custom
254 // output. The condition also co-incides with the condition in whici GLES SL 2.0
255 // requires the built-in gl_SecondaryFragColorEXT, where as 3.0 requires a custom output.
kkinnunend94708e2015-07-30 22:47:04 -0700256 if (caps.mustDeclareFragmentShaderOutput()) {
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400257 fOutputs.push_back().set(kHalf4_GrSLType, DeclaredSecondaryColorOutputName(),
Brian Salomon99938a82016-11-21 13:41:08 -0500258 GrShaderVar::kOut_TypeModifier);
egdanielb80ec8b2016-02-09 09:54:43 -0800259 fProgramBuilder->finalizeFragmentSecondaryColor(fOutputs.back());
kkinnunend94708e2015-07-30 22:47:04 -0700260 }
joshualitt47bb3822014-10-07 16:43:25 -0700261}
262
egdaniel2d721d32015-11-11 13:06:05 -0800263const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const {
ethannicholas5961bc92016-10-12 06:39:56 -0700264 return fHasCustomColorOutput ? DeclaredColorOutputName() : "sk_FragColor";
joshualitt47bb3822014-10-07 16:43:25 -0700265}
266
Brian Salomondc092132018-04-04 10:14:16 -0400267bool GrGLSLFragmentShaderBuilder::primaryColorOutputIsInOut() const {
268 return fHasCustomColorOutput &&
269 fOutputs[fCustomColorOutputIndex].getTypeModifier() == GrShaderVar::kInOut_TypeModifier;
270}
271
ethannicholas22793252016-01-30 09:59:10 -0800272void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) {
273 va_list argp;
274 va_start(argp, fmt);
275 inputs().appendVAList(fmt, argp);
halcanary9d524f22016-03-29 09:03:52 -0700276 va_end(argp);
ethannicholas22793252016-01-30 09:59:10 -0800277}
278
egdaniel2d721d32015-11-11 13:06:05 -0800279const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const {
Chris Dalton6b76df02019-04-08 11:01:34 -0600280 if (this->hasSecondaryOutput()) {
281 return (fProgramBuilder->shaderCaps()->mustDeclareFragmentShaderOutput())
282 ? DeclaredSecondaryColorOutputName()
283 : "gl_SecondaryFragColorEXT";
284 }
285 return nullptr;
joshualitt47bb3822014-10-07 16:43:25 -0700286}
287
cdalton28f45b92016-03-07 13:58:26 -0800288GrSurfaceOrigin GrGLSLFragmentShaderBuilder::getSurfaceOrigin() const {
Robert Phillips7de13332019-10-09 15:44:54 -0400289 return fProgramBuilder->origin();
cdalton28f45b92016-03-07 13:58:26 -0800290}
291
egdaniel2d721d32015-11-11 13:06:05 -0800292void GrGLSLFragmentShaderBuilder::onFinalize() {
Robert Phillips7de13332019-10-09 15:44:54 -0400293 SkASSERT(fProgramBuilder->processorFeatures() == fUsedProcessorFeaturesAllStages_DebugOnly);
Chris Daltond7291ba2019-03-07 14:17:03 -0700294
Robert Phillips7de13332019-10-09 15:44:54 -0400295 if (CustomFeatures::kSampleLocations & fProgramBuilder->processorFeatures()) {
Robert Phillips65a77752019-10-02 15:22:24 -0400296 const SkTArray<SkPoint>& sampleLocations = fProgramBuilder->getSampleLocations();
Chris Dalton2284aab2019-11-15 11:02:24 -0700297 this->definitions().appendf("const float2 _sampleOffsets[%i] = float2[%i](",
298 sampleLocations.count(), sampleLocations.count());
Chris Daltond7291ba2019-03-07 14:17:03 -0700299 for (int i = 0; i < sampleLocations.count(); ++i) {
300 SkPoint offset = sampleLocations[i] - SkPoint::Make(.5f, .5f);
301 if (kBottomLeft_GrSurfaceOrigin == this->getSurfaceOrigin()) {
302 offset.fY = -offset.fY;
303 }
304 this->definitions().appendf("float2(%f, %f)", offset.x(), offset.y());
305 this->definitions().append((i + 1 != sampleLocations.count()) ? ", " : ");");
306 }
307 }
308
egdaniel0eafe792015-11-20 14:01:22 -0800309 fProgramBuilder->varyingHandler()->getFragDecls(&this->inputs(), &this->outputs());
joshualitt30ba4362014-08-21 20:18:45 -0700310}
311
cdalton85285412016-02-18 12:37:07 -0800312void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() {
wangyix54a6b1a2015-09-08 08:41:51 -0700313 SkASSERT(fSubstageIndices.count() >= 1);
wangyix7ef45a12015-08-13 06:51:35 -0700314 fSubstageIndices.push_back(0);
wangyix54a6b1a2015-09-08 08:41:51 -0700315 // second-to-last value in the fSubstageIndices stack is the index of the child proc
316 // at that level which is currently emitting code.
317 fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]);
wangyix7ef45a12015-08-13 06:51:35 -0700318}
319
cdalton85285412016-02-18 12:37:07 -0800320void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() {
wangyix54a6b1a2015-09-08 08:41:51 -0700321 SkASSERT(fSubstageIndices.count() >= 2);
wangyix7ef45a12015-08-13 06:51:35 -0700322 fSubstageIndices.pop_back();
wangyix54a6b1a2015-09-08 08:41:51 -0700323 fSubstageIndices.back()++;
wangyix7ef45a12015-08-13 06:51:35 -0700324 int removeAt = fMangleString.findLastOf('_');
325 fMangleString.remove(removeAt, fMangleString.size() - removeAt);
326}