From d2ca31218bc4d06fd3337fb1951ea1800a915f56 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 26 Mar 2019 11:31:16 -0400 Subject: [PATCH] Convert GrPorterDuff test from NullGL to Mock context Bug: skia: Change-Id: Id403aabcae1dbf38e55381bb3b4353e85a12a745 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203705 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- include/gpu/mock/GrMockTypes.h | 1 + src/gpu/mock/GrMockCaps.h | 1 + tests/GrPorterDuffTest.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/gpu/mock/GrMockTypes.h b/include/gpu/mock/GrMockTypes.h index fe2d388e0f..b1f07804fa 100644 --- a/include/gpu/mock/GrMockTypes.h +++ b/include/gpu/mock/GrMockTypes.h @@ -68,6 +68,7 @@ struct GrMockOptions { int fMaxVertexSamplers = 0; int fMaxFragmentSamplers = 8; bool fShaderDerivativeSupport = true; + bool fDualSourceBlendingSupport = false; // GrMockGpu options. bool fFailTextureAllocations = false; diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h index 65aee42592..4ce5f892e6 100644 --- a/src/gpu/mock/GrMockCaps.h +++ b/src/gpu/mock/GrMockCaps.h @@ -31,6 +31,7 @@ public: fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport; fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers; fShaderCaps->fShaderDerivativeSupport = options.fShaderDerivativeSupport; + fShaderCaps->fDualSourceBlendingSupport = options.fDualSourceBlendingSupport; this->applyOptionsOverrides(contextOptions); } diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 435459b2c1..d386090aed 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -27,8 +27,12 @@ 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_NULLGL_CONTEXT(GrPorterDuff, reporter, ctxInfo) { - const GrCaps& caps = *ctxInfo.grContext()->priv().getGpu()->caps(); +DEF_GPUTEST(GrPorterDuff, reporter, /*ctxInfo*/) { + GrMockOptions mockOptions; + mockOptions.fDualSourceBlendingSupport = true; + auto context = GrContext::MakeMock(&mockOptions, GrContextOptions()); + const GrCaps& caps = *context->priv().getGpu()->caps(); + if (!caps.shaderCaps()->dualSourceBlendingSupport()) { SK_ABORT("Null context does not support dual source blending."); return;