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/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