Make more unit tests run on Vulkan
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1885623002

Review URL: https://codereview.chromium.org/1885623002
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 9ae9ab7..fb38c7e 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -639,7 +639,7 @@
 #include "SkColorPriv.h"
 /** Tests calling copyTo on a texture backed bitmap. Tests that all BGRA_8888/RGBA_8888 combinations
     of src and dst work. This test should be removed when SkGrPixelRef is removed. */
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) {
     static const SkPMColor kData[] = {
         0xFF112233, 0xAF224499,
         0xEF004466, 0x80773311
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 160ebb3..56f2fe1 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -65,7 +65,7 @@
     return *dc != nullptr;
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     static const int kW = 10;
     static const int kH = 10;
diff --git a/tests/ClipBoundsTest.cpp b/tests/ClipBoundsTest.cpp
index 25f6f5c..abdd3f4 100644
--- a/tests/ClipBoundsTest.cpp
+++ b/tests/ClipBoundsTest.cpp
@@ -13,7 +13,7 @@
 
 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped
 // to the render target
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) {
     static const int kXSize = 100;
     static const int kYSize = 100;
 
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index d3ecb7d..af58bf9 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -15,7 +15,7 @@
 
 #include "SkUtils.h"
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     static const int kW = 10;
     static const int kH = 10;
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 564b094..0880ef6 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -60,7 +60,7 @@
 static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/;
 static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216;  // 2 ^ 24
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo) {
     runFPTest<float>(reporter, ctxInfo.fGrContext, FLT_MIN, FLT_MAX, FLT_EPSILON,
                      kMaxIntegerRepresentableInSPFloatingPoint,
                      FP_CONTROL_ARRAY_SIZE, kRGBA_float_GrPixelConfig);
@@ -69,7 +69,7 @@
 static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only*/;
 static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800;  // 2 ^ 11
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) {
     runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
         kMaxIntegerRepresentableInHalfFloatingPoint,
         HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig);
@@ -77,7 +77,7 @@
 
 static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/;
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) {
     runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
         kMaxIntegerRepresentableInHalfFloatingPoint,
         HALF_RGBA_CONTROL_ARRAY_SIZE, kRGBA_half_GrPixelConfig);
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index cdfa75d..2249eba 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -107,7 +107,7 @@
 // In particular it checks its interaction with the resource cache (w.r.t.
 // locking & unlocking textures).
 // TODO: need to add checks on VRAM usage!
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(GpuLayerCache, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GpuLayerCache, reporter, ctxInfo) {
     // Add one more layer than can fit in the atlas
     static const int kInitialNumLayers = TestingAccess::NumPlots() + 1;
 
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 579042f..1337d01 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -208,7 +208,7 @@
     test_image_backed(reporter, srcImage);
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) {
 
     SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext));
     if (!srcTexture) {
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index a89cd4f..a6ff087 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -666,7 +666,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_negative_blur_sigma);
 }
 #endif
@@ -712,7 +712,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_zero_blur_sigma);
 }
 #endif
@@ -746,7 +746,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_fail_affects_transparent_black);
 }
 #endif
@@ -1098,7 +1098,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_crop_rects);
 }
 #endif
@@ -1221,7 +1221,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 2, test_clipped_picture_imagefilter);
 }
 #endif
@@ -1480,7 +1480,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_offset);
 }
 #endif
@@ -1554,7 +1554,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) {
     run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_partial_crop_rect);
 }
 #endif
@@ -1695,7 +1695,7 @@
 
 #if SK_SUPPORT_GPU
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
     const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
 
     sk_sp<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext,
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index adddf41..164f118 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -139,7 +139,7 @@
     runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) {
     //  GPU -> GPU
     gpuToGpu(reporter, ctxInfo.fGrContext);
 
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 793f971..33575d5 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -176,7 +176,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) {
     test_encode(reporter, create_gpu_image(ctxInfo.fGrContext).get());
 }
 #endif
