blob: b06d117255e86f69cd55deba37a137d14b43d00b [file] [log] [blame]
robertphillips@google.comdd743fe2012-04-05 14:40:53 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
tfarina@chromium.org293f0192013-07-08 13:00:42 +00008#ifndef GrTextureUnitObj_DEFINED
robertphillips@google.comdd743fe2012-04-05 14:40:53 +00009#define GrTextureUnitObj_DEFINED
10
11#include "GrFakeRefObj.h"
12class GrTextureObj;
13
14////////////////////////////////////////////////////////////////////////////////
15// Although texture unit objects are allocated & deallocated like the other
16// GL emulation objects they are derived from GrFakeRefObj to provide some
bsalomon3c481002016-03-21 09:04:26 -070017// uniformity in how the debug interface class manages resources
robertphillips@google.comdd743fe2012-04-05 14:40:53 +000018class GrTextureUnitObj : public GrFakeRefObj {
Mike Kleinfc6c37b2016-09-27 09:34:10 -040019 GR_DEFINE_CREATOR(GrTextureUnitObj)
robertphillips@google.comdd743fe2012-04-05 14:40:53 +000020
21public:
22 GrTextureUnitObj()
23 : GrFakeRefObj()
24 , fNumber(0)
halcanary96fcdcc2015-08-27 07:41:13 -070025 , fTexture(nullptr) {
robertphillips@google.comdd743fe2012-04-05 14:40:53 +000026 }
27
28 void setNumber(GrGLenum number) {
29 fNumber = number;
30 }
31 GrGLenum getNumber() const { return fNumber; }
32
33 void setTexture(GrTextureObj *texture);
34 GrTextureObj *getTexture() { return fTexture; }
35
36protected:
37private:
38 GrGLenum fNumber;
39 GrTextureObj *fTexture;
40
41 typedef GrFakeRefObj INHERITED;
42};
43
44#endif // GrTextureUnitObj_DEFINED