2016-03-31 01:56:19 +00:00
|
|
|
|
2012-04-05 14:40:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrFrameBufferObj_DEFINED
|
|
|
|
#define GrFrameBufferObj_DEFINED
|
|
|
|
|
|
|
|
#include "GrFakeRefObj.h"
|
|
|
|
class GrFBBindableObj;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TODO: when a framebuffer obj is bound the GL_SAMPLES query must return 0
|
|
|
|
// TODO: GL_STENCIL_BITS must also be redirected to the framebuffer
|
|
|
|
class GrFrameBufferObj : public GrFakeRefObj {
|
2016-09-27 13:34:10 +00:00
|
|
|
GR_DEFINE_CREATOR(GrFrameBufferObj)
|
2012-04-05 14:40:53 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
GrFrameBufferObj()
|
|
|
|
: GrFakeRefObj()
|
|
|
|
, fBound(false)
|
2015-08-27 14:41:13 +00:00
|
|
|
, fColorBuffer(nullptr)
|
|
|
|
, fDepthBuffer(nullptr)
|
|
|
|
, fStencilBuffer(nullptr) {
|
2012-04-05 14:40:53 +00:00
|
|
|
}
|
|
|
|
|
2017-03-22 16:05:03 +00:00
|
|
|
~GrFrameBufferObj() override {
|
2015-08-27 14:41:13 +00:00
|
|
|
fColorBuffer = nullptr;
|
|
|
|
fDepthBuffer = nullptr;
|
|
|
|
fStencilBuffer = nullptr;
|
2012-04-05 14:40:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void setBound() { fBound = true; }
|
|
|
|
void resetBound() { fBound = false; }
|
|
|
|
bool getBound() const { return fBound; }
|
|
|
|
|
|
|
|
void setColor(GrFBBindableObj *buffer);
|
|
|
|
GrFBBindableObj *getColor() { return fColorBuffer; }
|
|
|
|
|
|
|
|
void setDepth(GrFBBindableObj *buffer);
|
|
|
|
GrFBBindableObj *getDepth() { return fDepthBuffer; }
|
|
|
|
|
|
|
|
void setStencil(GrFBBindableObj *buffer);
|
|
|
|
GrFBBindableObj *getStencil() { return fStencilBuffer; }
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void deleteAction() override {
|
2012-04-05 14:40:53 +00:00
|
|
|
|
2015-08-27 14:41:13 +00:00
|
|
|
setColor(nullptr);
|
|
|
|
setDepth(nullptr);
|
|
|
|
setStencil(nullptr);
|
2012-04-05 14:40:53 +00:00
|
|
|
|
|
|
|
this->INHERITED::deleteAction();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
bool fBound; // is this frame buffer currently bound via "glBindFramebuffer"?
|
|
|
|
GrFBBindableObj * fColorBuffer;
|
|
|
|
GrFBBindableObj * fDepthBuffer;
|
|
|
|
GrFBBindableObj * fStencilBuffer;
|
|
|
|
|
|
|
|
typedef GrFakeRefObj INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GrFrameBufferObj_DEFINED
|