blob: d06e410463ece73d6f4aae4a54d8dfa6030066bd [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
robertphillips@google.com0dd84a32012-04-16 16:24:35 +000016////////////////////////////////////////////////////////////////////////////////
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
mtklein72c9faa2015-01-09 10:06:39 -080027 void deleteAction() SK_OVERRIDE;
robertphillips@google.com0dd84a32012-04-16 16:24:35 +000028
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
robertphillips@google.comdd743fe2012-04-05 14:40:53 +000043#endif // GrProgramObj_DEFINED