Enable many more tests for Vulkan
authoregdaniel <egdaniel@google.com>
Tue, 28 Jun 2016 15:07:26 +0000 (08:07 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 28 Jun 2016 15:07:26 +0000 (08:07 -0700)
BUG=skia:5461
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2103133002

Review-Url: https://codereview.chromium.org/2103133002

13 files changed:
include/gpu/vk/GrVkTypes.h
src/gpu/vk/GrVkImage.cpp
tests/BlurTest.cpp
tests/ImageFilterCacheTest.cpp
tests/ImageFilterTest.cpp
tests/ImageIsOpaqueTest.cpp
tests/ImageTest.cpp
tests/ProxyTest.cpp
tests/ReadWriteAlphaTest.cpp
tests/SRGBReadWritePixelsTest.cpp
tests/SpecialSurfaceTest.cpp
tests/SurfaceTest.cpp
tests/TestTest.cpp

index 4647343226970b3450e2a2ae78db9c849447632b..782cb90b21ed8dffe28fc2e71cea19326d890063 100644 (file)
@@ -27,7 +27,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 /**
- * Types for interacting with Vulkan resources created externally to Skia. GrBackendObjects for 
+ * Types for interacting with Vulkan resources created externally to Skia. GrBackendObjects for
  * Vulkan textures are really const GrVkImageInfo*
  */
 struct GrVkAlloc {
index 70dd4486ae3dee89c1eb057d6ae4d8498cfb4875..11e27ed66404575200852c7603887bdfff224f6c 100644 (file)
@@ -61,6 +61,9 @@ void GrVkImage::setImageLayout(const GrVkGpu* gpu, VkImageLayout newLayout,
 }
 
 bool GrVkImage::InitImageInfo(const GrVkGpu* gpu, const ImageDesc& imageDesc, GrVkImageInfo* info) {
+    if (0 == imageDesc.fWidth || 0 == imageDesc.fHeight) {
+        return false;
+    }
     VkImage image = 0;
     GrVkAlloc alloc;
 
index 731657acde006219858b043cfd9d1790eb415a2f..c40634c12a2aa7f99b102e6b06b8e8719554eb06 100644 (file)
@@ -556,7 +556,7 @@ DEF_TEST(BlurAsABlur, reporter) {
 
 // This exercises the problem discovered in crbug.com/570232. The return value from
 // SkBlurMask::BoxBlur wasn't being checked in SkBlurMaskFilter.cpp::GrRRectBlurEffect::Create
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
 
     SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
     auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info));
index 9f46a35fd7f036dc918ce7e4b3032a698f66b2b4..640debbf8b227f548c0c4b41829e0069b6a39e96 100644 (file)
@@ -190,7 +190,7 @@ static GrTexture* create_texture(GrContext* context) {
     return context->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcBM.getPixels(), 0);
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
     SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.grContext()));
     if (!srcTexture) {
         return;
index 12b1caa16dbecb7cfdb9959301fe9f5eb7461dd3..dd0824551b157342e0791c9cd537bedc1812de45 100644 (file)
@@ -915,7 +915,7 @@ DEF_TEST(ImageFilterMergeResultSize, reporter) {
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
     test_imagefilter_merge_result_size(reporter, ctxInfo.grContext());
 }
 #endif
@@ -1083,8 +1083,8 @@ DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) {
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
-                                      reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
+                                   reporter, ctxInfo) {
     test_big_kernel(reporter, ctxInfo.grContext());
 }
 #endif
@@ -1514,7 +1514,7 @@ DEF_TEST(ComposedImageFilterBounds, reporter) {
 }
 
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
     test_composed_imagefilter_bounds(reporter, ctxInfo.grContext());
 }
 #endif
@@ -1753,7 +1753,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
     test_huge_blur(canvas, reporter);
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) {
 
     sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
                                                       SkBudgeted::kNo,
@@ -1765,7 +1765,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, repor
     test_xfermode_cropped_input(canvas, reporter);
 }
 
-DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_ALL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
     auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes,
                                              SkImageInfo::MakeN32Premul(100, 100)));
     test_large_blur_input(reporter, surface->getCanvas());
index 843c1d1aa0fd443950d4d12ef564dbfaf44358f7..0660885a54529cdc2d7ed99993846794f9cd0761 100644 (file)
@@ -72,7 +72,7 @@ DEF_TEST(ImageIsOpaqueTest, reporter) {
 
 #if SK_SUPPORT_GPU
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
     auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, infoTransparent));
index e681b1a702311f383d919a9188a704c617b66e43..4d43e46eb13c487a04cf1325400414831b8b9226 100644 (file)
@@ -597,7 +597,7 @@ DEF_TEST(ImageReadPixels, reporter) {
     test_read_pixels(reporter, image.get());
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) {
     test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get());
 }
 #endif
@@ -704,7 +704,7 @@ DEF_TEST(ImagePeek, reporter) {
     test_peek(reporter, image.get(), false);
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) {
     sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
     test_peek(reporter, image.get(), false);
 }
