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
This commit is contained in:
bsalomon 2016-04-06 14:02:39 -07:00 committed by Commit bot
parent 9e65f9399e
commit 758586c7f1
40 changed files with 161 additions and 154 deletions

View File

@ -1415,48 +1415,41 @@ int dm_main() {
// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
namespace skiatest {
void RunWithGPUTestContexts(GrContextTestFn* test, GPUTestContexts testContexts,
#if SK_SUPPORT_GPU
bool IsGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return kOpenGL_GrBackend == GrContextFactory::ContextTypeBackend(type);
}
bool IsRenderingGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return IsGLContextType(type) && GrContextFactory::IsRenderingContext(type);
}
bool IsNullGLContextType(sk_gpu_test::GrContextFactory::ContextType type) {
return type == GrContextFactory::kNullGL_ContextType;
}
#else
bool IsGLContextType(int) { return false; }
bool IsRenderingGLContextType(int) { return false; }
bool IsNullGLContextType(int) { return false; }
#endif
void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contextTypeFilter,
Reporter* reporter, GrContextFactory* factory) {
#if SK_SUPPORT_GPU
// Iterate over context types, except use "native" instead of explicitly trying OpenGL and
// OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing
// http://skbug.com/2809
GrContextFactory::ContextType contextTypes[] = {
GrContextFactory::kNativeGL_ContextType,
#if SK_ANGLE
#ifdef SK_BUILD_FOR_WIN
GrContextFactory::kANGLE_ContextType,
#endif
GrContextFactory::kANGLE_GL_ContextType,
#endif
#if SK_COMMAND_BUFFER
GrContextFactory::kCommandBuffer_ContextType,
#endif
#if SK_MESA
GrContextFactory::kMESA_ContextType,
#endif
GrContextFactory::kNullGL_ContextType,
GrContextFactory::kDebugGL_ContextType,
};
// Should have named all the context types except one of GL or GLES.
static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kContextTypeCnt - 1,
"Skipping unexpected ContextType for GPU tests");
for (auto& contextType : contextTypes) {
int contextSelector = kNone_GPUTestContexts;
if (GrContextFactory::IsRenderingContext(contextType)) {
contextSelector |= kAllRendering_GPUTestContexts;
} else if (contextType == GrContextFactory::kNativeGL_ContextType) {
contextSelector |= kNative_GPUTestContexts;
} else if (contextType == GrContextFactory::kNullGL_ContextType) {
contextSelector |= kNull_GPUTestContexts;
} else if (contextType == GrContextFactory::kDebugGL_ContextType) {
contextSelector |= kDebug_GPUTestContexts;
}
if ((testContexts & contextSelector) == 0) {
for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
ContextInfo ctxInfo = factory->getContextInfo(contextType);
if (!(*contextTypeFilter)(contextType)) {
continue;
}
ContextInfo ctxInfo = factory->getContextInfo(contextType);
// Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on,
// desktop since tests do not account for not fixing http://skbug.com/2809
if (contextType == GrContextFactory::kGL_ContextType ||
contextType == GrContextFactory::kGLES_ContextType) {
if (contextType != GrContextFactory::kNativeGL_ContextType) {
continue;
}
}
if (ctxInfo.fGrContext) {
(*test)(reporter, ctxInfo);
}

View File

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

View 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_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));

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

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

View File

@ -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", ...

View File

@ -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);

View File

@ -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;

View File

@ -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());

View File

@ -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.");

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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());

View File

@ -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());

View File

@ -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));

View File

@ -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);

View File

@ -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());

View File

@ -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(

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

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

View 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_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.

View File

@ -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();

View File

@ -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;

View File

@ -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(); },

View File

@ -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;

View File

@ -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);
void RunWithGPUTestContexts(GrContextTestFn* testFunction, GPUTestContexts contexts,
Reporter* reporter, sk_gpu_test::GrContextFactory* factory);
extern bool IsGLContextType(GrContextFactoryContextType);
extern bool IsRenderingGLContextType(GrContextFactoryContextType);
extern bool IsNullGLContextType(GrContextFactoryContextType);
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 { \

View 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_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);
}

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -80,6 +80,11 @@ public:
}
}
static GrBackend ContextTypeBackend(ContextType type) {
// Currently all the context types use the GL backed
return kOpenGL_GrBackend;
}
static const char* ContextTypeName(ContextType type) {
switch (type) {
case kGL_ContextType: