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

Side by Side Diff: src/effects/SkArithmeticMode_gpu.cpp

Issue 1362873002: Mangle output var in GrGLFragmentProcessor::emitChild (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 | « no previous file | src/gpu/effects/GrXfermodeFragmentProcessor.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 "SkArithmeticMode_gpu.h" 8 #include "SkArithmeticMode_gpu.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 class GLArithmeticFP : public GrGLFragmentProcessor { 55 class GLArithmeticFP : public GrGLFragmentProcessor {
56 public: 56 public:
57 GLArithmeticFP(const GrProcessor&) : fEnforcePMColor(true) {} 57 GLArithmeticFP(const GrProcessor&) : fEnforcePMColor(true) {}
58 58
59 ~GLArithmeticFP() override {} 59 ~GLArithmeticFP() override {}
60 60
61 void emitCode(EmitArgs& args) override { 61 void emitCode(EmitArgs& args) override {
62 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder (); 62 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder ();
63 fsBuilder->codeAppend("vec4 _dstColor;"); 63 SkString dstColor("dstColor");
64 this->emitChild(0, nullptr, "_dstColor", args); 64 this->emitChild(0, nullptr, &dstColor, args);
65 65
66 fKUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibili ty, 66 fKUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment_Visibili ty,
67 kVec4f_GrSLType, kDefault_GrSLPrecisio n, 67 kVec4f_GrSLType, kDefault_GrSLPrecisio n,
68 "k"); 68 "k");
69 const char* kUni = args.fBuilder->getUniformCStr(fKUni); 69 const char* kUni = args.fBuilder->getUniformCStr(fKUni);
70 70
71 add_arithmetic_code(fsBuilder, args.fInputColor, "_dstColor", args.fOutp utColor, kUni, 71 add_arithmetic_code(fsBuilder, args.fInputColor, dstColor.c_str(), args. fOutputColor, kUni,
72 fEnforcePMColor); 72 fEnforcePMColor);
73 } 73 }
74 74
75 static void GenKey(const GrProcessor& proc, const GrGLSLCaps& caps, GrProces sorKeyBuilder* b) { 75 static void GenKey(const GrProcessor& proc, const GrGLSLCaps& caps, GrProces sorKeyBuilder* b) {
76 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>(); 76 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>();
77 uint32_t key = arith.enforcePMColor() ? 1 : 0; 77 uint32_t key = arith.enforcePMColor() ? 1 : 0;
78 b->add32(key); 78 b->add32(key);
79 } 79 }
80 80
81 protected: 81 protected:
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 float k1 = d->fRandom->nextF(); 291 float k1 = d->fRandom->nextF();
292 float k2 = d->fRandom->nextF(); 292 float k2 = d->fRandom->nextF();
293 float k3 = d->fRandom->nextF(); 293 float k3 = d->fRandom->nextF();
294 float k4 = d->fRandom->nextF(); 294 float k4 = d->fRandom->nextF();
295 bool enforcePMColor = d->fRandom->nextBool(); 295 bool enforcePMColor = d->fRandom->nextBool();
296 296
297 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); 297 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor);
298 } 298 }
299 299
300 #endif 300 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/effects/GrXfermodeFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698