Move nested class GrDrawTarget::Caps out as GrDrawTargetCaps.
Pass caps to GrEffect::TestCreate() functions so that they can return effects that will work with the capabilities.
Review URL: https://codereview.chromium.org/12965018

git-svn-id: http://skia.googlecode.com/svn/trunk@8369 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index 1e88416..5374976 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -66,6 +66,7 @@
       '<(skia_src_path)/gpu/GrDrawState.h',
       '<(skia_src_path)/gpu/GrDrawTarget.cpp',
       '<(skia_src_path)/gpu/GrDrawTarget.h',
+      '<(skia_src_path)/gpu/GrDrawTargetCaps.h',
       '<(skia_src_path)/gpu/GrEffect.cpp',
       '<(skia_src_path)/gpu/GrGeometryBuffer.cpp',
       '<(skia_src_path)/gpu/GrGeometryBuffer.h',
diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h
index 03a302c..557602f 100644
--- a/include/gpu/GrEffectUnitTest.h
+++ b/include/gpu/GrEffectUnitTest.h
@@ -8,11 +8,12 @@
 #ifndef GrEffectUnitTest_DEFINED
 #define GrEffectUnitTest_DEFINED
 
-#include "SkRandom.h"
 #include "GrNoncopyable.h"
+#include "SkRandom.h"
 #include "SkTArray.h"
 
 class SkMatrix;
