michael@0: /* michael@0: * Copyright 2011 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: #ifndef GrGLStencilBuffer_DEFINED michael@0: #define GrGLStencilBuffer_DEFINED michael@0: michael@0: #include "gl/GrGLInterface.h" michael@0: #include "GrStencilBuffer.h" michael@0: michael@0: class GrGLStencilBuffer : public GrStencilBuffer { michael@0: public: michael@0: static const GrGLenum kUnknownInternalFormat = ~0U; michael@0: static const GrGLuint kUnknownBitCount = ~0U; michael@0: struct Format { michael@0: GrGLenum fInternalFormat; michael@0: GrGLuint fStencilBits; michael@0: GrGLuint fTotalBits; michael@0: bool fPacked; michael@0: }; michael@0: michael@0: GrGLStencilBuffer(GrGpu* gpu, michael@0: bool isWrapped, michael@0: GrGLint rbid, michael@0: int width, int height, michael@0: int sampleCnt, michael@0: const Format& format) michael@0: : GrStencilBuffer(gpu, isWrapped, width, height, format.fStencilBits, sampleCnt) michael@0: , fFormat(format) michael@0: , fRenderbufferID(rbid) { michael@0: } michael@0: michael@0: virtual ~GrGLStencilBuffer(); michael@0: michael@0: virtual size_t sizeInBytes() const SK_OVERRIDE; michael@0: michael@0: GrGLuint renderbufferID() const { michael@0: return fRenderbufferID; michael@0: } michael@0: michael@0: const Format& format() const { return fFormat; } michael@0: michael@0: protected: michael@0: // overrides of GrResource michael@0: virtual void onRelease() SK_OVERRIDE; michael@0: virtual void onAbandon() SK_OVERRIDE; michael@0: michael@0: private: michael@0: Format fFormat; michael@0: // may be zero for external SBs associated with external RTs michael@0: // (we don't require the client to give us the id, just tell michael@0: // us how many bits of stencil there are). michael@0: GrGLuint fRenderbufferID; michael@0: michael@0: typedef GrStencilBuffer INHERITED; michael@0: }; michael@0: michael@0: #endif