OLD | NEW |
(Empty) | |
| 1 /* |
| 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 |
| 8 #ifndef GrFrameBufferObj_DEFINED |
| 9 #define GrFrameBufferObj_DEFINED |
| 10 |
| 11 #include "GrFakeRefObj.h" |
| 12 class GrFBBindableObj; |
| 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 // TODO: when a framebuffer obj is bound the GL_SAMPLES query must return 0 |
| 16 // TODO: GL_STENCIL_BITS must also be redirected to the framebuffer |
| 17 class GrFrameBufferObj : public GrFakeRefObj { |
| 18 GR_DEFINE_CREATOR(GrFrameBufferObj); |
| 19 |
| 20 public: |
| 21 GrFrameBufferObj() |
| 22 : GrFakeRefObj() |
| 23 , fBound(false) |
| 24 , fColorBuffer(nullptr) |
| 25 , fDepthBuffer(nullptr) |
| 26 , fStencilBuffer(nullptr) { |
| 27 } |
| 28 |
| 29 virtual ~GrFrameBufferObj() { |
| 30 fColorBuffer = nullptr; |
| 31 fDepthBuffer = nullptr; |
| 32 fStencilBuffer = nullptr; |
| 33 } |
| 34 |
| 35 void setBound() { fBound = true; } |
| 36 void resetBound() { fBound = false; } |
| 37 bool getBound() const { return fBound; } |
| 38 |
| 39 void setColor(GrFBBindableObj *buffer); |
| 40 GrFBBindableObj *getColor() { return fColorBuffer; } |
| 41 |
| 42 void setDepth(GrFBBindableObj *buffer); |
| 43 GrFBBindableObj *getDepth() { return fDepthBuffer; } |
| 44 |
| 45 void setStencil(GrFBBindableObj *buffer); |
| 46 GrFBBindableObj *getStencil() { return fStencilBuffer; } |
| 47 |
| 48 void deleteAction() override { |
| 49 |
| 50 setColor(nullptr); |
| 51 setDepth(nullptr); |
| 52 setStencil(nullptr); |
| 53 |
| 54 this->INHERITED::deleteAction(); |
| 55 } |
| 56 |
| 57 protected: |
| 58 private: |
| 59 bool fBound; // is this frame buffer currently bound via "glBindFrame
buffer"? |
| 60 GrFBBindableObj * fColorBuffer; |
| 61 GrFBBindableObj * fDepthBuffer; |
| 62 GrFBBindableObj * fStencilBuffer; |
| 63 |
| 64 typedef GrFakeRefObj INHERITED; |
| 65 }; |
| 66 |
| 67 #endif // GrFrameBufferObj_DEFINED |
OLD | NEW |