+class GrDrawTargetCaps;
 
 namespace GrEffectUnitTest {
 // Used to access the dummy textures in TestCreate procs.
@@ -37,7 +38,10 @@
 class GrEffectTestFactory : GrNoncopyable {
 public:
 
-    typedef GrEffectRef* (*CreateProc)(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[]);
+    typedef GrEffectRef* (*CreateProc)(SkMWCRandom*,
+                                       GrContext*,
+                                       const GrDrawTargetCaps& caps,
+                                       GrTexture* dummyTextures[]);
 
     GrEffectTestFactory(CreateProc createProc) {
         fCreateProc = createProc;
@@ -46,10 +50,11 @@
 
     static GrEffectRef* CreateStage(SkMWCRandom* random,
                                     GrContext* context,
+                                    const GrDrawTargetCaps& caps,
                                     GrTexture* dummyTextures[]) {
         uint32_t idx = random->nextRangeU(0, GetFactories()->count() - 1);
         GrEffectTestFactory* factory = (*GetFactories())[idx];
-        return factory->fCreateProc(random, context, dummyTextures);
+        return factory->fCreateProc(random, context, caps, dummyTextures);
     }
 
 private:
@@ -62,11 +67,17 @@
  */
 #define GR_DECLARE_EFFECT_TEST                                                      \
     static GrEffectTestFactory gTestFactory;                                        \
-    static GrEffectRef* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2])
+    static GrEffectRef* TestCreate(SkMWCRandom*,                                    \
+                                   GrContext*,                                      \
+                                   const GrDrawTargetCaps&,                         \
+                                   GrTexture* dummyTextures[2])
 
 /** GrEffect subclasses should insert this macro in their implementation file. They must then
  *  also implement this static function:
- *      GrEffect* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2]);
+ *      GrEffect* TestCreate(SkMWCRandom*,
+ *                           GrContext*,
+ *                           const GrDrawTargetCaps&,
+ *                           GrTexture* dummyTextures[2]);
  * dummyTextures[] are valid textures that can optionally be used to construct GrTextureAccesses.
  * The first texture has config kSkia8888_GrPixelConfig and the second has
  * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create additional textures using
@@ -79,8 +90,11 @@
 
 // The unit test relies on static initializers. Just declare the TestCreate function so that
 // its definitions will compile.
-#define GR_DECLARE_EFFECT_TEST \
-    static GrEffectRef* TestCreate(SkMWCRandom*, GrContext*, GrTexture* dummyTextures[2])
+#define GR_DECLARE_EFFECT_TEST                                                      \
+    static GrEffectRef* TestCreate(SkMWCRandom*,                                    \
+                                   GrContext*,                                      \
+                                   const GrDrawTargetCaps&,                         \
+                                   GrTexture* dummyTextures[2])
 #define GR_DEFINE_EFFECT_TEST(X)
 
 #endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
diff --git a/src/effects/SkBicubicImageFilter.cpp b/src/effects/SkBicubicImageFilter.cpp
index 507612e..c10937e 100644
--- a/src/effects/SkBicubicImageFilter.cpp
+++ b/src/effects/SkBicubicImageFilter.cpp
@@ -326,6 +326,7 @@
 
 GrEffectRef* GrBicubicEffect::TestCreate(SkMWCRandom* random,
                                          GrContext* context,
+                                         const GrDrawTargetCaps&,
                                          GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index 55e8bba..c2ab3fd 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -463,6 +463,7 @@
 
 GrEffectRef* ColorMatrixEffect::TestCreate(SkMWCRandom* random,
                                            GrContext*,
+                                           const GrDrawTargetCaps&,
                                            GrTexture* dummyTextures[2]) {
     SkColorMatrix colorMatrix;
     for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) {
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 4d2e2dd..6139523 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -363,6 +363,7 @@
 
 GrEffectRef* GrDisplacementMapEffect::TestCreate(SkMWCRandom* random,
                                                  GrContext*,
+                                                 const GrDrawTargetCaps&,
                                                  GrTexture* textures[]) {
     int texIdxDispl = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                            GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 8ada08a..a22bc6f 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1080,6 +1080,7 @@
 
 GrEffectRef* GrDiffuseLightingEffect::TestCreate(SkMWCRandom* random,
                                                  GrContext* context,
+                                                 const GrDrawTargetCaps&,
                                                  GrTexture* textures[]) {
     SkScalar surfaceScale = random->nextSScalar1();
     SkScalar kd = random->nextUScalar1();
@@ -1296,6 +1297,7 @@
 
 GrEffectRef* GrSpecularLightingEffect::TestCreate(SkMWCRandom* random,
                                                   GrContext* context,
+                                                  const GrDrawTargetCaps&,
                                                   GrTexture* textures[]) {
     SkScalar surfaceScale = random->nextSScalar1();
     SkScalar ks = random->nextUScalar1();
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 0c4cde1..f6675c4 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -201,6 +201,7 @@
 
 GrEffectRef* GrMagnifierEffect::TestCreate(SkMWCRandom* random,
                                            GrContext* context,
+                                           const GrDrawTargetCaps&,
                                            GrTexture** textures) {
     const int kMaxWidth = 200;
     const int kMaxHeight = 200;
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index b25979c..e3711d2 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -533,6 +533,7 @@
 
 GrEffectRef* GrMatrixConvolutionEffect::TestCreate(SkMWCRandom* random,
                                                    GrContext* context,
+                                                   const GrDrawTargetCaps&,
                                                    GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index f2b37f2..77299e4 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -423,6 +423,7 @@
 
 GrEffectRef* GrMorphologyEffect::TestCreate(SkMWCRandom* random,
                                             GrContext*,
+                                            const GrDrawTargetCaps&,
                                             GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index e0c4978..d20283f 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -368,6 +368,7 @@
 
 GrEffectRef* ColorTableEffect::TestCreate(SkMWCRandom* random,
                                           GrContext* context,
+                                          const GrDrawTargetCaps&,
                                           GrTexture* textures[]) {
     static unsigned kAllFlags = SkTable_ColorFilter::kR_Flag | SkTable_ColorFilter::kG_Flag |
                                 SkTable_ColorFilter::kB_Flag | SkTable_ColorFilter::kA_Flag;
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 76168a9..e0f216c 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -513,6 +513,7 @@
 
 GrEffectRef* GrLinearGradient::TestCreate(SkMWCRandom* random,
                                           GrContext* context,
+                                          const GrDrawTargetCaps&,
                                           GrTexture**) {
     SkPoint points[] = {{random->nextUScalar1(), random->nextUScalar1()},
                         {random->nextUScalar1(), random->nextUScalar1()}};
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index a80cb81..3fce9c4 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -534,6 +534,7 @@
 
 GrEffectRef* GrRadialGradient::TestCreate(SkMWCRandom* random,
                                           GrContext* context,
+                                          const GrDrawTargetCaps&,
                                           GrTexture**) {
     SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
     SkScalar radius = random->nextUScalar1();
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 9d24d40..1e6b642 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -446,6 +446,7 @@
 
 GrEffectRef* GrSweepGradient::TestCreate(SkMWCRandom* random,
                                          GrContext* context,
+                                         const GrDrawTargetCaps&,
                                          GrTexture**) {
     SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
 
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index 0b6e30d..abd974b 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -446,6 +446,7 @@
 
 GrEffectRef* GrConical2Gradient::TestCreate(SkMWCRandom* random,
                                             GrContext* context,
+                                            const GrDrawTargetCaps&,
                                             GrTexture**) {
     SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
     SkScalar radius1 = random->nextUScalar1();
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 6784818..f70b67d 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -488,6 +488,7 @@
 
 GrEffectRef* GrRadial2Gradient::TestCreate(SkMWCRandom* random,
                                            GrContext* context,
+                                           const GrDrawTargetCaps&,
                                            GrTexture**) {
     SkPoint center1 = {random->nextUScalar1(), random->nextUScalar1()};
     SkScalar radius1 = random->nextUScalar1();
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index b4509b3..cff6324 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -10,6 +10,7 @@
 
 #include "GrContext.h"
 #include "GrDrawState.h"
+#include "GrDrawTargetCaps.h"
 #include "GrPathUtils.h"
 #include "SkString.h"
 #include "SkStrokeRec.h"
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 90ab128..80304f8 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -10,6 +10,7 @@
 
 #include "GrContext.h"
 #include "GrDrawState.h"
+#include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 #include "GrIndexBuffer.h"
 #include "GrPathUtils.h"
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index 8d748b8..d8dd8bd 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -8,10 +8,11 @@
 
 
 #include "GrBufferAllocPool.h"
+#include "GrDrawTargetCaps.h"
+#include "GrGpu.h"
+#include "GrIndexBuffer.h"
 #include "GrTypes.h"
 #include "GrVertexBuffer.h"
-#include "GrIndexBuffer.h"
-#include "GrGpu.h"
 
 #if GR_DEBUG
     #define VALIDATE validate
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 4626af8..ca5f378 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -7,18 +7,18 @@
  */
 
 #include "GrClipMaskManager.h"
-#include "effects/GrTextureDomainEffect.h"
-#include "GrGpu.h"
-#include "GrRenderTarget.h"
-#include "GrStencilBuffer.h"
-#include "GrPathRenderer.h"
-#include "GrPaint.h"
-#include "SkRasterClip.h"
-#include "SkStrokeRec.h"
 #include "GrAAConvexPathRenderer.h"
 #include "GrAAHairLinePathRenderer.h"
+#include "GrDrawTargetCaps.h"
+#include "GrGpu.h"
+#include "GrPaint.h"
+#include "GrPathRenderer.h"
+#include "GrRenderTarget.h"
+#include "GrStencilBuffer.h"
 #include "GrSWMaskHelper.h"
-
+#include "effects/GrTextureDomainEffect.h"
+#include "SkRasterClip.h"
+#include "SkStrokeRec.h"
 #include "SkTLazy.h"
 
 #define GR_AA_CLIP 1
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 0a2f01d..32b4d6a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -15,6 +15,7 @@
 
 #include "GrBufferAllocPool.h"
 #include "GrGpu.h"
+#include "GrDrawTargetCaps.h"
 #include "GrIndexBuffer.h"
 #include "GrInOrderDrawBuffer.h"
 #include "GrOvalRenderer.h"
@@ -573,7 +574,7 @@
 
 bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params,
                                           int width, int height) const {
-    const GrDrawTarget::Caps* caps = fGpu->caps();
+    const GrDrawTargetCaps* caps = fGpu->caps();
     if (!caps->eightBitPaletteSupport()) {
         return false;
     }
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 9f9c7d6..d263d40 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -9,6 +9,7 @@
 
 
 #include "GrDrawTarget.h"
+#include "GrDrawTargetCaps.h"
 #include "GrRenderTarget.h"
 #include "GrTexture.h"
 #include "GrVertexBuffer.h"
@@ -679,9 +680,9 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SK_DEFINE_INST_COUNT(GrDrawTarget::Caps)
+SK_DEFINE_INST_COUNT(GrDrawTargetCaps)
 
-void GrDrawTarget::Caps::reset() {
+void GrDrawTargetCaps::reset() {
     f8BitPaletteSupport = false;
     fNPOTTextureTileSupport = false;
     fTwoSidedStencilSupport = false;
@@ -689,7 +690,7 @@
     fHWAALineSupport = false;
     fShaderDerivativeSupport = false;
     fGeometryShaderSupport = false;
-    fDualSourceBlendingSupport = false;
+    fDualSourceBlendingSupport = false; 
     fBufferLockSupport = false;
     fPathStencilingSupport = false;
 
@@ -698,7 +699,7 @@
     fMaxSampleCount = 0;
 }
 
-GrDrawTarget::Caps& GrDrawTarget::Caps::operator=(const GrDrawTarget::Caps& other) {
+GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
     f8BitPaletteSupport = other.f8BitPaletteSupport;
     fNPOTTextureTileSupport = other.fNPOTTextureTileSupport;
     fTwoSidedStencilSupport = other.fTwoSidedStencilSupport;
@@ -717,7 +718,7 @@
     return *this;
 }
 
-void GrDrawTarget::Caps::print() const {
+void GrDrawTargetCaps::print() const {
     static const char* gNY[] = {"NO", "YES"};
     GrPrintf("8 Bit Palette Support       : %s\n", gNY[f8BitPaletteSupport]);
     GrPrintf("NPOT Texture Tile Support   : %s\n", gNY[fNPOTTextureTileSupport]);
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 68ba591..e54a04d 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -7,7 +7,6 @@
  */
 
 
-
 #ifndef GrDrawTarget_DEFINED
 #define GrDrawTarget_DEFINED
 
@@ -24,6 +23,7 @@
 #include "SkXfermode.h"
 
 class GrClipData;
+class GrDrawTargetCaps;
 class GrPath;
 class GrVertexBuffer;
 class SkStrokeRec;
@@ -35,55 +35,6 @@
 public:
     SK_DECLARE_INST_COUNT(GrDrawTarget)
 
-    /**
-     * Represents the draw target capabilities.
-     */
-    class Caps : public SkRefCnt {
-    public:
-        SK_DECLARE_INST_COUNT(Caps)
-
-        Caps() { this->reset(); }
-        Caps(const Caps& c) { *this = c; }
-        Caps& operator= (const Caps& c);
-
-        virtual void reset();
-        virtual void print() const;
-
-        bool eightBitPaletteSupport() const { return f8BitPaletteSupport; }
-        bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
-        bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
-        bool stencilWrapOpsSupport() const { return  fStencilWrapOpsSupport; }
-        bool hwAALineSupport() const { return fHWAALineSupport; }
-        bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; }
-        bool geometryShaderSupport() const { return fGeometryShaderSupport; }
-        bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
-        bool bufferLockSupport() const { return fBufferLockSupport; }
-        bool pathStencilingSupport() const { return fPathStencilingSupport; }
-
-        int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
-        int maxTextureSize() const { return fMaxTextureSize; }
-        // Will be 0 if MSAA is not supported
-        int maxSampleCount() const { return fMaxSampleCount; }
-    protected:
-
-        bool f8BitPaletteSupport        : 1;
-        bool fNPOTTextureTileSupport    : 1;
-        bool fTwoSidedStencilSupport    : 1;
-        bool fStencilWrapOpsSupport     : 1;
-        bool fHWAALineSupport           : 1;
-        bool fShaderDerivativeSupport   : 1;
-        bool fGeometryShaderSupport     : 1;
-        bool fDualSourceBlendingSupport : 1;
-        bool fBufferLockSupport         : 1;
-        bool fPathStencilingSupport     : 1;
-
-        int fMaxRenderTargetSize;
-        int fMaxTextureSize;
-        int fMaxSampleCount;
-
-        typedef SkRefCnt INHERITED;
-    };
-
     ///////////////////////////////////////////////////////////////////////////
 
     // The context may not be fully constructed and should not be used during GrDrawTarget
@@ -94,7 +45,7 @@
     /**
      * Gets the capabilities of the draw target.
      */
-    const Caps* caps() const { return fCaps.get(); }
+    const GrDrawTargetCaps* caps() const { return fCaps.get(); }
 
     /**
      * Sets the current clip to the region specified by clip. All draws will be
@@ -665,7 +616,7 @@
     }
 
     // Subclass must initialize this in its constructor.
-    SkAutoTUnref<const Caps> fCaps;
+    SkAutoTUnref<const GrDrawTargetCaps> fCaps;
 
     /**
      * Used to communicate draws to subclass's onDraw function.
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
new file mode 100644
index 0000000..35a05f9
--- /dev/null
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -0,0 +1,63 @@
+
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkRefCnt.h"
+
+#ifndef GrDrawTargetCaps_DEFINED
+#define GrDrawTargetCaps_DEFINED
+
+/**
+ * Represents the draw target capabilities.
+ */
+class GrDrawTargetCaps : public SkRefCnt {
+public:
+    SK_DECLARE_INST_COUNT(Caps)
+
+    GrDrawTargetCaps() { this->reset(); }
+    GrDrawTargetCaps(const GrDrawTargetCaps& other) { *this = other; }
+    GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
+
+    virtual void reset();
+    virtual void print() const;
+
+    bool eightBitPaletteSupport() const { return f8BitPaletteSupport; }
+    bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
+    bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; }
+    bool stencilWrapOpsSupport() const { return  fStencilWrapOpsSupport; }
+    bool hwAALineSupport() const { return fHWAALineSupport; }
+    bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; }
+    bool geometryShaderSupport() const { return fGeometryShaderSupport; }
+    bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; }
+    bool bufferLockSupport() const { return fBufferLockSupport; }
+    bool pathStencilingSupport() const { return fPathStencilingSupport; }
+
+    int maxRenderTargetSize() const { return fMaxRenderTargetSize; }
+    int maxTextureSize() const { return fMaxTextureSize; }
+    // Will be 0 if MSAA is not supported
+    int maxSampleCount() const { return fMaxSampleCount; }
+
+protected:
+    bool f8BitPaletteSupport        : 1;
+    bool fNPOTTextureTileSupport    : 1;
+    bool fTwoSidedStencilSupport    : 1;
+    bool fStencilWrapOpsSupport     : 1;
+    bool fHWAALineSupport           : 1;
+    bool fShaderDerivativeSupport   : 1;
+    bool fGeometryShaderSupport     : 1;
+    bool fDualSourceBlendingSupport : 1;
+    bool fBufferLockSupport         : 1;
+    bool fPathStencilingSupport     : 1;
+
+    int fMaxRenderTargetSize;
+    int fMaxTextureSize;
+    int fMaxSampleCount;
+
+    typedef SkRefCnt INHERITED;
+};
+
+#endif
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index ba7bedd..c9e876a 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -11,6 +11,7 @@
 
 #include "GrBufferAllocPool.h"
 #include "GrContext.h"
