180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2012 Google Inc.
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
858190644c30e1c4aa8e527f3503c58f841e0fcf3Derek Sollenberger#ifndef GrTextureUnitObj_DEFINED
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define GrTextureUnitObj_DEFINED
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "GrFakeRefObj.h"
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass GrTextureObj;
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru////////////////////////////////////////////////////////////////////////////////
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Although texture unit objects are allocated & deallocated like the other
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// GL emulation objects they are derived from GrFakeRefObj to provide some
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// uniformity in how the GrDebugGL class manages resources
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass GrTextureUnitObj : public GrFakeRefObj {
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GR_DEFINE_CREATOR(GrTextureUnitObj);
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GrTextureUnitObj()
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        : GrFakeRefObj()
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        , fNumber(0)
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        , fTexture(NULL) {
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setNumber(GrGLenum number) {
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        fNumber = number;
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GrGLenum getNumber() const { return fNumber; }
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void setTexture(GrTextureObj *texture);
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GrTextureObj *getTexture()                  { return fTexture; }
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected:
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GrGLenum fNumber;
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    GrTextureObj *fTexture;
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    typedef GrFakeRefObj INHERITED;
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // GrTextureUnitObj_DEFINED
45