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

Side by Side Diff: src/gpu/effects/GrExtractAlphaFragmentProcessor.cpp

Issue 1338403003: Revert of Test that GrFragmentProcessors work without input colors. (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 | « include/gpu/GrProcessorUnitTest.h ('k') | 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 "effects/GrExtractAlphaFragmentProcessor.h" 8 #include "effects/GrExtractAlphaFragmentProcessor.h"
9 #include "gl/GrGLFragmentProcessor.h" 9 #include "gl/GrGLFragmentProcessor.h"
10 #include "gl/builders/GrGLProgramBuilder.h" 10 #include "gl/builders/GrGLProgramBuilder.h"
11 11
12 class GLExtractAlphaFragmentProcessor : public GrGLFragmentProcessor { 12 class GLExtractAlphaFragmentProcessor : public GrGLFragmentProcessor {
13 public: 13 public:
14 GLExtractAlphaFragmentProcessor() {} 14 GLExtractAlphaFragmentProcessor() {}
15 15
16 void emitCode(EmitArgs& args) override { 16 void emitCode(EmitArgs& args) override {
17 if (args.fInputColor) { 17 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder ();
18 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBui lder(); 18 fsBuilder->codeAppendf("vec4 alpha4 = %s.aaaa;", args.fInputColor);
19 fsBuilder->codeAppendf("vec4 alpha4 = %s.aaaa;", args.fInputColor); 19 this->emitChild(0, "alpha4", args.fOutputColor, args);
20 this->emitChild(0, "alpha4", args.fOutputColor, args);
21 } else {
22 this->emitChild(0, nullptr, args.fOutputColor, args);
23 }
24 } 20 }
25 21
26 private: 22 private:
27 typedef GrGLFragmentProcessor INHERITED; 23 typedef GrGLFragmentProcessor INHERITED;
28 }; 24 };
29 25
30 GrGLFragmentProcessor* GrExtractAlphaFragmentProcessor::onCreateGLInstance() con st { 26 GrGLFragmentProcessor* GrExtractAlphaFragmentProcessor::onCreateGLInstance() con st {
31 return SkNEW(GLExtractAlphaFragmentProcessor); 27 return SkNEW(GLExtractAlphaFragmentProcessor);
32 } 28 }
33 29
34 void GrExtractAlphaFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps&, 30 void GrExtractAlphaFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps&,
35 GrProcessorKeyBuilder* ) const { 31 GrProcessorKeyBuilder* ) const {
36 } 32 }
37 33
38 bool GrExtractAlphaFragmentProcessor::onIsEqual(const GrFragmentProcessor&) cons t { return true; } 34 bool GrExtractAlphaFragmentProcessor::onIsEqual(const GrFragmentProcessor&) cons t { return true; }
39 35
40 void GrExtractAlphaFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput * inout) const { 36 void GrExtractAlphaFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput * inout) const {
41 if (inout->validFlags() & kA_GrColorComponentFlag) { 37 if (inout->validFlags() & kA_GrColorComponentFlag) {
42 GrColor color = GrColorPackA4(GrColorUnpackA(inout->color())); 38 GrColor color = GrColorPackA4(GrColorUnpackA(inout->color()));
43 inout->setToOther(kRGBA_GrColorComponentFlags, color, 39 inout->setToOther(kRGBA_GrColorComponentFlags, color,
44 GrInvariantOutput::kWill_ReadInput); 40 GrInvariantOutput::kWill_ReadInput);
45 } else { 41 } else {
46 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); 42 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
47 } 43 }
48 this->childProcessor(0).computeInvariantOutput(inout); 44 this->childProcessor(0).computeInvariantOutput(inout);
49 } 45 }
OLDNEW
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | src/gpu/effects/GrXfermodeFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698