blob: d83eab8805f8813796dc9750dc2effdb190562fe [file] [log] [blame]
robertphillips@google.comdd743fe2012-04-05 14:40:53 +00001
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"
14class GrShaderObj;
15
16////////////////////////////////////////////////////////////////////////////////
17class GrProgramObj : public GrFakeRefObj {
18 GR_DEFINE_CREATOR(GrProgramObj);
19
20public:
21 GrProgramObj()
22 : GrFakeRefObj()
23 , fInUse(false) {}
24
25 void AttachShader(GrShaderObj *shader);
26
27 virtual void deleteAction() SK_OVERRIDE;
28
29 // TODO: this flag system won't work w/ multiple contexts!
30 void setInUse() { fInUse = true; }
31 void resetInUse() { fInUse = false; }
32 bool getInUse() const { return fInUse; }
33
34protected:
35
36private:
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