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

Side by Side Diff: include/gpu/GrGeometryProcessor.h

Issue 660573002: Split GrFragmentProcessor into its own header (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add file to git Created 6 years, 2 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 | « include/gpu/GrFragmentProcessor.h ('k') | include/gpu/GrProcessor.h » ('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 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
11 #include "GrProcessor.h" 11 #include "GrProcessor.h"
12 class GrBackendGeometryProcessorFactory; 12 #include "GrShaderVar.h"
13 13
14 /** 14 /**
15 * A GrGeomteryProcessor is used to perform computation in the vertex shader and 15 * A GrGeomteryProcessor is used to perform computation in the vertex shader and
16 * add support for custom vertex attributes. A GrGemeotryProcessor is typically 16 * add support for custom vertex attributes. A GrGemeotryProcessor is typically
17 * tied to the code that does a specific type of high-level primitive rendering 17 * tied to the code that does a specific type of high-level primitive rendering
18 * (e.g. anti-aliased circle rendering). The GrGeometryProcessor used for a draw is 18 * (e.g. anti-aliased circle rendering). The GrGeometryProcessor used for a draw is
19 * specified using GrDrawState. There can only be one geometry processor active for 19 * specified using GrDrawState. There can only be one geometry processor active for
20 * a draw. The custom vertex attributes required by the geometry processor must be 20 * a draw. The custom vertex attributes required by the geometry processor must be
21 * added to the vertex attribute array specified on the GrDrawState. 21 * added to the vertex attribute array specified on the GrDrawState.
22 * GrGeometryProcessor subclasses should be immutable after construction. 22 * GrGeometryProcessor subclasses should be immutable after construction.
23 */ 23 */
24 class GrGeometryProcessor : public GrProcessor { 24 class GrGeometryProcessor : public GrProcessor {
25 public: 25 public:
26 GrGeometryProcessor() {} 26 GrGeometryProcessor() {}
27 27
28 virtual const GrBackendGeometryProcessorFactory& getFactory() const = 0; 28 virtual const GrBackendGeometryProcessorFactory& getFactory() const = 0;
29 29
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
41 true when the two effects are of the same subclass (i.e. they return the same object from
42 from getFactory()).
43 A return value of true from isEqual() should not be used to test whether the effects would
44 generate the same shader code. To test for identical code generation use the effects' keys
45 computed by the GrBackendEffectFactory. */
40 bool isEqual(const GrGeometryProcessor& that) const { 46 bool isEqual(const GrGeometryProcessor& that) const {
41 if (&this->getFactory() != &that.getFactory()) { 47 if (&this->getFactory() != &that.getFactory()) {
42 return false; 48 return false;
43 } 49 }
44 bool result = this->onIsEqual(that); 50 bool result = this->onIsEqual(that);
45 #ifdef SK_DEBUG 51 #ifdef SK_DEBUG
46 if (result) { 52 if (result) {
47 this->assertTexturesEqual(that); 53 this->assertTexturesEqual(that);
48 } 54 }
49 #endif 55 #endif
(...skipping 22 matching lines...) Expand all
72 /** 78 /**
73 * This creates an effect outside of the effect memory pool. The effect's destru ctor will be called 79 * This creates an effect outside of the effect memory pool. The effect's destru ctor will be called
74 * at global destruction time. NAME will be the name of the created GrProcessor. 80 * at global destruction time. NAME will be the name of the created GrProcessor.
75 */ 81 */
76 #define GR_CREATE_STATIC_GEOMETRY_PROCESSOR(NAME, GP_CLASS, ARGS) \ 82 #define GR_CREATE_STATIC_GEOMETRY_PROCESSOR(NAME, GP_CLASS, ARGS) \
77 static SkAlignedSStorage<sizeof(GP_CLASS)> g_##NAME##_Storage; \ 83 static SkAlignedSStorage<sizeof(GP_CLASS)> g_##NAME##_Storage; \
78 static GrGeometryProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), GP_CLASS, ARGS); \ 84 static GrGeometryProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), GP_CLASS, ARGS); \
79 static SkAutoTDestroy<GrGeometryProcessor> NAME##_ad(NAME); 85 static SkAutoTDestroy<GrGeometryProcessor> NAME##_ad(NAME);
80 86
81 #endif 87 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | include/gpu/GrProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698