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

Side by Side Diff: src/core/SkNormalFlatSource.cpp

Issue 2201613002: Revert of GrFP can express distance vector field req., program builder declares variable for it (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-bevel-api-change
Patch Set: Created 4 years, 4 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 | « src/core/SkNormalBevelSource.cpp ('k') | src/core/SkNormalMapSource.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 2016 Google Inc. 2 * Copyright 2016 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 "SkNormalFlatSource.h" 8 #include "SkNormalFlatSource.h"
9 9
10 #include "SkNormalSource.h" 10 #include "SkNormalSource.h"
11 #include "SkNormalSourcePriv.h"
12 #include "SkPoint3.h" 11 #include "SkPoint3.h"
13 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
14 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
15 14
16 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
17 #include "GrInvariantOutput.h" 16 #include "GrInvariantOutput.h"
18 #include "glsl/GrGLSLFragmentProcessor.h" 17 #include "glsl/GrGLSLFragmentProcessor.h"
19 #include "glsl/GrGLSLFragmentShaderBuilder.h" 18 #include "glsl/GrGLSLFragmentShaderBuilder.h"
20 19
21 class NormalFlatFP : public GrFragmentProcessor { 20 class NormalFlatFP : public GrFragmentProcessor {
22 public: 21 public:
23 NormalFlatFP() { 22 NormalFlatFP() {
24 this->initClassID<NormalFlatFP>(); 23 this->initClassID<NormalFlatFP>();
25 } 24 }
26 25
27 class GLSLNormalFlatFP : public GLSLNormalFP { 26 class GLSLNormalFlatFP : public GrGLSLFragmentProcessor {
28 public: 27 public:
29 GLSLNormalFlatFP() {} 28 GLSLNormalFlatFP() {}
30 29
31 void onEmitCode(EmitArgs& args) override { 30 void emitCode(EmitArgs& args) override {
32 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; 31 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
33 32
34 fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor ); 33 fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor );
35 } 34 }
36 35
37 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, 36 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&,
38 GrProcessorKeyBuilder* b) { 37 GrProcessorKeyBuilder* b) {
39 b->add32(0x0); 38 b->add32(0x0);
40 } 39 }
41 40
42 protected: 41 protected:
43 void setNormalData(const GrGLSLProgramDataManager& pdman, 42 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override {}
44 const GrProcessor& proc) override {}
45 }; 43 };
46 44
47 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { 45 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
48 GLSLNormalFlatFP::GenKey(*this, caps, b); 46 GLSLNormalFlatFP::GenKey(*this, caps, b);
49 } 47 }
50 48
51 const char* name() const override { return "NormalFlatFP"; } 49 const char* name() const override { return "NormalFlatFP"; }
52 50
53 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { 51 void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
54 inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput); 52 inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 98
101 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const { 99 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const {
102 this->INHERITED::flatten(buf); 100 this->INHERITED::flatten(buf);
103 } 101 }
104 102
105 //////////////////////////////////////////////////////////////////////////// 103 ////////////////////////////////////////////////////////////////////////////
106 104
107 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() { 105 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() {
108 return sk_make_sp<SkNormalFlatSourceImpl>(); 106 return sk_make_sp<SkNormalFlatSourceImpl>();
109 } 107 }
OLDNEW
« no previous file with comments | « src/core/SkNormalBevelSource.cpp ('k') | src/core/SkNormalMapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698