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

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

Issue 2114993002: 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: Fixed GrPaint unintialized bool 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"
11 #include "SkPoint3.h" 12 #include "SkPoint3.h"
12 #include "SkReadBuffer.h" 13 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 14 #include "SkWriteBuffer.h"
14 15
15 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
16 #include "GrInvariantOutput.h" 17 #include "GrInvariantOutput.h"
17 #include "glsl/GrGLSLFragmentProcessor.h" 18 #include "glsl/GrGLSLFragmentProcessor.h"
18 #include "glsl/GrGLSLFragmentShaderBuilder.h" 19 #include "glsl/GrGLSLFragmentShaderBuilder.h"
19 20
20 class NormalFlatFP : public GrFragmentProcessor { 21 class NormalFlatFP : public GrFragmentProcessor {
21 public: 22 public:
22 NormalFlatFP() { 23 NormalFlatFP() {
23 this->initClassID<NormalFlatFP>(); 24 this->initClassID<NormalFlatFP>();
24 } 25 }
25 26
26 class GLSLNormalFlatFP : public GrGLSLFragmentProcessor { 27 class GLSLNormalFlatFP : public GLSLNormalFP {
27 public: 28 public:
28 GLSLNormalFlatFP() {} 29 GLSLNormalFlatFP() {}
29 30
30 void emitCode(EmitArgs& args) override { 31 void onEmitCode(EmitArgs& args) override {
31 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 32 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
32 33
33 fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor ); 34 fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor );
34 } 35 }
35 36
36 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, 37 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&,
37 GrProcessorKeyBuilder* b) { 38 GrProcessorKeyBuilder* b) {
38 b->add32(0x0); 39 b->add32(0x0);
39 } 40 }
40 41
41 protected: 42 protected:
42 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override {} 43 void setNormalData(const GrGLSLProgramDataManager& pdman,
44 const GrProcessor& proc) override {}
43 }; 45 };
44 46
45 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { 47 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
46 GLSLNormalFlatFP::GenKey(*this, caps, b); 48 GLSLNormalFlatFP::GenKey(*this, caps, b);
47 } 49 }
48 50
49 const char* name() const override { return "NormalFlatFP"; } 51 const char* name() const override { return "NormalFlatFP"; }
50 52
51 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { 53 void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
52 inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput); 54 inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 100
99 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const { 101 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const {
100 this->INHERITED::flatten(buf); 102 this->INHERITED::flatten(buf);
101 } 103 }
102 104
103 //////////////////////////////////////////////////////////////////////////// 105 ////////////////////////////////////////////////////////////////////////////
104 106
105 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() { 107 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() {
106 return sk_make_sp<SkNormalFlatSourceImpl>(); 108 return sk_make_sp<SkNormalFlatSourceImpl>();
107 } 109 }
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