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 GrVertexEffect_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
9 #define GrVertexEffect_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
10 | 10 |
11 #include "GrEffect.h" | 11 #include "GrEffect.h" |
12 | 12 |
13 /** | 13 /** |
14 * If an effect needs specialized vertex shader code, then it must inherit from this class. | 14 * If an effect needs specialized vertex shader code, then it must inherit from this class. |
15 * Otherwise it won't be able to add vertex attribs, and it might be given a ver texless shader | 15 * Otherwise it won't be able to add vertex attribs, and it might be given a ver texless shader |
16 * program in emitCode. | 16 * program in emitCode. |
17 */ | 17 */ |
18 class GrVertexEffect : public GrEffect { | 18 class GrGeometryProcessor : public GrEffect { |
19 public: | 19 public: |
20 GrVertexEffect() { fRequiresVertexShader = true; } | 20 GrGeometryProcessor() { fRequiresVertexShader = true; } |
21 | 21 |
22 protected: | 22 protected: |
23 /** | 23 /** |
24 * Subclasses call this from their constructor to register vertex attributes (at most | 24 * Subclasses call this from their constructor to register vertex attributes (at most |
25 * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are | 25 * kMaxVertexAttribs). This must only be called from the constructor because GrEffects are |
26 * immutable. | 26 * immutable. |
27 * | |
28 * We return a reference to the added var so that derived classes can name i t nicely and use it | |
29 * in shader code. | |
27 */ | 30 */ |
28 void addVertexAttrib(GrSLType type) { | 31 GrShaderVar& addVertexAttrib(const GrShaderVar& var) { |
bsalomon
2014/09/12 00:34:17
I think this should just take a type and a name (a
joshua.litt
2014/09/12 00:46:07
Non const ref was a mistake, I meant to return a c
egdaniel
2014/09/12 01:12:27
Do we want to be dealing precision issues at this
bsalomon
2014/09/12 01:17:47
I think you're right that we don't need precision
joshua.litt
2014/09/12 01:35:28
I can remove precision from GrShaderVar along with
egdaniel
2014/09/12 02:09:18
I was suggesting removing precision from GrShaderV
| |
29 SkASSERT(fVertexAttribTypes.count() < kMaxVertexAttribs); | 32 SkASSERT(fVertexAttribs.count() < kMaxVertexAttribs); |
30 fVertexAttribTypes.push_back(type); | 33 return fVertexAttribs.push_back(var); |
31 } | 34 } |
32 | 35 |
33 private: | 36 private: |
34 typedef GrEffect INHERITED; | 37 typedef GrEffect INHERITED; |
35 }; | 38 }; |
36 | 39 |
37 #endif | 40 #endif |
OLD | NEW |