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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1666773002: Clean up GrGLSLFragmentProcessor-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/utils/debugger/SkOverdrawMode.cpp ('k') | no next file » | 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 /* 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 27 matching lines...) Expand all
38 #include "glsl/GrGLSLProgramBuilder.h" 38 #include "glsl/GrGLSLProgramBuilder.h"
39 39
40 /* 40 /*
41 * A dummy processor which just tries to insert a massive key and verify that it can retrieve the 41 * A dummy processor which just tries to insert a massive key and verify that it can retrieve the
42 * whole thing correctly 42 * whole thing correctly
43 */ 43 */
44 static const uint32_t kMaxKeySize = 1024; 44 static const uint32_t kMaxKeySize = 1024;
45 45
46 class GLBigKeyProcessor : public GrGLSLFragmentProcessor { 46 class GLBigKeyProcessor : public GrGLSLFragmentProcessor {
47 public: 47 public:
48 GLBigKeyProcessor(const GrProcessor&) {} 48 void emitCode(EmitArgs& args) override {
49
50 virtual void emitCode(EmitArgs& args) override {
51 // pass through 49 // pass through
52 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 50 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
53 if (args.fInputColor) { 51 if (args.fInputColor) {
54 fragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, args.fInpu tColor); 52 fragBuilder->codeAppendf("%s = %s;\n", args.fOutputColor, args.fInpu tColor);
55 } else { 53 } else {
56 fragBuilder->codeAppendf("%s = vec4(1.0);\n", args.fOutputColor); 54 fragBuilder->codeAppendf("%s = vec4(1.0);\n", args.fOutputColor);
57 } 55 }
58 } 56 }
59 57
60 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces sorKeyBuilder* b) { 58 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces sorKeyBuilder* b) {
61 for (uint32_t i = 0; i < kMaxKeySize; i++) { 59 for (uint32_t i = 0; i < kMaxKeySize; i++) {
62 b->add32(i); 60 b->add32(i);
63 } 61 }
64 } 62 }
65 63
66 private: 64 private:
67 typedef GrGLSLFragmentProcessor INHERITED; 65 typedef GrGLSLFragmentProcessor INHERITED;
68 }; 66 };
69 67
70 class BigKeyProcessor : public GrFragmentProcessor { 68 class BigKeyProcessor : public GrFragmentProcessor {
71 public: 69 public:
72 static GrFragmentProcessor* Create() { 70 static GrFragmentProcessor* Create() {
73 return new BigKeyProcessor; 71 return new BigKeyProcessor;
74 } 72 }
75 73
76 const char* name() const override { return "Big Ole Key"; } 74 const char* name() const override { return "Big Ole Key"; }
77 75
78 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 76 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
79 return new GLBigKeyProcessor(*this); 77 return new GLBigKeyProcessor;
80 } 78 }
81 79
82 private: 80 private:
83 BigKeyProcessor() { 81 BigKeyProcessor() {
84 this->initClassID<BigKeyProcessor>(); 82 this->initClassID<BigKeyProcessor>();
85 } 83 }
86 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, 84 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps,
87 GrProcessorKeyBuilder* b) const override { 85 GrProcessorKeyBuilder* b) const override {
88 GLBigKeyProcessor::GenKey(*this, caps, b); 86 GLBigKeyProcessor::GenKey(*this, caps, b);
89 } 87 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 GrContextOptions opts; 457 GrContextOptions opts;
460 opts.fSuppressPrints = true; 458 opts.fSuppressPrints = true;
461 GrContextFactory debugFactory(opts); 459 GrContextFactory debugFactory(opts);
462 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G PUTestContexts, 460 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G PUTestContexts,
463 reporter, &debugFactory); 461 reporter, &debugFactory);
464 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, 462 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
465 skiatest::kOther_GPUTestContexts, reporter, &debugFactory); 463 skiatest::kOther_GPUTestContexts, reporter, &debugFactory);
466 } 464 }
467 465
468 #endif 466 #endif
OLDNEW
« no previous file with comments | « src/utils/debugger/SkOverdrawMode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698