@@ -819,7 +819,7 @@ static void check_images_same(skiatest::Reporter* reporter, const SkImage* a, co
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) {
     for (auto create : {&create_image,
                         &create_image_565,
                         &create_image_ct}) {
index 5f27b89f5a6c951efa62511e01c6d7e5917f09d6..2ed4591a723c83eb562f3d0f7d63fd6e71821c29 100644 (file)
@@ -75,7 +75,7 @@ static void check_texture(skiatest::Reporter* reporter,
 }
 
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) {
     GrTextureProvider* provider = ctxInfo.grContext()->textureProvider();
 
     for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
@@ -122,7 +122,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) {
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
     GrTextureProvider* provider = ctxInfo.grContext()->textureProvider();
 
     static const int kWidthHeight = 100;
index cc83b860dec3bc130aab98ba943a294d4af167a5..630924aca69074bd5f73cac6a9210918a34b3d4e 100644 (file)
@@ -34,7 +34,7 @@ static void validate_alpha_data(skiatest::Reporter* reporter, int w, int h, cons
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
     unsigned char alphaData[X_SIZE * Y_SIZE];
 
     static const int kClearValue = 0x2;
index fdaa587de73cf0ee7e686f1d7085a2e3f43af131..840575a1c4e79b0981a125d31ad5076216028161 100644 (file)
@@ -138,7 +138,7 @@ void read_and_check_pixels(skiatest::Reporter* reporter, GrTexture* texture, uin
 
 // TODO: Add tests for copySurface between srgb/linear textures. Add tests for unpremul/premul
 // conversion during read/write along with srgb/linear conversions.
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
 #if defined(GOOGLE3)
     // Stack frame size is limited in GOOGLE3.
index 4b816910401573fe5039b7470887e2f26a13a40f..2bb1005e2a6980f7696d4b5cdb513cb125d7f88f 100644 (file)
@@ -78,7 +78,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) {
 
 #if SK_SUPPORT_GPU
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
     sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(),
                                                                     kSmallerSize, kSmallerSize,
                                                                     kSkia8888_GrPixelConfig));
index bf6445f00c81025e437fa8ea87826655facacffd..a92ecbe50b105befb7ac5e0d53e8ab6185fd5ef7 100644 (file)
@@ -76,7 +76,7 @@ DEF_TEST(SurfaceEmpty, reporter) {
 
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) {
     const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
     REPORTER_ASSERT(reporter, nullptr ==
                     SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info, 0,
@@ -119,7 +119,7 @@ DEF_TEST(SurfaceCanvasPeek, reporter) {
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         SkImageInfo requestInfo;
         auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, &requestInfo));
@@ -152,7 +152,7 @@ DEF_TEST(SurfaceAccessPixels, reporter) {
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAccessPixels_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceAccessPixels_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
         test_access_pixels(reporter, surface);
@@ -181,7 +181,7 @@ DEF_TEST(SurfaceSnapshotAlphaType, reporter) {
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceSnapshotAlphaType_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceSnapshotAlphaType_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         for (auto& isOpaque : { true, false }) {
             SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
@@ -526,7 +526,7 @@ DEF_TEST(SurfaceCopyOnWrite, reporter) {
     test_copy_on_write(reporter, create_surface().get());
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
         test_copy_on_write(reporter, surface.get());
@@ -548,7 +548,7 @@ DEF_TEST(SurfaceWriteableAfterSnapshotRelease, reporter) {
     test_writable_after_snapshot_release(reporter, create_surface().get());
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
         test_writable_after_snapshot_release(reporter, surface.get());
@@ -589,7 +589,7 @@ static void test_crbug263329(skiatest::Reporter* reporter,
     REPORTER_ASSERT(reporter, as_IB(image3)->peekTexture() != as_IB(image1)->peekTexture());
     REPORTER_ASSERT(reporter, as_IB(image2)->peekTexture() != as_IB(image1)->peekTexture());
 }
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface1(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
         auto surface2(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
@@ -606,7 +606,7 @@ DEF_TEST(SurfaceGetTexture, reporter) {
     REPORTER_ASSERT(reporter, as_IB(image)->peekTexture() == nullptr);
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
         sk_sp<SkImage> image(surface->makeImageSnapshot());
@@ -638,7 +638,7 @@ static SkBudgeted is_budgeted(const sk_sp<SkImage> image) {
     return is_budgeted(image.get());
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceBudget, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBudget, reporter, ctxInfo) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(8,8);
     for (auto sbudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
         for (auto ibudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
@@ -700,7 +700,7 @@ DEF_TEST(SurfaceNoCanvas, reporter) {
     }
 }
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceNoCanvas_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceNoCanvas_Gpu, reporter, ctxInfo) {
     SkSurface::ContentChangeMode modes[] =
             { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
@@ -841,7 +841,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
 
     std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = {
-        [] (SkSurface* s){ 
+        [] (SkSurface* s){
             GrDrawContext* dc = s->getCanvas()->internal_private_accessTopLayerDrawContext();
             return dc->accessRenderTarget(); },
         [] (SkSurface* s){
@@ -913,7 +913,7 @@ static void test_surface_draw_partially(
     }
 }
 
-DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
     GrGpu* gpu = ctxInfo.grContext()->getGpu();
     if (!gpu) {
         return;
index 27ec1634dfe8e339daf467b050dbb398fc1e51f9..d366bb470393dd439bd2705de1e2b593c444ad92 100644 (file)
@@ -29,7 +29,7 @@ DEF_GPUTEST(TestGpuFactory, reporter, factory) {
 // This is an example of a GPU test that tests a property that should work for all GPU contexts.
 // Note: Some of the contexts might not produce a rendering output.
 #if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) {
     REPORTER_ASSERT(reporter, reporter);
     REPORTER_ASSERT(reporter, ctxInfo.grContext());
 }