+#include "GrDrawTargetCaps.h"
 #include "GrIndexBuffer.h"
 #include "GrStencilBuffer.h"
 #include "GrVertexBuffer.h"
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 2e86147..a090dcf 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -9,6 +9,7 @@
 
 #include "GrInOrderDrawBuffer.h"
 #include "GrBufferAllocPool.h"
+#include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 #include "GrIndexBuffer.h"
 #include "GrPath.h"
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 3458841..b9157c7 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -11,6 +11,7 @@
 
 #include "GrContext.h"
 #include "GrDefaultPathRenderer.h"
+#include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 
 SK_DEFINE_INST_COUNT(GrPathRendererChain)
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 04d7674..fa87599 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -9,6 +9,7 @@
 
 #include "GrStencilAndCoverPathRenderer.h"
 #include "GrContext.h"
+#include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 #include "GrPath.h"
 #include "SkStrokeRec.h"
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 479d7bb..44a1442 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -10,6 +10,7 @@
 #include "GrTexture.h"
 
 #include "GrContext.h"
+#include "GrDrawTargetCaps.h"
 #include "GrGpu.h"
 #include "GrRenderTarget.h"
 #include "GrResourceCache.h"
diff --git a/src/gpu/effects/GrCircleEdgeEffect.cpp b/src/gpu/effects/GrCircleEdgeEffect.cpp
index 3804fc7..19544d7 100644
--- a/src/gpu/effects/GrCircleEdgeEffect.cpp
+++ b/src/gpu/effects/GrCircleEdgeEffect.cpp
@@ -75,6 +75,7 @@
 
 GrEffectRef* GrCircleEdgeEffect::TestCreate(SkMWCRandom* random,
                                             GrContext* context,
+                                            const GrDrawTargetCaps&,
                                             GrTexture* textures[]) {
     return GrCircleEdgeEffect::Create(random->nextBool());
 }
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index df8ab8d..1e65a6f 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -135,6 +135,7 @@
 
 GrEffectRef* GrConfigConversionEffect::TestCreate(SkMWCRandom* random,
                                                   GrContext*,
+                                                  const GrDrawTargetCaps&,
                                                   GrTexture* textures[]) {
     PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt));
     bool swapRB;
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 924b03c..380581f 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -183,6 +183,7 @@
 
 GrEffectRef* GrConvolutionEffect::TestCreate(SkMWCRandom* random,
                                              GrContext*,
+                                             const GrDrawTargetCaps&,
                                              GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/gpu/effects/GrEllipseEdgeEffect.cpp b/src/gpu/effects/GrEllipseEdgeEffect.cpp
index 5d7908e..7a773b0 100644
--- a/src/gpu/effects/GrEllipseEdgeEffect.cpp
+++ b/src/gpu/effects/GrEllipseEdgeEffect.cpp
@@ -96,6 +96,7 @@
 
 GrEffectRef* GrEllipseEdgeEffect::TestCreate(SkMWCRandom* random,
                                                GrContext* context,
+                                               const GrDrawTargetCaps&,
                                                GrTexture* textures[]) {
     return GrEllipseEdgeEffect::Create(random->nextBool());
 }
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index 80627aa..172558d 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -97,6 +97,7 @@
 
 GrEffectRef* GrSimpleTextureEffect::TestCreate(SkMWCRandom* random,
                                                GrContext*,
+                                               const GrDrawTargetCaps&,
                                                GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index b1fd3ed..f3838ae 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -221,6 +221,7 @@
 
 GrEffectRef* GrTextureDomainEffect::TestCreate(SkMWCRandom* random,
                                                GrContext*,
+                                               const GrDrawTargetCaps&,
                                                GrTexture* textures[]) {
     int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
                                       GrEffectUnitTest::kAlphaTextureIdx;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 1bf5036..5e555f9 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -45,7 +45,7 @@
     fIsCoreProfile = false;
 }
 
-GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTarget::Caps() {
+GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
     *this = caps;
 }
 
@@ -205,14 +205,13 @@
     this->initStencilFormats(ctxInfo);
 
     /**************************************************************************
-     * GrDrawTarget::Caps fields
+     * GrDrawTargetCaps fields
      **************************************************************************/
     GrGLint maxTextureUnits;
     // check FS and fixed-function texture unit limits
     // we only use textures in the fragment stage currently.
     // checks are > to make sure we have a spare unit.
     GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
-    GrAssert(maxTextureUnits > GrDrawState::kNumStages);
 
     GrGLint numFormats;
     GR_GL_GetIntegerv(gli, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index d19c989..920140f 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -9,10 +9,10 @@
 #ifndef GrGLCaps_DEFINED
 #define GrGLCaps_DEFINED
 
+#include "GrDrawTargetCaps.h"
+#include "GrGLStencilBuffer.h"
 #include "SkTArray.h"
 #include "SkTDArray.h"
-#include "GrGLStencilBuffer.h"
-#include "GrDrawTarget.h"
 
 class GrGLContextInfo;
 
@@ -21,7 +21,7 @@
  * version and the extensions string. It also tracks formats that have passed
  * the FBO completeness test.
  */
-class GrGLCaps : public GrDrawTarget::Caps {
+class GrGLCaps : public GrDrawTargetCaps {
 public:
     SK_DECLARE_INST_COUNT(GrGLCaps)
 
@@ -312,7 +312,7 @@
     bool fUseNonVBOVertexAndIndexDynamicData : 1;
     bool fIsCoreProfile : 1;
 
-    typedef GrDrawTarget::Caps INHERITED;
+    typedef GrDrawTargetCaps INHERITED;
 };
 
 #endif
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index bfe2094..1270b93 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -133,6 +133,7 @@
                 SkAutoTUnref<const GrEffectRef> effect(GrEffectTestFactory::CreateStage(
                                                                                 &random,
                                                                                 this->getContext(),
+                                                                                *this->caps(),
                                                                                 dummyTextures));
                 int numAttribs = (*effect)->numVertexAttribs();