OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 }; | 67 }; |
68 | 68 |
69 class BigKeyProcessor : public GrFragmentProcessor { | 69 class BigKeyProcessor : public GrFragmentProcessor { |
70 public: | 70 public: |
71 static GrFragmentProcessor* Create() { | 71 static GrFragmentProcessor* Create() { |
72 return new BigKeyProcessor; | 72 return new BigKeyProcessor; |
73 } | 73 } |
74 | 74 |
75 const char* name() const override { return "Big Ole Key"; } | 75 const char* name() const override { return "Big Ole Key"; } |
76 | 76 |
77 GrGLSLFragmentProcessor* onCreateGLInstance() const override { | 77 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
78 return new GLBigKeyProcessor(*this); | 78 return new GLBigKeyProcessor(*this); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 BigKeyProcessor() { | 82 BigKeyProcessor() { |
83 this->initClassID<BigKeyProcessor>(); | 83 this->initClassID<BigKeyProcessor>(); |
84 } | 84 } |
85 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 85 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
86 GrProcessorKeyBuilder* b) const override { | 86 GrProcessorKeyBuilder* b) const override
{ |
87 GLBigKeyProcessor::GenKey(*this, caps, b); | 87 GLBigKeyProcessor::GenKey(*this, caps, b); |
88 } | 88 } |
89 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 89 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
90 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { } | 90 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { } |
91 | 91 |
92 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 92 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
93 | 93 |
94 typedef GrFragmentProcessor INHERITED; | 94 typedef GrFragmentProcessor INHERITED; |
95 }; | 95 }; |
96 | 96 |
97 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor); | 97 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor); |
98 | 98 |
99 const GrFragmentProcessor* BigKeyProcessor::TestCreate(GrProcessorTestData*) { | 99 const GrFragmentProcessor* BigKeyProcessor::TestCreate(GrProcessorTestData*) { |
100 return BigKeyProcessor::Create(); | 100 return BigKeyProcessor::Create(); |
101 } | 101 } |
102 | 102 |
103 ////////////////////////////////////////////////////////////////////////////// | 103 ////////////////////////////////////////////////////////////////////////////// |
104 | 104 |
105 class BlockInputFragmentProcessor : public GrFragmentProcessor { | 105 class BlockInputFragmentProcessor : public GrFragmentProcessor { |
106 public: | 106 public: |
107 static GrFragmentProcessor* Create(const GrFragmentProcessor* fp) { | 107 static GrFragmentProcessor* Create(const GrFragmentProcessor* fp) { |
108 return new BlockInputFragmentProcessor(fp); | 108 return new BlockInputFragmentProcessor(fp); |
109 } | 109 } |
110 | 110 |
111 const char* name() const override { return "Block Input"; } | 111 const char* name() const override { return "Block Input"; } |
112 | 112 |
113 GrGLSLFragmentProcessor* onCreateGLInstance() const override { return new GL
FP; } | 113 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new
GLFP; } |
114 | 114 |
115 private: | 115 private: |
116 class GLFP : public GrGLSLFragmentProcessor { | 116 class GLFP : public GrGLSLFragmentProcessor { |
117 public: | 117 public: |
118 void emitCode(EmitArgs& args) override { | 118 void emitCode(EmitArgs& args) override { |
119 this->emitChild(0, nullptr, args); | 119 this->emitChild(0, nullptr, args); |
120 } | 120 } |
121 | 121 |
122 private: | 122 private: |
123 typedef GrGLSLFragmentProcessor INHERITED; | 123 typedef GrGLSLFragmentProcessor INHERITED; |
124 }; | 124 }; |
125 | 125 |
126 BlockInputFragmentProcessor(const GrFragmentProcessor* child) { | 126 BlockInputFragmentProcessor(const GrFragmentProcessor* child) { |
127 this->initClassID<BlockInputFragmentProcessor>(); | 127 this->initClassID<BlockInputFragmentProcessor>(); |
128 this->registerChildProcessor(child); | 128 this->registerChildProcessor(child); |
129 } | 129 } |
130 | 130 |
131 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override {} | 131 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b)
const override {} |
132 | 132 |
133 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 133 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
134 | 134 |
135 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 135 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
136 inout->setToOther(kRGBA_GrColorComponentFlags, GrColor_WHITE, | 136 inout->setToOther(kRGBA_GrColorComponentFlags, GrColor_WHITE, |
137 GrInvariantOutput::kWillNot_ReadInput); | 137 GrInvariantOutput::kWillNot_ReadInput); |
138 this->childProcessor(0).computeInvariantOutput(inout); | 138 this->childProcessor(0).computeInvariantOutput(inout); |
139 } | 139 } |
140 | 140 |
141 typedef GrFragmentProcessor INHERITED; | 141 typedef GrFragmentProcessor INHERITED; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 #endif | 445 #endif |
446 GrTestTarget testTarget; | 446 GrTestTarget testTarget; |
447 context->getTestTarget(&testTarget); | 447 context->getTestTarget(&testTarget); |
448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest( | 448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest( |
449 context, testTarget.target(), maxSta
ges)); | 449 context, testTarget.target(), maxSta
ges)); |
450 } | 450 } |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 #endif | 454 #endif |
OLD | NEW |