@@ -369,7 +369,7 @@
  *  but we don't have that facility (at the moment) so we use a little internal knowledge
  *  of *how* the raster version is cached, and look for that.
  */
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
     SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
     sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext));
     const uint32_t uniqueID = image->uniqueID();
@@ -640,7 +640,7 @@
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
     const SkImage::LegacyBitmapMode modes[] = {
         SkImage::kRO_LegacyBitmapMode,
         SkImage::kRW_LegacyBitmapMode,
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index 457cacc..26badb6 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -105,7 +105,7 @@
     test_premul_alpha_roundtrip(reporter, device);
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
     SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
     SkAutoTUnref<SkBaseDevice> device(
diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp
index f74bb95..5506551 100644
--- a/tests/RecordReplaceDrawTest.cpp
+++ b/tests/RecordReplaceDrawTest.cpp
@@ -141,7 +141,7 @@
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) {
     test_replacements(r, ctxInfo.fGrContext, true);
     test_replacements(r, ctxInfo.fGrContext, false);
 }
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index a140b94..0ac64ed 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -30,7 +30,7 @@
 static const int gHeight = 480;
 
 ////////////////////////////////////////////////////////////////////////////////
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     GrSurfaceDesc desc;
     desc.fConfig = kSkia8888_GrPixelConfig;
@@ -80,7 +80,7 @@
     context->setResourceCacheLimits(oldMaxNum, oldMaxBytes);
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     GrSurfaceDesc smallDesc;
     smallDesc.fFlags = kRenderTarget_GrSurfaceFlag;
@@ -188,7 +188,7 @@
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     GrGpu* gpu = context->getGpu();
     // this test is only valid for GL
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 2818ce9..a8a7966 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -213,7 +213,7 @@
 }
 
 // Test out the SkSpecialImage::makeTextureImage entry point
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     SkBitmap bm = create_bm();
 
@@ -277,7 +277,7 @@
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     SkBitmap bm = create_bm();
 
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 5528f1a..ba66a2b 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -300,7 +300,7 @@
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceBackendHandleAccessCopyOnWrite_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessCopyOnWrite_Gpu, reporter, ctxInfo) {
         const SkSurface::BackendHandleAccess accessModes[] = {
         SkSurface::kFlushRead_BackendHandleAccess,
         SkSurface::kFlushWrite_BackendHandleAccess,
@@ -398,7 +398,7 @@
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.fGrContext;
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface(surface_func(context, kOpaque_SkAlphaType, nullptr));
@@ -501,7 +501,7 @@
     REPORTER_ASSERT(reporter, image2->uniqueID() != image3->uniqueID());
 }
 // No CPU test.
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceBackendHandleAccessIDs_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessIDs_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         for (auto& test_func : { &test_backend_handle_unique_id, &test_backend_handle_gen_id }) {
             for (auto& handle_access_func :
diff --git a/tests/Test.h b/tests/Test.h
index 1363f8c..90a0139 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -170,6 +170,9 @@
 
 #define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, context_info)                          \
         DEF_GPUTEST_FOR_CONTEXTS(name, nullptr, reporter, context_info)
+#define DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info)                    \
+        DEF_GPUTEST_FOR_CONTEXTS(name, sk_gpu_test::GrContextFactory::IsRenderingContext,   \
+                                 reporter, context_info)
 #define DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(name, reporter, context_info)                       \
         DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsGLContextType, reporter, context_info)
 #define DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(name, reporter, context_info)                 \
diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp
index 174c0e2..5e5000e 100644
--- a/tests/TestTest.cpp
+++ b/tests/TestTest.cpp
@@ -38,7 +38,7 @@
 // This is an example of a GPU test that tests a property that should work for all GPU contexts that
 // produce a rendering output.
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) {
     REPORTER_ASSERT(reporter, reporter);
     REPORTER_ASSERT(reporter, ctxInfo.fGrContext);
 }