diff options
author | Brian Salomon <bsalomon@google.com> | 2017-03-31 12:08:15 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-31 12:08:24 +0000 |
commit | 84eef5154ba166ccf5a78a4d87d3a05b92095a82 (patch) | |
tree | d297a7986906ae5936ecb160a532dffbe5a1b146 /tests | |
parent | e15a7b528ee1a630639f7a69b970237c8d97d308 (diff) |
Revert "Respect kRectsMustMatchForMSAASrc_BlitFramebufferFlag in dst setup"
This reverts commit e0ff6ab272dcc5c4d6f3b509da7e0e97acada814.
Reason for revert: a bunch of bots failed.
Original change's description:
> Respect kRectsMustMatchForMSAASrc_BlitFramebufferFlag in dst setup
>
> Crurently, when preparing a texture for blitFramebuffer, we ignore the
> kRectsMustMatchForMSAASrc_BlitFramebufferFlag, and may attempt to
> copy from one src rect to a different dst rect.
>
> This change updates initDescForDstCopy and setupDstTexture to allocate
> larger textures if necessary and accomodate this flags requirements.
>
> Bug: 658277
> Change-Id: I500f10dba5700f5f7a7acad04bcdbc9ac9994835
> Reviewed-on: https://skia-review.googlesource.com/10247
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
>
TBR=bsalomon@google.com,ericrk@chromium.org,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I7fbd6c2652fe71c707d3120b035e0365fbc7fa66
Reviewed-on: https://skia-review.googlesource.com/10920
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BlendTest.cpp | 130 |
1 files changed, 2 insertions, 128 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp index 0c8499f410..785acb8681 100644 --- a/tests/BlendTest.cpp +++ b/tests/BlendTest.cpp @@ -5,24 +5,11 @@ * found in the LICENSE file. */ -#include <functional> -#include "SkBitmap.h" -#include "SkCanvas.h" +#include "Test.h" #include "SkColor.h" #include "SkColorPriv.h" -#include "SkSurface.h" #include "SkTaskGroup.h" -#include "SkUtils.h" -#include "Test.h" - -#if SK_SUPPORT_GPU -#include "GrContext.h" -#include "GrContextPriv.h" -#include "GrResourceProvider.h" -#include "GrSurfaceContext.h" -#include "GrSurfaceProxy.h" -#include "GrTexture.h" -#endif +#include <functional> struct Results { int diffs, diffs_0x00, diffs_0xff, diffs_by_1; }; @@ -79,116 +66,3 @@ DEF_TEST(Blend_byte_multiply, r) { }; for (auto multiply : perfect) { REPORTER_ASSERT(r, test(multiply).diffs == 0); } } - -#if SK_SUPPORT_GPU -namespace { -static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target( - GrContext* context, int sampleCnt, int width, int height, GrPixelConfig config, - sk_sp<GrTexture>* backingSurface) { - GrSurfaceDesc backingDesc; - backingDesc.fHeight = height; - backingDesc.fWidth = width; - backingDesc.fConfig = config; - backingDesc.fOrigin = kDefault_GrSurfaceOrigin; - backingDesc.fFlags = kRenderTarget_GrSurfaceFlag; - - (*backingSurface) - .reset(context->resourceProvider()->createTexture(backingDesc, SkBudgeted::kNo)); - - GrBackendTextureDesc desc; - desc.fConfig = config; - desc.fWidth = width; - desc.fHeight = height; - desc.fFlags = kRenderTarget_GrBackendTextureFlag; - desc.fTextureHandle = (*backingSurface)->getTextureHandle(); - desc.fSampleCnt = sampleCnt; - sk_sp<SkSurface> surface = - SkSurface::MakeFromBackendTextureAsRenderTarget(context, desc, nullptr); - return surface; -} -} - -// Tests blending to a surface with no texture available. -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) { - GrContext* context = ctxInfo.grContext(); - const int kWidth = 10; - const int kHeight = 10; - const GrPixelConfig kConfig = kRGBA_8888_GrPixelConfig; - const SkColorType kColorType = kRGBA_8888_SkColorType; - - // Build our test cases: - struct RectAndSamplePoint { - SkRect rect; - SkIPoint outPoint; - SkIPoint inPoint; - } allRectsAndPoints[3] = { - {SkRect::MakeXYWH(0, 0, 5, 5), SkIPoint::Make(7, 7), SkIPoint::Make(2, 2)}, - {SkRect::MakeXYWH(2, 2, 5, 5), SkIPoint::Make(0, 0), SkIPoint::Make(4, 4)}, - {SkRect::MakeXYWH(5, 5, 5, 5), SkIPoint::Make(2, 2), SkIPoint::Make(7, 7)}, - }; - - struct TestCase { - RectAndSamplePoint rectAndPoints; - int sampleCnt; - }; - std::vector<TestCase> testCases; - - for (int sampleCnt : {0, 4, 8}) { - for (auto rectAndPoints : allRectsAndPoints) { - testCases.push_back({rectAndPoints, sampleCnt}); - } - } - - // Run each test case: - for (auto testCase : testCases) { - int sampleCnt = testCase.sampleCnt; - SkRect paintRect = testCase.rectAndPoints.rect; - SkIPoint outPoint = testCase.rectAndPoints.outPoint; - SkIPoint inPoint = testCase.rectAndPoints.inPoint; - - sk_sp<GrTexture> backingSurface; - // BGRA forces a framebuffer blit on ES2. - sk_sp<SkSurface> surface = create_gpu_surface_backend_texture_as_render_target( - context, sampleCnt, kWidth, kHeight, kConfig, &backingSurface); - - if (!surface && sampleCnt > 0) { - // Some platforms don't support MSAA. - continue; - } - REPORTER_ASSERT(reporter, !!surface); - - // Fill our canvas with 0xFFFF80 - SkCanvas* canvas = surface->getCanvas(); - SkPaint black_paint; - black_paint.setColor(SkColorSetRGB(0xFF, 0xFF, 0x80)); - canvas->drawRect(SkRect::MakeXYWH(0, 0, kWidth, kHeight), black_paint); - - // Blend 2x2 pixels at 5,5 with 0x80FFFF. Use multiply blend mode as this will trigger - // a copy of the destination. - SkPaint white_paint; - white_paint.setColor(SkColorSetRGB(0x80, 0xFF, 0xFF)); - white_paint.setBlendMode(SkBlendMode::kMultiply); - canvas->drawRect(paintRect, white_paint); - - // Read the result into a bitmap. - SkBitmap bitmap; - REPORTER_ASSERT(reporter, bitmap.tryAllocPixels(SkImageInfo::Make( - kWidth, kHeight, kColorType, kPremul_SkAlphaType))); - bitmap.lockPixels(); - REPORTER_ASSERT( - reporter, - surface->readPixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(), 0, 0)); - - // Check the in/out pixels. - REPORTER_ASSERT(reporter, bitmap.getColor(outPoint.x(), outPoint.y()) == - SkColorSetRGB(0xFF, 0xFF, 0x80)); - REPORTER_ASSERT(reporter, bitmap.getColor(inPoint.x(), inPoint.y()) == - SkColorSetRGB(0x80, 0xFF, 0x80)); - - // Clean up - surface depends on backingSurface and must be released first. - bitmap.unlockPixels(); - surface.reset(); - backingSurface.reset(); - } -} -#endif |