michael@0: michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrProgramObj_DEFINED michael@0: #define GrProgramObj_DEFINED michael@0: michael@0: #include "SkTArray.h" michael@0: #include "GrFakeRefObj.h" michael@0: class GrShaderObj; michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: class GrProgramObj : public GrFakeRefObj { michael@0: GR_DEFINE_CREATOR(GrProgramObj); michael@0: michael@0: public: michael@0: GrProgramObj() michael@0: : GrFakeRefObj() michael@0: , fInUse(false) {} michael@0: michael@0: void AttachShader(GrShaderObj *shader); michael@0: michael@0: virtual void deleteAction() SK_OVERRIDE; michael@0: michael@0: // TODO: this flag system won't work w/ multiple contexts! michael@0: void setInUse() { fInUse = true; } michael@0: void resetInUse() { fInUse = false; } michael@0: bool getInUse() const { return fInUse; } michael@0: michael@0: protected: michael@0: michael@0: private: michael@0: SkTArray fShaders; michael@0: bool fInUse; // has this program been activated by a glUseProgram call? michael@0: michael@0: typedef GrFakeRefObj INHERITED; michael@0: }; michael@0: michael@0: #endif // GrProgramObj_DEFINED