| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef GrGeometryProcessor_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
| 9 #define GrGeometryProcessor_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 /* | 30 /* |
| 31 * This only has a max because GLProgramsTest needs to generate test arrays,
and these have to | 31 * This only has a max because GLProgramsTest needs to generate test arrays,
and these have to |
| 32 * be static | 32 * be static |
| 33 * TODO make this truly dynamic | 33 * TODO make this truly dynamic |
| 34 */ | 34 */ |
| 35 static const int kMaxVertexAttribs = 2; | 35 static const int kMaxVertexAttribs = 2; |
| 36 typedef SkTArray<GrShaderVar, true> VertexAttribArray; | 36 typedef SkTArray<GrShaderVar, true> VertexAttribArray; |
| 37 | 37 |
| 38 const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; } | 38 const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; } |
| 39 | 39 |
| 40 /** Returns true if this and other effect conservatively draw identically. I
t can only return | 40 /** Returns true if this and other processor conservatively draw identically
. It can only return |
| 41 true when the two effects are of the same subclass (i.e. they return the
same object from | 41 true when the two prcoessors are of the same subclass (i.e. they return
the same object from |
| 42 from getFactory()). | 42 from getFactory()). |
| 43 A return value of true from isEqual() should not be used to test whether
the effects would | 43 A return value of true from isEqual() should not be used to test whether
the prcoessors |
| 44 generate the same shader code. To test for identical code generation use
the effects' keys | 44 would generate the same shader code. To test for identical code generati
on use the |
| 45 computed by the GrBackendEffectFactory. */ | 45 processors' keys computed by the GrBackendEffectFactory. */ |
| 46 bool isEqual(const GrGeometryProcessor& that) const { | 46 bool isEqual(const GrGeometryProcessor& that) const { |
| 47 if (&this->getFactory() != &that.getFactory()) { | 47 if (&this->getFactory() != &that.getFactory()) { |
| 48 return false; | 48 return false; |
| 49 } | 49 } |
| 50 bool result = this->onIsEqual(that); | 50 bool result = this->onIsEqual(that); |
| 51 #ifdef SK_DEBUG | 51 #ifdef SK_DEBUG |
| 52 if (result) { | 52 if (result) { |
| 53 this->assertTexturesEqual(that); | 53 this->assertTexturesEqual(that); |
| 54 } | 54 } |
| 55 #endif | 55 #endif |
| (...skipping 12 matching lines...) Expand all Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 virtual bool onIsEqual(const GrGeometryProcessor&) const = 0; | 71 virtual bool onIsEqual(const GrGeometryProcessor&) const = 0; |
| 72 | 72 |
| 73 SkSTArray<kMaxVertexAttribs, GrShaderVar, true> fVertexAttribs; | 73 SkSTArray<kMaxVertexAttribs, GrShaderVar, true> fVertexAttribs; |
| 74 | 74 |
| 75 typedef GrProcessor INHERITED; | 75 typedef GrProcessor INHERITED; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 /** | |
| 79 * This creates an effect outside of the effect memory pool. The effect's destru
ctor will be called | |
| 80 * at global destruction time. NAME will be the name of the created GrProcessor. | |
| 81 */ | |
| 82 #define GR_CREATE_STATIC_GEOMETRY_PROCESSOR(NAME, GP_CLASS, ARGS)
\ | |
| 83 static SkAlignedSStorage<sizeof(GP_CLASS)> g_##NAME##_Storage;
\ | |
| 84 static GrGeometryProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(),
GP_CLASS, ARGS); \ | |
| 85 static SkAutoTDestroy<GrGeometryProcessor> NAME##_ad(NAME); | |
| 86 | |
| 87 #endif | 78 #endif |
| OLD | NEW |