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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 778453002: Remove backend factories (Closed) Base URL: https://skia.googlesource.com/skia.git@unichoice
Patch Set: more clang warnings Created 6 years 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/gpu/gl/builders/GrGLProgramBuilder.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
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
14 14
15 #include "GrContextFactory.h" 15 #include "GrContextFactory.h"
16 #include "GrInvariantOutput.h" 16 #include "GrInvariantOutput.h"
17 #include "GrOptDrawState.h" 17 #include "GrOptDrawState.h"
18 #include "GrTBackendProcessorFactory.h"
19 #include "GrTest.h" 18 #include "GrTest.h"
20 #include "SkChecksum.h" 19 #include "SkChecksum.h"
21 #include "SkRandom.h" 20 #include "SkRandom.h"
22 #include "Test.h" 21 #include "Test.h"
23 #include "effects/GrConfigConversionEffect.h" 22 #include "effects/GrConfigConversionEffect.h"
24 #include "gl/GrGLPathRendering.h" 23 #include "gl/GrGLPathRendering.h"
25 #include "gl/GrGpuGL.h" 24 #include "gl/GrGpuGL.h"
26 #include "gl/builders/GrGLProgramBuilder.h" 25 #include "gl/builders/GrGLProgramBuilder.h"
27 26
28 /* 27 /*
29 * A dummy processor which just tries to insert a massive key and verify that it can retrieve the 28 * A dummy processor which just tries to insert a massive key and verify that it can retrieve the
30 * whole thing correctly 29 * whole thing correctly
31 */ 30 */
32 static const uint32_t kMaxKeySize = 1024; 31 static const uint32_t kMaxKeySize = 1024;
33 32
34 class GLBigKeyProcessor; 33 class GLBigKeyProcessor : public GrGLFragmentProcessor {
34 public:
35 GLBigKeyProcessor(const GrProcessor&) {}
36
37 virtual void emitCode(GrGLFPBuilder* builder,
38 const GrFragmentProcessor& fp,
39 const char* outputColor,
40 const char* inputColor,
41 const TransformedCoordsArray&,
42 const TextureSamplerArray&) {}
43
44 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso rKeyBuilder* b) {
45 for (uint32_t i = 0; i < kMaxKeySize; i++) {
46 b->add32(i);
47 }
48 }
49
50 private:
51 typedef GrGLFragmentProcessor INHERITED;
52 };
35 53
36 class BigKeyProcessor : public GrFragmentProcessor { 54 class BigKeyProcessor : public GrFragmentProcessor {
37 public: 55 public:
38 static GrFragmentProcessor* Create() { 56 static GrFragmentProcessor* Create() {
39 GR_CREATE_STATIC_PROCESSOR(gBigKeyProcessor, BigKeyProcessor, ()) 57 GR_CREATE_STATIC_PROCESSOR(gBigKeyProcessor, BigKeyProcessor, ())
40 return SkRef(gBigKeyProcessor); 58 return SkRef(gBigKeyProcessor);
41 } 59 }
42 60
43 static const char* Name() { return "Big ol' Key"; } 61 virtual const char* name() const SK_OVERRIDE { return "Big Ole Key"; }
44 62
45 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE { 63 virtual void getGLProcessorKey(const GrGLCaps& caps,
46 return GrTBackendFragmentProcessorFactory<BigKeyProcessor>::getInstance( ); 64 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
65 GLBigKeyProcessor::GenKey(*this, caps, b);
47 } 66 }
48 67
49 typedef GLBigKeyProcessor GLProcessor; 68 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
69 return SkNEW_ARGS(GLBigKeyProcessor, (*this));
70 }
50 71
51 private: 72 private:
52 BigKeyProcessor() { } 73 BigKeyProcessor() {
74 this->initClassID<BigKeyProcessor>();
75 }
53 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { retur n true; } 76 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { retur n true; }
54 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE { } 77 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE { }
55 78
56 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 79 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
57 80
58 typedef GrFragmentProcessor INHERITED; 81 typedef GrFragmentProcessor INHERITED;
59 }; 82 };
60 83
61 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor); 84 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor);
62 85
63 GrFragmentProcessor* BigKeyProcessor::TestCreate(SkRandom*, 86 GrFragmentProcessor* BigKeyProcessor::TestCreate(SkRandom*,
64 GrContext*, 87 GrContext*,
65 const GrDrawTargetCaps&, 88 const GrDrawTargetCaps&,
66 GrTexture*[]) { 89 GrTexture*[]) {
67 return BigKeyProcessor::Create(); 90 return BigKeyProcessor::Create();
68 } 91 }
69 92
70 class GLBigKeyProcessor : public GrGLFragmentProcessor {
71 public:
72 GLBigKeyProcessor(const GrBackendProcessorFactory& factory, const GrProcesso r&)
73 : INHERITED(factory) {}
74
75 virtual void emitCode(GrGLFPBuilder* builder,
76 const GrFragmentProcessor& fp,
77 const char* outputColor,
78 const char* inputColor,
79 const TransformedCoordsArray&,
80 const TextureSamplerArray&) {}
81
82 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso rKeyBuilder* b) {
83 for (uint32_t i = 0; i < kMaxKeySize; i++) {
84 b->add32(i);
85 }
86 }
87
88 private:
89 typedef GrGLFragmentProcessor INHERITED;
90 };
91
92 /* 93 /*
93 * Begin test code 94 * Begin test code
94 */ 95 */
95 static const int kRenderTargetHeight = 1; 96 static const int kRenderTargetHeight = 1;
96 static const int kRenderTargetWidth = 1; 97 static const int kRenderTargetWidth = 1;
97 98
98 static GrRenderTarget* random_render_target(GrContext* context, 99 static GrRenderTarget* random_render_target(GrContext* context,
99 const GrCacheID& cacheId, 100 const GrCacheID& cacheId,
100 SkRandom* random) { 101 SkRandom* random) {
101 // setup render target 102 // setup render target
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 431 }
431 #endif 432 #endif
432 GrTestTarget target; 433 GrTestTarget target;
433 context->getTestTarget(&target); 434 context->getTestTarget(&target);
434 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages )); 435 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages ));
435 } 436 }
436 } 437 }
437 } 438 }
438 439
439 #endif 440 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698