OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #ifndef GrProgramObj_DEFINED | 9 #ifndef GrProgramObj_DEFINED |
10 #define GrProgramObj_DEFINED | 10 #define GrProgramObj_DEFINED |
11 | 11 |
12 #include "SkTArray.h" | 12 #include "SkTArray.h" |
13 #include "GrFakeRefObj.h" | 13 #include "GrFakeRefObj.h" |
14 class GrShaderObj; | 14 class GrShaderObj; |
15 | 15 |
16 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
17 class GrProgramObj : public GrFakeRefObj { | 17 class GrProgramObj : public GrFakeRefObj { |
18 GR_DEFINE_CREATOR(GrProgramObj); | 18 GR_DEFINE_CREATOR(GrProgramObj); |
19 | 19 |
20 public: | 20 public: |
21 GrProgramObj() | 21 GrProgramObj() |
22 : GrFakeRefObj() | 22 : GrFakeRefObj() |
23 , fInUse(false) {} | 23 , fInUse(false) {} |
24 | 24 |
25 void AttachShader(GrShaderObj *shader); | 25 void AttachShader(GrShaderObj *shader); |
26 | 26 |
27 virtual void deleteAction() SK_OVERRIDE; | 27 void deleteAction() SK_OVERRIDE; |
28 | 28 |
29 // TODO: this flag system won't work w/ multiple contexts! | 29 // TODO: this flag system won't work w/ multiple contexts! |
30 void setInUse() { fInUse = true; } | 30 void setInUse() { fInUse = true; } |
31 void resetInUse() { fInUse = false; } | 31 void resetInUse() { fInUse = false; } |
32 bool getInUse() const { return fInUse; } | 32 bool getInUse() const { return fInUse; } |
33 | 33 |
34 protected: | 34 protected: |
35 | 35 |
36 private: | 36 private: |
37 SkTArray<GrShaderObj *> fShaders; | 37 SkTArray<GrShaderObj *> fShaders; |
38 bool fInUse; // has this program been activated by a glUseProgram
call? | 38 bool fInUse; // has this program been activated by a glUseProgram
call? |
39 | 39 |
40 typedef GrFakeRefObj INHERITED; | 40 typedef GrFakeRefObj INHERITED; |
41 }; | 41 }; |
42 | 42 |
43 #endif // GrProgramObj_DEFINED | 43 #endif // GrProgramObj_DEFINED |
OLD | NEW |