Skip to content

Commit

Permalink
Convert GrPorterDuff test from NullGL to Mock context
Browse files Browse the repository at this point in the history
Bug: skia:
Change-Id: Id403aabcae1dbf38e55381bb3b4353e85a12a745
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203705
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
  • Loading branch information
brianosman authored and Skia Commit-Bot committed Mar 26, 2019
1 parent 7eae5d7 commit d2ca312
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/gpu/mock/GrMockTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct GrMockOptions {
int fMaxVertexSamplers = 0;
int fMaxFragmentSamplers = 8;
bool fShaderDerivativeSupport = true;
bool fDualSourceBlendingSupport = false;

// GrMockGpu options.
bool fFailTextureAllocations = false;
Expand Down
1 change: 1 addition & 0 deletions src/gpu/mock/GrMockCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class GrMockCaps : public GrCaps {
fShaderCaps->fFlatInterpolationSupport = options.fFlatInterpolationSupport;
fShaderCaps->fMaxFragmentSamplers = options.fMaxFragmentSamplers;
fShaderCaps->fShaderDerivativeSupport = options.fShaderDerivativeSupport;
fShaderCaps->fDualSourceBlendingSupport = options.fDualSourceBlendingSupport;

this->applyOptionsOverrides(contextOptions);
}
Expand Down
8 changes: 6 additions & 2 deletions tests/GrPorterDuffTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d2ca312

Please sign in to comment.