diff options
author | 2011-07-06 17:47:02 +0000 | |
---|---|---|
committer | 2011-07-06 17:47:02 +0000 | |
commit | 2c17fcdc45f9fa9a2dc785786347040fbe30928b (patch) | |
tree | d6676cf0d78f21fab28476c685aa182fb567a79e /gpu/src/GrGpuGL.h | |
parent | 25fd36c7efc0287b6a2a82463eacaeaf91ca07b9 (diff) |
Reduce gets of ext string and check validity of stencil format enums
Review URL: http://codereview.appspot.com/4678043/
git-svn-id: http://skia.googlecode.com/svn/trunk@1801 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGpuGL.h')
-rw-r--r-- | gpu/src/GrGpuGL.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gpu/src/GrGpuGL.h b/gpu/src/GrGpuGL.h index aec55d8b7b..7f13ea11a4 100644 --- a/gpu/src/GrGpuGL.h +++ b/gpu/src/GrGpuGL.h @@ -25,6 +25,8 @@ #include "GrGLVertexBuffer.h" #include "GrGLIndexBuffer.h" +#include "SkString.h" + class GrGpuGL : public GrGpu { public: virtual ~GrGpuGL(); @@ -48,6 +50,10 @@ protected: DrState fHWDrawState; bool fHWStencilClip; + // read these once at begining and then never again + SkString fExtensionString; + float fGLVersion; + // As flush of GL state proceeds it updates fHDrawState // to reflect the new state. Later parts of the state flush // may perform cascaded changes but cannot refer to fHWDrawState. @@ -127,6 +133,10 @@ protected: GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff); + bool hasExtension(const char* ext) { + return has_gl_extension_from_string(ext, fExtensionString.c_str()); + } + // adjusts texture matrix to account for orientation, size, and npotness static void AdjustTextureMatrix(const GrGLTexture* texture, GrSamplerState::SampleMode mode, @@ -142,6 +152,9 @@ protected: private: + // determines valid stencil formats + void setupStencilFormats(); + // notify callbacks to update state tracking when related // objects are bound to GL or deleted outside of the class void notifyVertexBufferBind(const GrGLVertexBuffer* buffer); @@ -175,6 +188,16 @@ private: friend class GrGLTexture; friend class GrGLRenderTarget; + static const GrGLuint gUNKNOWN_BITCOUNT = ~0; + + struct StencilFormat { + GrGLenum fEnum; + GrGLuint fBits; + bool fPacked; + }; + + GrTArray<StencilFormat, true> fStencilFormats; + bool fHWBlendDisabled; GrGLuint fAASamples[4]; |