1 2 /* 3 * Copyright 2012 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef GrProgramObj_DEFINED 10 #define GrProgramObj_DEFINED 11 12 #include "SkTArray.h" 13 #include "GrFakeRefObj.h" 14 class GrShaderObj; 15 16 //////////////////////////////////////////////////////////////////////////////// 17 class GrProgramObj : public GrFakeRefObj { 18 GR_DEFINE_CREATOR(GrProgramObj); 19 20 public: GrProgramObj()21 GrProgramObj() 22 : GrFakeRefObj() 23 , fInUse(false) {} 24 25 void AttachShader(GrShaderObj *shader); 26 27 void deleteAction() override; 28 29 // TODO: this flag system won't work w/ multiple contexts! setInUse()30 void setInUse() { fInUse = true; } resetInUse()31 void resetInUse() { fInUse = false; } getInUse()32 bool getInUse() const { return fInUse; } 33 34 protected: 35 36 private: 37 SkTArray<GrShaderObj *> fShaders; 38 bool fInUse; // has this program been activated by a glUseProgram call? 39 40 typedef GrFakeRefObj INHERITED; 41 }; 42 43 #endif // GrProgramObj_DEFINED 44