diff options
author | bsalomon <bsalomon@google.com> | 2016-05-11 06:33:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-11 06:33:06 -0700 |
commit | 8b7451aaf6b1c71e9d343a4df107893db277b6aa (patch) | |
tree | b1416c3e9a154a74ff004135d41b5eefd68c0ed9 | |
parent | 70142347f7b4ef49745e828d93026fc153a72845 (diff) |
Turn ContextInfos returned by GrContextFactory into structs.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1966013002
Review-Url: https://codereview.chromium.org/1966013002
48 files changed, 164 insertions, 156 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index 7999ad5c61..30eab5c3d8 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -191,7 +191,7 @@ struct GPUTarget : public Target { SkBudgeted::kNo, info, this->config.samples, &props); this->gl = gGrFactory->getContextInfo(this->config.ctxType, - this->config.ctxOptions).fGLContext; + this->config.ctxOptions).glContext(); if (!this->surface.get()) { return false; } @@ -1438,12 +1438,12 @@ void RunWithGPUTestContexts(GrContextTestFn* test, GrContextTypeFilterFn* contex continue; } } - if (ctxInfo.fGrContext) { + if (ctxInfo.grContext()) { (*test)(reporter, ctxInfo); } ctxInfo = factory->getContextInfo(contextType, GrContextFactory::kEnableNVPR_ContextOptions); - if (ctxInfo.fGrContext) { + if (ctxInfo.grContext()) { (*test)(reporter, ctxInfo); } } diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index f99afe4859..b1e280d289 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1086,8 +1086,8 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co SkImageInfo::Make(size.width(), size.height(), fColorType, kPremul_SkAlphaType, fProfileType); #if SK_SUPPORT_GPU - const int maxDimension = factory.getContextInfo(fContextType, fContextOptions). - fGrContext->caps()->maxTextureSize(); + GrContext* context = factory.getContextInfo(fContextType, fContextOptions).grContext(); + const int maxDimension = context->caps()->maxTextureSize(); if (maxDimension < SkTMax(size.width(), size.height())) { return Error::Nonfatal("Src too large to create a texture.\n"); } diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp index dd79b879b5..5872422f41 100644 --- a/tests/ApplyGammaTest.cpp +++ b/tests/ApplyGammaTest.cpp @@ -68,7 +68,7 @@ bool check_gamma(uint32_t src, uint32_t dst, float gamma, float error, uint32_t* } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); static const int kW = 10; static const int kH = 10; static const size_t kRowBytes = sizeof(uint32_t) * kW; diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index fb38c7e46f..717109dd20 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -667,8 +667,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) { const void* srcData = (kSkia8888_GrPixelConfig == desc.fConfig) ? kData : swizData; SkAutoTUnref<GrTexture> texture( - ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo, srcData, - 0)); + ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, + srcData, 0)); if (!texture) { continue; diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index 2f5407c2eb..731657acde 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -559,7 +559,7 @@ DEF_TEST(BlurAsABlur, reporter) { DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) { SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128); - auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info)); + auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); SkCanvas* canvas = surface->getCanvas(); SkRect r = SkRect::MakeXYWH(10, 10, 100, 100); diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index d227cb8073..64464aa18b 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -53,7 +53,7 @@ static bool reset_dc(sk_sp<GrDrawContext>* dc, GrContext* context, int w, int h) } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); static const int kW = 10; static const int kH = 10; diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp index af58bf9e5c..540d013c60 100644 --- a/tests/CopySurfaceTest.cpp +++ b/tests/CopySurfaceTest.cpp @@ -16,7 +16,7 @@ #include "SkUtils.h" DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); static const int kW = 10; static const int kH = 10; static const size_t kRowBytes = sizeof(uint32_t) * kW; diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 355275727e..4a23a9c3f5 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -82,8 +82,8 @@ static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context, } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { - GrContext* context0 = ctxInfo.fGrContext; - sk_gpu_test::GLTestContext* glCtx0 = ctxInfo.fGLContext; + GrContext* context0 = ctxInfo.grContext(); + sk_gpu_test::GLTestContext* glCtx0 = ctxInfo.glContext(); // Try to create a second GL context and then check if the contexts have necessary // extensions to run this test. diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp index 0880ef67bb..9f543667f1 100644 --- a/tests/FloatingPointTextureTest.cpp +++ b/tests/FloatingPointTextureTest.cpp @@ -61,7 +61,7 @@ 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) { - runFPTest<float>(reporter, ctxInfo.fGrContext, FLT_MIN, FLT_MAX, FLT_EPSILON, + runFPTest<float>(reporter, ctxInfo.grContext(), FLT_MIN, FLT_MAX, FLT_EPSILON, kMaxIntegerRepresentableInSPFloatingPoint, FP_CONTROL_ARRAY_SIZE, kRGBA_float_GrPixelConfig); } @@ -70,7 +70,7 @@ static const int HALF_ALPHA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 1 /*alpha-only* static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2 ^ 11 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) { - runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, + runFPTest<SkHalf>(reporter, ctxInfo.grContext(), SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, kMaxIntegerRepresentableInHalfFloatingPoint, HALF_ALPHA_CONTROL_ARRAY_SIZE, kAlpha_half_GrPixelConfig); } @@ -78,7 +78,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) { - runFPTest<SkHalf>(reporter, ctxInfo.fGrContext, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon, + runFPTest<SkHalf>(reporter, ctxInfo.grContext(), 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 c5d61d87cb..cc1e0b9332 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -424,17 +424,17 @@ static int get_glprograms_max_stages(GrContext* context) { static void test_glprograms_native(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo) { - int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); + int maxStages = get_glprograms_max_stages(ctxInfo.grContext()); if (maxStages == 0) { return; } - REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrContext, maxStages)); + REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContext(), maxStages)); } static void test_glprograms_other_contexts( skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo) { - int maxStages = get_glprograms_max_stages(ctxInfo.fGrContext); + int maxStages = get_glprograms_max_stages(ctxInfo.grContext()); #ifdef SK_BUILD_FOR_WIN // Some long shaders run out of temporary registers in the D3D compiler on ANGLE and // command buffer. @@ -443,7 +443,7 @@ static void test_glprograms_other_contexts( if (maxStages == 0) { return; } - REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.fGrContext, maxStages)); + REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContext(), maxStages)); } static bool is_native_gl_context_type(sk_gpu_test::GrContextFactory::ContextType type) { diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp index 1788770e5b..b18af18b1c 100644 --- a/tests/GpuColorFilterTest.cpp +++ b/tests/GpuColorFilterTest.cpp @@ -99,7 +99,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) { for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) { const GetConstantComponentTestCase& test = filterTests[i]; auto cf(SkColorFilter::MakeModeFilter(test.filterColor, test.filterMode)); - SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(ctxInfo.fGrContext)); + SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(ctxInfo.grContext())); REPORTER_ASSERT(reporter, fp); GrInvariantOutput inout(test.inputColor, static_cast<GrColorComponentFlags>(test.inputComponents), diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index dc8db0ff70..c0b31f0737 100644 --- a/tests/GpuDrawPathTest.cpp +++ b/tests/GpuDrawPathTest.cpp @@ -81,8 +81,8 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuDrawPath, reporter, ctxInfo) { for (auto& sampleCount : {0, 4, 16}) { SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255); auto surface( - SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info, sampleCount, - nullptr)); + SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info, + sampleCount, nullptr)); if (!surface) { continue; } diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index eea81db385..9c6d9e2e3d 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -126,9 +126,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GpuLayerCache, reporter, ctxInfo) { picture = recorder.finishRecordingAsPicture(); } - GrResourceCache* resourceCache = ctxInfo.fGrContext->getResourceCache(); + GrResourceCache* resourceCache = ctxInfo.grContext()->getResourceCache(); - GrLayerCache cache(ctxInfo.fGrContext); + GrLayerCache cache(ctxInfo.grContext()); create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); diff --git a/tests/GrContextAbandonTest.cpp b/tests/GrContextAbandonTest.cpp index 8981657029..03e45128b0 100644 --- a/tests/GrContextAbandonTest.cpp +++ b/tests/GrContextAbandonTest.cpp @@ -20,7 +20,7 @@ DEF_GPUTEST(GrContext_abandonContext, reporter, /*factory*/) { GrContextFactory testFactory; GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; ContextInfo info = testFactory.getContextInfo(ctxType); - if (GrContext* context = info.fGrContext) { + if (GrContext* context = info.grContext()) { switch (testType) { case 0: context->abandonContext(); diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index fe4f1ef82f..e710ca4867 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -75,26 +75,26 @@ DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; ContextInfo info1 = testFactory.getContextInfo(ctxType); - if (!info1.fGrContext) { + if (!info1.grContext()) { continue; } if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { - REPORTER_ASSERT(reporter, info1.fGLContext); + REPORTER_ASSERT(reporter, info1.glContext()); } // Ref for comparison. The API does not explicitly say that this stays alive. - info1.fGrContext->ref(); + info1.grContext()->ref(); testFactory.abandonContexts(); // Test that we get different context after abandon. ContextInfo info2 = testFactory.getContextInfo(ctxType); - REPORTER_ASSERT(reporter, info2.fGrContext); + REPORTER_ASSERT(reporter, info2.grContext()); if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { - REPORTER_ASSERT(reporter, info2.fGLContext); + REPORTER_ASSERT(reporter, info2.glContext()); } - REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); - // fGLContext should also change, but it also could get the same address. + REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext()); + // The GL context should also change, but it also could get the same address. - info1.fGrContext->unref(); + info1.grContext()->unref(); } } diff --git a/tests/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp index 4f927091de..c8492bc3ad 100644 --- a/tests/GrDrawTargetTest.cpp +++ b/tests/GrDrawTargetTest.cpp @@ -14,9 +14,9 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrDrawTargetPrint, reporter, ctxInfo) { // This used to assert. - SkString result = ctxInfo.fGrContext->caps()->dump(); + SkString result = ctxInfo.grContext()->caps()->dump(); SkASSERT(!result.isEmpty()); - SkString shaderResult = ctxInfo.fGrContext->caps()->shaderCaps()->dump(); + SkString shaderResult = ctxInfo.grContext()->caps()->shaderCaps()->dump(); SkASSERT(!shaderResult.isEmpty()); } diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 608e5f2a84..a5ac868023 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -29,7 +29,7 @@ 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_NULLGL_CONTEXT(GrPorterDuff, reporter, ctxInfo) { - const GrCaps& caps = *ctxInfo.fGrContext->getGpu()->caps(); + const GrCaps& caps = *ctxInfo.grContext()->getGpu()->caps(); if (!caps.shaderCaps()->dualSourceBlendingSupport()) { SkFAIL("Null context does not support dual source blending."); return; diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index a7b64b7c9f..e61b934a71 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.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_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp index 523bb82aae..e8f6bcce6a 100644 --- a/tests/GrTextureMipMapInvalidationTest.cpp +++ b/tests/GrTextureMipMapInvalidationTest.cpp @@ -20,7 +20,7 @@ // Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture // and render targets to GrSurface all work as expected. DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrTextureMipMapInvalidationTest, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index a7240dc417..9f46a35fd7 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -191,7 +191,7 @@ static GrTexture* create_texture(GrContext* context) { } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) { - SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); + SkAutoTUnref<GrTexture> srcTexture(create_texture(ctxInfo.grContext())); if (!srcTexture) { return; } @@ -203,7 +203,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, backendDesc.fHeight = kFullSize; backendDesc.fSampleCnt = 0; backendDesc.fTextureHandle = srcTexture->getTextureHandle(); - sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.fGrContext, backendDesc, kPremul_SkAlphaType)); + sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(ctxInfo.grContext(), backendDesc, kPremul_SkAlphaType)); if (!srcImage) { return; } @@ -213,7 +213,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) { - sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.fGrContext)); + sk_sp<GrTexture> srcTexture(create_texture(ctxInfo.grContext())); if (!srcTexture) { return; } diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 592f5c6b86..ed98ef4ab9 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -614,7 +614,7 @@ DEF_TEST(ImageFilterNegativeBlurSigma, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) { - test_negative_blur_sigma(reporter, ctxInfo.fGrContext); + test_negative_blur_sigma(reporter, ctxInfo.grContext()); } #endif @@ -658,7 +658,7 @@ DEF_TEST(ImageFilterZeroBlurSigma, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) { - test_zero_blur_sigma(reporter, ctxInfo.fGrContext); + test_zero_blur_sigma(reporter, ctxInfo.grContext()); } #endif @@ -690,7 +690,7 @@ DEF_TEST(ImageFilterFailAffectsTransparentBlack, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) { - test_fail_affects_transparent_black(reporter, ctxInfo.fGrContext); + test_fail_affects_transparent_black(reporter, ctxInfo.grContext()); } #endif @@ -904,7 +904,7 @@ DEF_TEST(ImageFilterMergeResultSize, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) { - test_imagefilter_merge_result_size(reporter, ctxInfo.fGrContext); + test_imagefilter_merge_result_size(reporter, ctxInfo.grContext()); } #endif @@ -1073,7 +1073,7 @@ DEF_TEST(ImageFilterMatrixConvolutionBigKernel, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu, reporter, ctxInfo) { - test_big_kernel(reporter, ctxInfo.fGrContext); + test_big_kernel(reporter, ctxInfo.grContext()); } #endif @@ -1083,7 +1083,7 @@ DEF_TEST(ImageFilterCropRect, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) { - test_crop_rects(reporter, ctxInfo.fGrContext); + test_crop_rects(reporter, ctxInfo.grContext()); } #endif @@ -1204,7 +1204,7 @@ DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) { - test_clipped_picture_imagefilter(reporter, ctxInfo.fGrContext); + test_clipped_picture_imagefilter(reporter, ctxInfo.grContext()); } #endif @@ -1461,7 +1461,7 @@ DEF_TEST(ComposedImageFilterOffset, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) { - test_composed_imagefilter_offset(reporter, ctxInfo.fGrContext); + test_composed_imagefilter_offset(reporter, ctxInfo.grContext()); } #endif @@ -1503,7 +1503,7 @@ DEF_TEST(ComposedImageFilterBounds, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) { - test_composed_imagefilter_bounds(reporter, ctxInfo.fGrContext); + test_composed_imagefilter_bounds(reporter, ctxInfo.grContext()); } #endif @@ -1531,7 +1531,7 @@ DEF_TEST(ImageFilterPartialCropRect, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterPartialCropRect_Gpu, reporter, ctxInfo) { - test_partial_crop_rect(reporter, ctxInfo.fGrContext); + test_partial_crop_rect(reporter, ctxInfo.grContext()); } #endif @@ -1673,7 +1673,7 @@ DEF_TEST(ImageFilterBlurLargeImage, reporter) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) { - sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, + sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, SkImageInfo::MakeN32Premul(100, 100))); @@ -1685,7 +1685,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) { DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) { - sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, + sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, SkImageInfo::MakeN32Premul(1, 1))); @@ -1696,7 +1696,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, repor } DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) { - auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kYes, + auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, SkImageInfo::MakeN32Premul(100, 100))); test_large_blur_input(reporter, surface->getCanvas()); } diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp index 95a9d59aed..d513e89ad2 100644 --- a/tests/ImageIsOpaqueTest.cpp +++ b/tests/ImageIsOpaqueTest.cpp @@ -67,7 +67,7 @@ DEF_TEST(ImageIsOpaqueTest, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5); auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, infoTransparent)); check_isopaque(reporter, surfaceTransparent, false); diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp index 164f11898e..a92a4be4d5 100644 --- a/tests/ImageNewShaderTest.cpp +++ b/tests/ImageNewShaderTest.cpp @@ -141,13 +141,13 @@ void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) { // GPU -> GPU - gpuToGpu(reporter, ctxInfo.fGrContext); + gpuToGpu(reporter, ctxInfo.grContext()); // GPU -> RASTER - gpuToRaster(reporter, ctxInfo.fGrContext); + gpuToRaster(reporter, ctxInfo.grContext()); // RASTER -> GPU - rasterToGpu(reporter, ctxInfo.fGrContext); + rasterToGpu(reporter, ctxInfo.grContext()); } #endif diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 9cba74e57f..88f4d7f237 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -177,7 +177,7 @@ DEF_TEST(ImageEncode, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) { - test_encode(reporter, create_gpu_image(ctxInfo.fGrContext).get()); + test_encode(reporter, create_gpu_image(ctxInfo.grContext()).get()); } #endif @@ -371,7 +371,7 @@ DEF_TEST(image_newfrombitmap, reporter) { */ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) { SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType); - sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext)); + sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext())); const uint32_t uniqueID = image->uniqueID(); auto surface(SkSurface::MakeRaster(info)); @@ -405,8 +405,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) { } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, contextInfo) { - GrContext* context = contextInfo.fGrContext; - sk_gpu_test::GLTestContext* glContext = contextInfo.fGLContext; + GrContext* context = contextInfo.grContext(); + sk_gpu_test::GLTestContext* glContext = contextInfo.glContext(); GrContextFactory otherFactory; ContextInfo otherContextInfo = @@ -423,8 +423,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_newTextureImage, reporter, context [context] { return create_gpu_image(context); }, // Create a texture image in a another GrContext. [glContext, otherContextInfo] { - otherContextInfo.fGLContext->makeCurrent(); - sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.fGrContext); + otherContextInfo.glContext()->makeCurrent(); + sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext()); glContext->makeCurrent(); return otherContextImage; } @@ -578,7 +578,7 @@ DEF_TEST(ImageReadPixels, reporter) { } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) { - test_read_pixels(reporter, create_gpu_image(ctxInfo.fGrContext).get()); + test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get()); } #endif @@ -646,7 +646,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) { SkImage::kRW_LegacyBitmapMode, }; for (auto& mode : modes) { - sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext)); + sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext())); test_legacy_bitmap(reporter, image.get(), mode); } } @@ -685,7 +685,7 @@ DEF_TEST(ImagePeek, reporter) { } #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) { - sk_sp<SkImage> image(create_gpu_image(ctxInfo.fGrContext)); + sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext())); test_peek(reporter, image.get(), false); } #endif @@ -705,7 +705,7 @@ static void check_image_color(skiatest::Reporter* reporter, SkImage* image, SkPM REPORTER_ASSERT(reporter, pixel == expected); } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) { - GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); + GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); const int w = 10; const int h = 10; SkPMColor storage[w * h]; @@ -733,9 +733,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_NewFromTexture, reporter, ctxInfo) backendDesc.fTextureHandle = tex->getTextureHandle(); TextureReleaseChecker releaseChecker; sk_sp<SkImage> refImg( - SkImage::MakeFromTexture(ctxInfo.fGrContext, backendDesc, kPremul_SkAlphaType, + SkImage::MakeFromTexture(ctxInfo.grContext(), backendDesc, kPremul_SkAlphaType, TextureReleaseChecker::Release, &releaseChecker)); - sk_sp<SkImage> cpyImg(SkImage::MakeFromTextureCopy(ctxInfo.fGrContext, backendDesc, + sk_sp<SkImage> cpyImg(SkImage::MakeFromTextureCopy(ctxInfo.grContext(), backendDesc, kPremul_SkAlphaType)); check_image_color(reporter, refImg.get(), expected0); @@ -813,7 +813,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { if (!image->peekPixels(&pixmap)) { ERRORF(reporter, "peek failed"); } else { - sk_sp<SkImage> texImage(SkImage::MakeTextureFromPixmap(ctxInfo.fGrContext, pixmap, + sk_sp<SkImage> texImage(SkImage::MakeTextureFromPixmap(ctxInfo.grContext(), pixmap, SkBudgeted::kNo)); if (!texImage) { ERRORF(reporter, "NewTextureFromPixmap failed."); @@ -825,8 +825,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(NewTextureFromPixmap, reporter, ctxInfo) { } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; - sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext; + GrContext* context = ctxInfo.grContext(); + sk_gpu_test::GLTestContext* glContext = ctxInfo.glContext(); SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy()); GrContextFactory otherFactory; @@ -846,8 +846,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { { [context] { return create_gpu_image(context); }, false }, // Create a texture image in a another GrContext. { [glContext, otherContextInfo] { - otherContextInfo.fGLContext->makeCurrent(); - sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.fGrContext); + otherContextInfo.glContext()->makeCurrent(); + sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext()); glContext->makeCurrent(); return otherContextImage; }, false }, @@ -888,7 +888,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) { // The other context should not be able to create images from texture data // created by the original context. sk_sp<SkImage> newImage2(SkImage::MakeFromDeferredTextureImageData( - otherContextInfo.fGrContext, buffer, budgeted)); + otherContextInfo.grContext(), buffer, budgeted)); REPORTER_ASSERT(reporter, !newImage2); glContext->makeCurrent(); } diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp index 14ab7216f2..575e776377 100644 --- a/tests/PremulAlphaRoundTripTest.cpp +++ b/tests/PremulAlphaRoundTripTest.cpp @@ -108,7 +108,7 @@ DEF_TEST(PremulAlphaRoundTrip, reporter) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) { const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); - sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, + sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); test_premul_alpha_roundtrip(reporter, surf.get()); diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index a82237d9f8..c2ab05c4fb 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -102,7 +102,7 @@ private: } DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig)); diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index e1e5aeb2cf..5f27b89f5a 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -76,7 +76,7 @@ static void check_texture(skiatest::Reporter* reporter, DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { - GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); + GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto widthHeight : { 100, 128 }) { @@ -84,9 +84,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { for (auto numSamples : { 0, 4}) { - bool renderable = ctxInfo.fGrContext->caps()->isConfigRenderable( + bool renderable = ctxInfo.grContext()->caps()->isConfigRenderable( config, numSamples > 0) && - numSamples <= ctxInfo.fGrContext->caps()->maxColorSampleCount(); + numSamples <= ctxInfo.grContext()->caps()->maxColorSampleCount(); GrSurfaceDesc desc; desc.fOrigin = origin; @@ -97,7 +97,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { if (renderable) { sk_sp<GrRenderTargetProxy> rtProxy(GrRenderTargetProxy::Make( - *ctxInfo.fGrContext->caps(), + *ctxInfo.grContext()->caps(), desc, fit, budgeted)); @@ -123,7 +123,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(AllocedProxyTest, reporter, ctxInfo) { } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { - GrTextureProvider* provider = ctxInfo.fGrContext->textureProvider(); + GrTextureProvider* provider = ctxInfo.grContext()->textureProvider(); static const int kWidthHeight = 100; @@ -131,7 +131,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { for (auto numSamples: { 0, 4}) { - bool renderable = ctxInfo.fGrContext->caps()->isConfigRenderable( + bool renderable = ctxInfo.grContext()->caps()->isConfigRenderable( config, numSamples > 0); GrSurfaceDesc desc; diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 9db507b981..28650e2427 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -396,7 +396,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) { desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = origin; SkAutoTUnref<GrTexture> surfaceTexture( - ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo)); + ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo)); auto surface(SkSurface::MakeRenderTargetDirect(surfaceTexture->asRenderTarget())); desc.fFlags = kNone_GrSurfaceFlags; test_readpixels(reporter, surface, kLast_BitmapInit); @@ -453,7 +453,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) { desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = origin; desc.fFlags = kNone_GrSurfaceFlags; - texture.reset(ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo)); + texture.reset(ctxInfo.grContext()->textureProvider()->createTexture(desc, + SkBudgeted::kNo)); test_readpixels_texture(reporter, texture); } } @@ -585,7 +586,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo) SkBitmap bm_subset, tx_subset; // ... one from a texture-subset - SkAutoTUnref<GrTexture> fullTx(GrRefCachedBitmapTexture(ctxInfo.fGrContext, bitmap, + SkAutoTUnref<GrTexture> fullTx(GrRefCachedBitmapTexture(ctxInfo.grContext(), bitmap, GrTextureParams::ClampNoFilter())); SkBitmap tx_full; GrWrapTextureInBitmap(fullTx, bitmap.width(), bitmap.height(), true, &tx_full); @@ -594,7 +595,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo) // ... one from a bitmap-subset SkBitmap tmp_subset; bitmap.extractSubset(&tmp_subset, subset); - SkAutoTUnref<GrTexture> subsetTx(GrRefCachedBitmapTexture(ctxInfo.fGrContext, tmp_subset, + SkAutoTUnref<GrTexture> subsetTx(GrRefCachedBitmapTexture(ctxInfo.grContext(), tmp_subset, GrTextureParams::ClampNoFilter())); GrWrapTextureInBitmap(subsetTx, tmp_subset.width(), tmp_subset.height(), true, &bm_subset); @@ -603,8 +604,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadPixels_Subset_Gpu, reporter, ctxInfo) // do they draw the same? const SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128); - auto surfA(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info)); - auto surfB(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, SkBudgeted::kNo, info)); + auto surfA(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); + auto surfB(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info)); if (false) { // diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 811ce5840b..cc83b860de 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -53,7 +53,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { // We are initializing the texture with zeros here memset(alphaData, 0, X_SIZE * Y_SIZE); SkAutoTUnref<GrTexture> texture( - ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo , alphaData, + ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, alphaData, 0)); if (!texture) { if (!rt) { @@ -155,8 +155,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { } } SkAutoTUnref<GrTexture> texture( - ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo, - rgbaData, 0)); + ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, + rgbaData, 0)); if (!texture) { // We always expect to be able to create a RGBA texture if (!rt && kRGBA_8888_GrPixelConfig == desc.fConfig) { diff --git a/tests/RecordReplaceDrawTest.cpp b/tests/RecordReplaceDrawTest.cpp index 5506551d6b..9e13147954 100644 --- a/tests/RecordReplaceDrawTest.cpp +++ b/tests/RecordReplaceDrawTest.cpp @@ -142,8 +142,8 @@ void test_replacements(skiatest::Reporter* r, GrContext* context, bool doReplace } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RecordReplaceDraw, r, ctxInfo) { - test_replacements(r, ctxInfo.fGrContext, true); - test_replacements(r, ctxInfo.fGrContext, false); + test_replacements(r, ctxInfo.grContext(), true); + test_replacements(r, ctxInfo.grContext(), false); } #endif diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 8c3bdd6a4a..2fa51e2ba2 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -139,8 +139,8 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context, } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; - sk_gpu_test::GLTestContext* glContext = ctxInfo.fGLContext; + GrContext* context = ctxInfo.grContext(); + sk_gpu_test::GLTestContext* glContext = ctxInfo.glContext(); static const int kWidth = 13; static const int kHeight = 13; diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index a733d39afe..bd2bb2f094 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -31,7 +31,7 @@ static const int gHeight = 480; //////////////////////////////////////////////////////////////////////////////// DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); GrSurfaceDesc desc; desc.fConfig = kSkia8888_GrPixelConfig; desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -81,7 +81,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) { } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); GrSurfaceDesc smallDesc; smallDesc.fFlags = kRenderTarget_GrSurfaceFlag; smallDesc.fConfig = kSkia8888_GrPixelConfig; @@ -189,7 +189,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheStencilBuffers, reporter, ctxInf } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); GrGpu* gpu = context->getGpu(); // this test is only valid for GL if (!gpu || !gpu->glContextForTesting()) { diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index a652e94bfc..fdaa587de7 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -139,7 +139,7 @@ void read_and_check_pixels(skiatest::Reporter* reporter, GrTexture* texture, uin // TODO: Add tests for copySurface between srgb/linear textures. Add tests for unpremul/premul // conversion during read/write along with srgb/linear conversions. DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); #if defined(GOOGLE3) // Stack frame size is limited in GOOGLE3. static const int kW = 63; diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index f5174478ef..06c852d511 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -210,7 +210,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) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); SkBitmap bm = create_bm(); const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); @@ -272,7 +272,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); SkBitmap bm = create_bm(); GrSurfaceDesc desc; diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp index 3c351a527c..4b81691040 100644 --- a/tests/SpecialSurfaceTest.cpp +++ b/tests/SpecialSurfaceTest.cpp @@ -79,7 +79,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { - sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.fGrContext, + sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(), kSmallerSize, kSmallerSize, kSkia8888_GrPixelConfig)); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 0cf602007c..bcfd0a9387 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -79,7 +79,7 @@ DEF_TEST(SurfaceEmpty, reporter) { 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, + SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info, 0, nullptr)); } #endif @@ -122,7 +122,7 @@ DEF_TEST(SurfaceCanvasPeek, reporter) { 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)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, &requestInfo)); test_canvas_peek(reporter, surface, requestInfo, false); } } @@ -154,7 +154,7 @@ DEF_TEST(SurfaceAccessPixels, reporter) { #if SK_SUPPORT_GPU 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)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_access_pixels(reporter, surface); } } @@ -185,7 +185,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceSnapshotAlphaType_Gpu, reporter, ct for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { for (auto& isOpaque : { true, false }) { SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; - auto surface(surface_func(ctxInfo.fGrContext, alphaType, nullptr)); + auto surface(surface_func(ctxInfo.grContext(), alphaType, nullptr)); test_snapshot_alphatype(reporter, surface, isOpaque); } } @@ -243,7 +243,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessCopyOnWrite_Gpu, re for (auto& handle_access_func : { &get_surface_backend_texture_handle, &get_surface_backend_render_target_handle }) { for (auto& accessMode : accessModes) { - auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_backend_handle_access_copy_on_write(reporter, surface.get(), accessMode, handle_access_func); } @@ -332,7 +332,7 @@ DEF_TEST(UniqueImageSnapshot, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { auto surface(surface_func(context, kOpaque_SkAlphaType, nullptr)); @@ -439,7 +439,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessIDs_Gpu, reporter, for (auto& test_func : { &test_backend_handle_unique_id, &test_backend_handle_gen_id }) { for (auto& handle_access_func : { &get_surface_backend_texture_handle, &get_surface_backend_render_target_handle}) { - auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_func(reporter, surface.get(), handle_access_func); } } @@ -528,7 +528,7 @@ DEF_TEST(SurfaceCopyOnWrite, reporter) { #if SK_SUPPORT_GPU 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)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_copy_on_write(reporter, surface.get()); } } @@ -550,7 +550,7 @@ DEF_TEST(SurfaceWriteableAfterSnapshotRelease, reporter) { #if SK_SUPPORT_GPU 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)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_writable_after_snapshot_release(reporter, surface.get()); } } @@ -591,8 +591,8 @@ static void test_crbug263329(skiatest::Reporter* reporter, } 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)); + auto surface1(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); + auto surface2(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_crbug263329(reporter, surface1.get(), surface2.get()); } } @@ -608,7 +608,7 @@ DEF_TEST(SurfaceGetTexture, reporter) { #if SK_SUPPORT_GPU 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)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); sk_sp<SkImage> image(surface->makeImageSnapshot()); GrTexture* texture = as_IB(image)->peekTexture(); REPORTER_ASSERT(reporter, texture); @@ -642,7 +642,7 @@ 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 }) { - auto surface(SkSurface::MakeRenderTarget(ctxInfo.fGrContext, sbudgeted, info)); + auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), sbudgeted, info)); SkASSERT(surface); REPORTER_ASSERT(reporter, sbudgeted == is_budgeted(surface)); @@ -706,7 +706,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceNoCanvas_Gpu, reporter, ctxInfo) { for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) { for (auto& test_func : { &test_no_canvas1, &test_no_canvas2 }) { for (auto& mode : modes) { - auto surface(surface_func(ctxInfo.fGrContext, kPremul_SkAlphaType, nullptr)); + auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr)); test_func(reporter, surface.get(), mode); } } @@ -838,7 +838,7 @@ static void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> su } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { - GrContext* context = ctxInfo.fGrContext; + GrContext* context = ctxInfo.grContext(); std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = { [] (SkSurface* s){ @@ -914,7 +914,7 @@ static void test_surface_draw_partially( } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) { - GrGpu* gpu = ctxInfo.fGrContext->getGpu(); + GrGpu* gpu = ctxInfo.grContext()->getGpu(); if (!gpu) { return; } @@ -926,7 +926,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) // preserved in pixels that aren't rendered to via the surface. // This works only for non-multisampled case. GrBackendObject textureObject; - auto surface = surfaceFunc(ctxInfo.fGrContext, 0, kOrigColor, &textureObject); + auto surface = surfaceFunc(ctxInfo.grContext(), 0, kOrigColor, &textureObject); if (surface) { test_surface_draw_partially(reporter, surface, kOrigColor); surface.reset(); @@ -937,7 +937,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) { - GrGpu* gpu = ctxInfo.fGrContext->getGpu(); + GrGpu* gpu = ctxInfo.grContext()->getGpu(); if (!gpu) { return; } @@ -947,7 +947,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf &create_gpu_surface_backend_texture_as_render_target}) { for (int sampleCnt : {0, 4, 8}) { GrBackendObject textureObject; - auto surface = surfaceFunc(ctxInfo.fGrContext, sampleCnt, kOrigColor, &textureObject); + auto surface = surfaceFunc(ctxInfo.grContext(), sampleCnt, kOrigColor, &textureObject); if (!surface && sampleCnt > 0) { // Certain platforms don't support MSAA, skip these. @@ -959,7 +959,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf GrRenderTarget* rt = surface->getCanvas()->internal_private_accessTopLayerDrawContext() ->accessRenderTarget(); REPORTER_ASSERT(reporter, - ctxInfo.fGrContext->resourceProvider()->attachStencilAttachment(rt)); + ctxInfo.grContext()->resourceProvider()->attachStencilAttachment(rt)); gpu->deleteTestingOnlyBackendTexture(textureObject); } } diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 9d550775ba..932eb5e676 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -260,10 +260,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = kTopLeft_GrSurfaceOrigin; SkAutoTUnref<GrTexture> texture( - ctxInfo.fGrContext->textureProvider()->createApproxTexture(desc)); + ctxInfo.grContext()->textureProvider()->createApproxTexture(desc)); GrTestTarget tt; GrRenderTarget* rt = texture->asRenderTarget(); - ctxInfo.fGrContext->getTestTarget(&tt, rt); + ctxInfo.grContext()->getTestTarget(&tt, rt); GrDrawTarget* dt = tt.target(); GrResourceProvider* rp = tt.resourceProvider(); diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 5e5000ebca..27ec1634df 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -31,7 +31,7 @@ DEF_GPUTEST(TestGpuFactory, reporter, factory) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); - REPORTER_ASSERT(reporter, ctxInfo.fGrContext); + REPORTER_ASSERT(reporter, ctxInfo.grContext()); } #endif @@ -40,7 +40,7 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); - REPORTER_ASSERT(reporter, ctxInfo.fGrContext); + REPORTER_ASSERT(reporter, ctxInfo.grContext()); } #endif @@ -49,6 +49,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_NULLGL_CONTEXT(TestGpuNullContext, reporter, ctxInfo) { REPORTER_ASSERT(reporter, reporter); - REPORTER_ASSERT(reporter, ctxInfo.fGrContext); + REPORTER_ASSERT(reporter, ctxInfo.grContext()); } #endif diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp index 8f95cf00e7..23f45a4cad 100644 --- a/tests/TextBlobCacheTest.cpp +++ b/tests/TextBlobCacheTest.cpp @@ -157,18 +157,18 @@ static void text_blob_cache_inner(skiatest::Reporter* reporter, GrContext* conte } DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobCache, reporter, ctxInfo) { - text_blob_cache_inner(reporter, ctxInfo.fGrContext, 1024, 256, 30, true, false); + text_blob_cache_inner(reporter, ctxInfo.grContext(), 1024, 256, 30, true, false); } DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobStressCache, reporter, ctxInfo) { - text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, true, true); + text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, true, true); } DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobAbnormal, reporter, ctxInfo) { - text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, false, false); + text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, false, false); } DEF_GPUTEST_FOR_NULLGL_CONTEXT(TextBlobStressAbnormal, reporter, ctxInfo) { - text_blob_cache_inner(reporter, ctxInfo.fGrContext, 256, 256, 10, false, true); + text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, false, true); } #endif diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index 1f8e4970a7..4a8c966781 100644 --- a/tests/VkClearTests.cpp +++ b/tests/VkClearTests.cpp @@ -197,10 +197,10 @@ void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon } DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkClearTests, reporter, ctxInfo) { - basic_clear_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig); - basic_clear_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig); - sub_clear_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig); - sub_clear_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig); + basic_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig); + basic_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig); + sub_clear_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig); + sub_clear_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig); } #endif diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index d4604e8b1b..ca11c0f5b9 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -134,14 +134,14 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe } DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkUploadPixelsTests, reporter, ctxInfo) { - basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, false, false); - basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, true, false); - basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, false, true); - basic_texture_test(reporter, ctxInfo.fGrContext, kRGBA_8888_GrPixelConfig, true, true); - basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, false, false); - basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, true, false); - basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, false, true); - basic_texture_test(reporter, ctxInfo.fGrContext, kBGRA_8888_GrPixelConfig, true, true); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, false, false); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, true, false); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, false, true); + basic_texture_test(reporter, ctxInfo.grContext(), kRGBA_8888_GrPixelConfig, true, true); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, false, false); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, true, false); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, false, true); + basic_texture_test(reporter, ctxInfo.grContext(), kBGRA_8888_GrPixelConfig, true, true); } #endif diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 626ee4c4b1..e81ebf5f17 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -159,9 +159,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { } DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkWrapTests, reporter, ctxInfo) { - wrap_tex_test(reporter, ctxInfo.fGrContext); - wrap_rt_test(reporter, ctxInfo.fGrContext); - wrap_trt_test(reporter, ctxInfo.fGrContext); + wrap_tex_test(reporter, ctxInfo.grContext()); + wrap_rt_test(reporter, ctxInfo.grContext()); + wrap_trt_test(reporter, ctxInfo.grContext()); } #endif diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index 367942f508..8ad84510c9 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -415,7 +415,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { desc.fConfig = kSkia8888_GrPixelConfig; desc.fOrigin = origin; SkAutoTUnref<GrTexture> texture( - ctxInfo.fGrContext->textureProvider()->createTexture(desc, SkBudgeted::kNo)); + ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo)); auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget())); test_write_pixels(reporter, surface.get()); } diff --git a/tests/skbug5221.cpp b/tests/skbug5221.cpp index 45847eeac1..dfd065f0b7 100644 --- a/tests/skbug5221.cpp +++ b/tests/skbug5221.cpp @@ -25,7 +25,7 @@ DEF_TEST(skbug5221, r) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) { - sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(contextInfo.fGrContext, SkBudgeted::kYes, + sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(contextInfo.grContext(), SkBudgeted::kYes, SkImageInfo::MakeN32Premul(256, 256), 0, nullptr)); test(surface->getCanvas()); diff --git a/tools/gpu/GrContextFactory.h b/tools/gpu/GrContextFactory.h index 0dc8c20cd5..f5783fc1ae 100644 --- a/tools/gpu/GrContextFactory.h +++ b/tools/gpu/GrContextFactory.h @@ -18,14 +18,21 @@ struct GrVkBackendContext; namespace sk_gpu_test { -struct ContextInfo { +class ContextInfo { +public: + GrContext* grContext() const { return fGrContext; } + GLTestContext* glContext() const { return fGLContext; } + +private: ContextInfo() - : fGrContext(nullptr), fGLContext(nullptr) { } + : fGrContext(nullptr), fGLContext(nullptr) { } ContextInfo(GrContext* grContext, GLTestContext* glContext) - : fGrContext(grContext), fGLContext(glContext) { } + : fGrContext(grContext), fGLContext(glContext) { } GrContext* fGrContext; GLTestContext* fGLContext; //! Valid until the factory destroys it via abandonContexts() or //! destroyContexts(). Null if context is not based on OpenGL. + + friend class GrContextFactory; }; /** diff --git a/tools/kilobench/kilobench.cpp b/tools/kilobench/kilobench.cpp index dc7f938a5d..b14770f458 100644 --- a/tools/kilobench/kilobench.cpp +++ b/tools/kilobench/kilobench.cpp @@ -188,7 +188,7 @@ struct GPUTarget { fSurface.reset(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, numSamples, &props).release()); - fGL = factory->getContextInfo(ctxType, ctxOptions).fGLContext; + fGL = factory->getContextInfo(ctxType, ctxOptions).glContext(); if (!fSurface.get()) { return false; } diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index b16c5cf3bc..97719e2bd2 100644 --- a/tools/skiaserve/Request.cpp +++ b/tools/skiaserve/Request.cpp @@ -71,7 +71,7 @@ SkCanvas* Request::getCanvas() { #if SK_SUPPORT_GPU GrContextFactory* factory = fContextFactory; GLTestContext* gl = factory->getContextInfo(GrContextFactory::kNativeGL_ContextType, - GrContextFactory::kNone_ContextOptions).fGLContext; + GrContextFactory::kNone_ContextOptions).glContext(); gl->makeCurrent(); #endif SkASSERT(fDebugCanvas); |