diff options
author | bsalomon <bsalomon@google.com> | 2016-04-06 14:02:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 14:02:39 -0700 |
commit | 758586c7f11a6b3529bd4a1c9b4e982a0d0b0582 (patch) | |
tree | 6a325080ce7cd2b6b1396eade7eaa3ff804b44e6 /tests | |
parent | 9e65f9399ea9d50dca723ca23c10ec4145b54abe (diff) |
Make existing unit tests only run on GL contexts
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1869503002
Review URL: https://codereview.chromium.org/1869503002
Diffstat (limited to 'tests')
38 files changed, 126 insertions, 117 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index fb38c7e46f..9ae9ab7a78 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -639,7 +639,7 @@ DEF_TEST(BitmapReadPixels, reporter) { #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_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) { static const SkPMColor kData[] = { 0xFF112233, 0xAF224499, 0xEF004466, 0x80773311 diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index 9b4bf4ebb2..2f5407c2eb 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -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_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) { SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128); auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info)); diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index 56f2fe17be..160ebb3c76 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -65,7 +65,7 @@ static bool reset_dc(SkAutoTUnref<GrDrawContext>* dc, SkAutoTUnref<GrSurface>* r return *dc != nullptr; } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 abdd3f44fa..25f6f5c068 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_RENDERING_CONTEXTS(GrClipBounds, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 af58bf9e5c..d3ecb7d0ca 100644 --- a/tests/CopySurfaceTest.cpp +++ b/tests/CopySurfaceTest.cpp @@ -15,7 +15,7 @@ #include "SkUtils.h" -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; static const int kW = 10; static const int kH = 10; diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 12646d53dc..355275727e 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -81,7 +81,7 @@ static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context, test_read_pixels(reporter, context, copy, expectedPixelValues); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { GrContext* context0 = ctxInfo.fGrContext; sk_gpu_test::GLTestContext* glCtx0 = ctxInfo.fGLContext; diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp index 0880ef67bb..564b09466a 100644 --- a/tests/FloatingPointTextureTest.cpp +++ b/tests/FloatingPointTextureTest.cpp @@ -60,7 +60,7 @@ void runFPTest(skiatest::Reporter* reporter, GrContext* context, static const int FP_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4/*RGBA*/; static const float kMaxIntegerRepresentableInSPFloatingPoint = 16777216; // 2 ^ 24 -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FloatingPointTextureTest, reporter, ctxInfo) 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_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/; -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index cf442fd2b8..8e7d800814 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -446,6 +446,16 @@ static void test_glprograms_other_contexts( REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrContext, maxStages)); } +static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) { + return type == sk_gpu_test::GrContextFactory::kNativeGL_ContextType; +} + +static bool is_other_rendering_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) { + return !is_native_gl_context_type(type) && + kOpenGL_GrBackend == sk_gpu_test::GrContextFactory::ContextTypeBackend(type) && + sk_gpu_test::GrContextFactory::IsRenderingContext(type); +} + DEF_GPUTEST(GLPrograms, reporter, /*factory*/) { // Set a locale that would cause shader compilation to fail because of , as decimal separator. // skbug 3330 @@ -459,10 +469,10 @@ DEF_GPUTEST(GLPrograms, reporter, /*factory*/) { GrContextOptions opts; opts.fSuppressPrints = true; sk_gpu_test::GrContextFactory debugFactory(opts); - skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_GPUTestContexts, + skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_context_type, reporter, &debugFactory); skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, - skiatest::kOther_GPUTestContexts, reporter, &debugFactory); + &is_other_rendering_gl_context_type, reporter, &debugFactory); } #endif diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp index 1788770e5b..558cac3633 100644 --- a/tests/GpuColorFilterTest.cpp +++ b/tests/GpuColorFilterTest.cpp @@ -32,7 +32,7 @@ static GrColor filterColor(const GrColor& color, uint32_t flags) { return color & mask; } -DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) { struct GetConstantComponentTestCase { // "Shape drawn with" uint32_t inputComponents; // "rgb of", "red of", "alpha of", ... diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index ef3b97dc1f..2dc7702fff 100644 --- a/tests/GpuDrawPathTest.cpp +++ b/tests/GpuDrawPathTest.cpp @@ -76,7 +76,7 @@ static void test_drawSameRectOvals(skiatest::Reporter*, SkCanvas* canvas) { fill_and_stroke(canvas, oval1, oval2, SkDashPathEffect::Make(intervals, 2, 0)); } -DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuDrawPath, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuDrawPath, reporter, ctxInfo) { for (auto& test_func : { &test_drawPathEmpty, &test_drawSameRectOvals }) { for (auto& sampleCount : {0, 4, 16}) { SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255); diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index 2249eba904..cdfa75d036 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -107,7 +107,7 @@ static void lock_layer(skiatest::Reporter* reporter, // 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_RENDERING_CONTEXTS(GpuLayerCache, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp index 4f927091de..fdcd52408d 100644 --- a/tests/GrDrawTargetTest.cpp +++ b/tests/GrDrawTargetTest.cpp @@ -12,7 +12,7 @@ #include "GrContext.h" #include "GrGpu.h" -DEF_GPUTEST_FOR_ALL_CONTEXTS(GrDrawTargetPrint, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GrDrawTargetPrint, reporter, ctxInfo) { // This used to assert. SkString result = ctxInfo.fGrContext->caps()->dump(); SkASSERT(!result.isEmpty()); diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index a55fffe9be..835738123e 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -28,7 +28,7 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps); static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps); -DEF_GPUTEST_FOR_NULL_CONTEXT(GrPorterDuff, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrPorterDuff, reporter, ctxInfo) { const GrCaps& caps = *ctxInfo.fGrContext->getGpu()->caps(); if (!caps.shaderCaps()->dualSourceBlendingSupport()) { SkFAIL("Null context does not support dual source blending."); diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 280a1c8a72..a7b64b7c9f 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -18,7 +18,7 @@ // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture // and render targets to GrSurface all work as expected. -DEF_GPUTEST_FOR_NULL_CONTEXT(GrSurface, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp index 0a8ecb6cbc..523bb82aae 100644 --- a/tests/GrTextureMipMapInvalidationTest.cpp +++ b/tests/GrTextureMipMapInvalidationTest.cpp @@ -19,7 +19,7 @@ // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture // and render targets to GrSurface all work as expected. -DEF_GPUTEST_FOR_NULL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index cd159f1943..579042fbe9 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -187,7 +187,7 @@ static GrTexture* create_texture(GrContext* context) { return context->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcBM.getPixels(), 0); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) { SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); if (!srcTexture) { return; @@ -208,7 +208,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct test_image_backed(reporter, srcImage); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 197dd32277..e153cc0a92 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -656,7 +656,7 @@ DEF_TEST(TestNegativeBlurSigma, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestNegativeBlurSigma_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestNegativeBlurSigma_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_negative_blur_sigma); } #endif @@ -702,7 +702,7 @@ DEF_TEST(TestZeroBlurSigma, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestZeroBlurSigma_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestZeroBlurSigma_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_zero_blur_sigma); } #endif @@ -736,7 +736,7 @@ DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_fail_affects_transparent_black); } #endif @@ -952,7 +952,7 @@ DEF_TEST(ImageFilterMergeResultSize, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_imagefilter_merge_result_size); } #endif @@ -1087,7 +1087,7 @@ DEF_TEST(ImageFilterCropRect, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_crop_rects); } #endif @@ -1210,7 +1210,7 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 2, test_clipped_picture_imagefilter); } #endif @@ -1465,7 +1465,7 @@ DEF_TEST(ComposedImageFilterOffset, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_offset); } #endif @@ -1509,7 +1509,7 @@ DEF_TEST(ComposedImageFilterBounds, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_composed_imagefilter_bounds); } #endif @@ -1539,7 +1539,7 @@ DEF_TEST(PartialCropRect, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PartialCropRect_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(PartialCropRect_Gpu, reporter, ctxInfo) { run_gpu_test(reporter, ctxInfo.fGrContext, 100, test_partial_crop_rect); } #endif @@ -1677,7 +1677,7 @@ DEF_TEST(BlurLargeImage, reporter) { #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, ctxInfo) { const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext, @@ -1691,7 +1691,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, ctxInfo) { test_huge_blur(&canvas, reporter); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) { const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctxInfo.fGrContext, @@ -1705,7 +1705,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter test_xfermode_cropped_input(&canvas, reporter); } -DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(BlurLargeImage_Gpu, reporter, ctxInfo) { auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(100, 100))); test_large_blur_input(reporter, surface->getCanvas()); diff --git a/tests/ImageFilterTest.cpp.orig b/tests/ImageFilterTest.cpp.orig index 49455c9481..52e5fefdb2 100644 --- a/tests/ImageFilterTest.cpp.orig +++ b/tests/ImageFilterTest.cpp.orig @@ -652,7 +652,7 @@ DEF_TEST(TestNegativeBlurSigma, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestNegativeBlurSigma_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestNegativeBlurSigma_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_negative_blur_sigma); } #endif @@ -698,7 +698,7 @@ DEF_TEST(TestZeroBlurSigma, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestZeroBlurSigma_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestZeroBlurSigma_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_zero_blur_sigma); } #endif @@ -732,7 +732,7 @@ DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_fail_affects_transparent_black); } #endif @@ -946,7 +946,7 @@ DEF_TEST(ImageFilterMergeResultSize, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_imagefilter_merge_result_size); } #endif @@ -1081,7 +1081,7 @@ DEF_TEST(ImageFilterCropRect, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_crop_rects); } #endif @@ -1204,7 +1204,7 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, context) { run_gpu_test(reporter, context, 2, test_clipped_picture_imagefilter); } #endif @@ -1456,7 +1456,7 @@ DEF_TEST(ComposedImageFilterOffset, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_composed_imagefilter_offset); } #endif @@ -1500,7 +1500,7 @@ DEF_TEST(ComposedImageFilterBounds, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_composed_imagefilter_bounds); } #endif @@ -1530,7 +1530,7 @@ DEF_TEST(PartialCropRect, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PartialCropRect_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(PartialCropRect_Gpu, reporter, context) { run_gpu_test(reporter, context, 100, test_partial_crop_rect); } #endif @@ -1666,7 +1666,7 @@ DEF_TEST(BlurLargeImage, reporter) { #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, context) { const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, @@ -1680,7 +1680,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HugeBlurImageFilter_Gpu, reporter, context) { test_huge_blur(&canvas, reporter); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, context) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, context) { const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, @@ -1694,7 +1694,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter test_xfermode_cropped_input(&canvas, reporter); } -DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(100, 100))); test_large_blur_input(reporter, surface->getCanvas()); diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp index 04d2e13fe2..3c08e48bec 100644 --- a/tests/ImageIsOpaqueTest.cpp +++ b/tests/ImageIsOpaqueTest.cpp @@ -66,7 +66,7 @@ DEF_TEST(ImageIsOpaqueTest, reporter) { #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5); auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, infoTransparent)); diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp index 164f11898e..adddf41dbf 100644 --- a/tests/ImageNewShaderTest.cpp +++ b/tests/ImageNewShaderTest.cpp @@ -139,7 +139,7 @@ void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) { // GPU -> GPU gpuToGpu(reporter, ctxInfo.fGrContext); diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 87fc8fd529..793f971643 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -176,7 +176,7 @@ DEF_TEST(ImageEncode, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) { test_encode(reporter, create_gpu_image(ctxInfo.fGrContext).get()); } #endif @@ -369,7 +369,7 @@ DEF_TEST(image_newfrombitmap, reporter) { * 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_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, 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(); @@ -404,7 +404,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, ctxInfo) { } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInfo) { GrContext* context = contextInfo.fGrContext; sk_gpu_test::GLTestContext* glContext = contextInfo.fGLContext; @@ -577,7 +577,7 @@ DEF_TEST(ImageReadPixels, reporter) { test_read_pixels(reporter, image.get()); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) { test_read_pixels(reporter, create_gpu_image(ctxInfo.fGrContext).get()); } #endif @@ -640,7 +640,7 @@ DEF_TEST(ImageLegacyBitmap, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) { const SkImage::LegacyBitmapMode modes[] = { SkImage::kRO_LegacyBitmapMode, SkImage::kRW_LegacyBitmapMode, @@ -684,7 +684,7 @@ DEF_TEST(ImagePeek, reporter) { test_peek(reporter, image.get(), false); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext)); test_peek(reporter, image.get(), false); } @@ -704,7 +704,7 @@ static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPM REPORTER_ASSERT(reporter, image->readPixels(info, &pixel, sizeof(pixel), 0, 0)); REPORTER_ASSERT(reporter, pixel == expected); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) { GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); const int w = 10; const int h = 10; @@ -799,7 +799,7 @@ static void check_images_same(skiatest::Reporter* reporter, const SkImage* a, co } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { for (auto create : {&create_image, &create_image_565, &create_image_ct}) { @@ -824,7 +824,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext; SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy()); diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp index 26badb66c4..457cacc2a0 100644 --- a/tests/PremulAlphaRoundTripTest.cpp +++ b/tests/PremulAlphaRoundTripTest.cpp @@ -105,7 +105,7 @@ DEF_TEST(PremulAlphaRoundTrip, reporter) { test_premul_alpha_roundtrip(reporter, device); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index d25a33c602..f8c19e3171 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -101,7 +101,7 @@ private: }; } -DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrTextureDesc desc; desc.fHeight = 1; diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 830dbb2861..9db507b981 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -387,7 +387,7 @@ DEF_TEST(ReadPixels, reporter) { test_readpixels(reporter, surface, kLastAligned_BitmapInit); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) { for (auto& origin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -442,7 +442,7 @@ static void test_readpixels_texture(skiatest::Reporter* reporter, GrTexture* tex } } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) { // On the GPU we will also try reading back from a non-renderable texture. for (auto& origin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) { SkAutoTUnref<GrTexture> texture; @@ -576,7 +576,7 @@ static void dump_to_file(const char name[], SkData* data) { * * https://bug.skia.org/4351 */ -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo) { SkBitmap bitmap; make_ringed_bitmap(&bitmap, 6, 6); const SkIRect subset = SkIRect::MakeLTRB(2, 2, 4, 4); diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 64b4ef6da7..851cf4e501 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -33,7 +33,7 @@ static void validate_alpha_data(skiatest::Reporter* reporter, int w, int h, cons } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { unsigned char alphaData[X_SIZE * Y_SIZE]; bool match; diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp index 5506551d6b..f74bb95002 100644 --- a/tests/RecordReplaceDrawTest.cpp +++ b/tests/RecordReplaceDrawTest.cpp @@ -141,7 +141,7 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool doReplace } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) { test_replacements(r, ctxInfo.fGrContext, true); test_replacements(r, ctxInfo.fGrContext, false); } diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index a4a1cf7960..3c2a50d630 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -137,7 +137,7 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context, } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext; static const int kWidth = 13; diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 0ac64edd07..a140b94cfd 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -30,7 +30,7 @@ static const int gWidth = 640; static const int gHeight = 480; //////////////////////////////////////////////////////////////////////////////// -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; @@ -80,7 +80,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { context->setResourceCacheLimits(oldMaxNum, oldMaxBytes); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrSurfaceDesc smallDesc; smallDesc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -188,7 +188,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInf } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; GrGpu* gpu = context->getGpu(); // this test is only valid for GL diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index 1067baa9e2..a652e94bfc 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -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_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; #if defined(GOOGLE3) // Stack frame size is limited in GOOGLE3. diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index f16f5ff84c..1c71f7563a 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -203,7 +203,7 @@ static void test_texture_backed(skiatest::Reporter* reporter, } // Test out the SkSpecialImage::makeTextureImage entry point -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; SkBitmap bm = create_bm(); @@ -267,7 +267,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; SkBitmap bm = create_bm(); diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp index b55bc4eb94..db1aaf0038 100644 --- a/tests/SpecialSurfaceTest.cpp +++ b/tests/SpecialSurfaceTest.cpp @@ -82,7 +82,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) { #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -96,7 +96,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { } // test the more flexible factory -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu2, reporter, ctxInfo) { GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index e4d0519c78..5528f1a170 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -74,7 +74,7 @@ DEF_TEST(SurfaceEmpty, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) { const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType); REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info, 0, @@ -83,7 +83,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) { #endif #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWrappedTexture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceWrappedTexture, reporter, ctxInfo) { GrGpu* gpu = ctxInfo.fGrContext->getGpu(); if (!gpu) { return; @@ -186,7 +186,7 @@ DEF_TEST(SurfaceCanvasPeek, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { SkImageInfo requestInfo; auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, &requestInfo)); @@ -219,7 +219,7 @@ DEF_TEST(SurfaceAccessPixels, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceAccessPixels_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAccessPixels_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); test_access_pixels(reporter, surface); @@ -248,7 +248,7 @@ DEF_TEST(SurfaceSnapshotAlphaType, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceSnapshotAlphaType_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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; @@ -300,7 +300,7 @@ DEF_TEST(SurfaceBackendHandleAccessCopyOnWrite, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessCopyOnWrite_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceBackendHandleAccessCopyOnWrite_Gpu, reporter, ctxInfo) { const SkSurface::BackendHandleAccess accessModes[] = { SkSurface::kFlushRead_BackendHandleAccess, SkSurface::kFlushWrite_BackendHandleAccess, @@ -398,7 +398,7 @@ DEF_TEST(UniqueImageSnapshot, reporter) { } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 @@ static void test_backend_handle_unique_id( REPORTER_ASSERT(reporter, image2->uniqueID() != image3->uniqueID()); } // No CPU test. -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessIDs_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 : @@ -593,7 +593,7 @@ DEF_TEST(SurfaceCopyOnWrite, reporter) { test_copy_on_write(reporter, create_surface().get()); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); test_copy_on_write(reporter, surface.get()); @@ -615,7 +615,7 @@ DEF_TEST(SurfaceWriteableAfterSnapshotRelease, reporter) { test_writable_after_snapshot_release(reporter, create_surface().get()); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); test_writable_after_snapshot_release(reporter, surface.get()); @@ -656,7 +656,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_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface1(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); auto surface2(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); @@ -673,7 +673,7 @@ DEF_TEST(SurfaceGetTexture, reporter) { REPORTER_ASSERT(reporter, as_IB(image)->peekTexture() == nullptr); } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); sk_sp<SkImage> image(surface->makeImageSnapshot()); @@ -705,7 +705,7 @@ static SkBudgeted is_budgeted(const sk_sp<SkImage> image) { return is_budgeted(image.get()); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBudget, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 }) { @@ -767,7 +767,7 @@ DEF_TEST(SurfaceNoCanvas, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceNoCanvas_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_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 }) { @@ -858,7 +858,7 @@ void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> surface, } } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = { [] (SkSurface* s){ return s->getCanvas()->internal_private_accessTopLayerRenderTarget(); }, diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 32973ee1c8..b53075be8e 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -252,7 +252,7 @@ static void test_path(GrDrawTarget* dt, GrRenderTarget* rt, GrResourceProvider* tess.drawPath(args); } -DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fWidth = 800; diff --git a/tests/Test.h b/tests/Test.h index de99fa53e0..ac68cccf95 100644 --- a/tests/Test.h +++ b/tests/Test.h @@ -77,22 +77,22 @@ typedef SkTRegistry<Test> TestRegistry; ... } */ -enum GPUTestContexts { - kNone_GPUTestContexts = 0, - kNull_GPUTestContexts = 1, - kDebug_GPUTestContexts = 1 << 1, - kNative_GPUTestContexts = 1 << 2, - kOther_GPUTestContexts = 1 << 3, // Other than native, used only for below. - kAllRendering_GPUTestContexts = kNative_GPUTestContexts | kOther_GPUTestContexts, - kAll_GPUTestContexts = kAllRendering_GPUTestContexts - | kNull_GPUTestContexts - | kDebug_GPUTestContexts -}; + +#if SK_SUPPORT_GPU +using GrContextFactoryContextType = sk_gpu_test::GrContextFactory::ContextType; +#else +using GrContextFactoryContextType = int; +#endif typedef void GrContextTestFn(Reporter*, const sk_gpu_test::ContextInfo&); +typedef bool GrContextTypeFilterFn(GrContextFactoryContextType); + +extern bool IsGLContextType(GrContextFactoryContextType); +extern bool IsRenderingGLContextType(GrContextFactoryContextType); +extern bool IsNullGLContextType(GrContextFactoryContextType); -void RunWithGPUTestContexts(GrContextTestFn* testFunction, GPUTestContexts contexts, - Reporter* reporter, sk_gpu_test::GrContextFactory* factory); +void RunWithGPUTestContexts(GrContextTestFn*, GrContextTypeFilterFn*, + Reporter*, sk_gpu_test::GrContextFactory*); /** Timer provides wall-clock duration since its creation. */ class Timer { @@ -167,13 +167,12 @@ private: void test_##name(skiatest::Reporter* reporter, \ const sk_gpu_test::ContextInfo& context_info) -#define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, context_info) \ - DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAll_GPUTestContexts, reporter, context_info) -#define DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, context_info) \ - DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kAllRendering_GPUTestContexts, reporter, \ - context_info) -#define DEF_GPUTEST_FOR_NULL_CONTEXT(name, reporter, context_info) \ - DEF_GPUTEST_FOR_CONTEXTS(name, skiatest::kNull_GPUTestContexts, 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) \ + DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsRenderingGLContextType, reporter, context_info) +#define DEF_GPUTEST_FOR_NULLGL_CONTEXT(name, reporter, context_info) \ + DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsNullGLContextType, reporter, context_info) #define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \ do { \ diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 7443ffe325..174c0e2459 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -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_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { +DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); REPORTER_ASSERT(reporter, ctxInfo.fGrContext); } @@ -38,7 +38,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { // 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_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); REPORTER_ASSERT(reporter, ctxInfo.fGrContext); } @@ -47,7 +47,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) // This is an example of a GPU test that tests a property that uses the null GPU context. It should // be used if the test tests some behavior that is mocked with the null context. #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_NULL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); REPORTER_ASSERT(reporter, ctxInfo.fGrContext); } diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp index d13d251f36..8f95cf00e7 100644 --- a/tests/TextBlobCacheTest.cpp +++ b/tests/TextBlobCacheTest.cpp @@ -156,19 +156,19 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContext* conte draw(canvas, 1, blobs); } -DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobCache, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobCache, reporter, ctxInfo) { text_blob_cache_inner(reporter, ctxInfo.fGrContext, 1024, 256, 30, true, false); } -DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobStressCache, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobStressCache, reporter, ctxInfo) { text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, true, true); } -DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobAbnormal, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobAbnormal, reporter, ctxInfo) { text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, false, false); } -DEF_GPUTEST_FOR_NULL_CONTEXT(TextBlobStressAbnormal, reporter, ctxInfo) { +DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobStressAbnormal, reporter, ctxInfo) { text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, false, true); } #endif diff --git a/tests/TextureStorageAllocator.cpp b/tests/TextureStorageAllocator.cpp index 433b365932..f28855e5a9 100644 --- a/tests/TextureStorageAllocator.cpp +++ b/tests/TextureStorageAllocator.cpp @@ -53,7 +53,7 @@ class TestStorageAllocator { bool m_allowAllocation; }; -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CustomTexture, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(CustomTexture, reporter, ctxInfo) { GrContext* context = ctxInfo.fGrContext; sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext; static const int kWidth = 13; @@ -90,7 +90,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CustomTexture, reporter, ctxInfo) { REPORTER_ASSERT(reporter, GrColorUnpackG(dest) == 255); } -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CustomTextureFailure, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(CustomTextureFailure, reporter, ctxInfo) { static const int kWidth = 13; static const int kHeight = 13; diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 669d885c96..367942f508 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -406,7 +406,7 @@ DEF_TEST(WritePixels, reporter) { } } #if SK_SUPPORT_GPU -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { +DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; |