aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-02-27 16:46:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-28 03:14:25 +0000
commit3d86a19f420c2b406620b086c319732eb4135d33 (patch)
tree3270b5213f84f710c6e6d1d5d86422242d120586 /tests
parente5b7ceeac865fb8a3bab82a73d65752c78682718 (diff)
Refactor GrCaps::renderTargetWritePixelsSupported to support for some GL workarounds
Make indirect path in writeSurfacePixels2 use a copy rather than a draw. Fix issue in GrVkGpu where render target dirty region is not updated after copy-as-draw Remove unnecessary resolve of MSAA RT in GrVkCopyManager. Splits WritePixelsNonTexture_Gpu test into MSAA and non-MSAA variants. MSAA variant blacklisted on Adreno because of: Bug: skia:7663 ~~~~~~AND~~~~~~~ Revert "Suppress CopySurface test on Nexus 7" This reverts commit b42b6169d52408a1712c2740655300465cd6ff1e. Bug: skia:7658 Change-Id: I8337d718efb41e266537744bbf5ff8b1545322a7 Reviewed-on: https://skia-review.googlesource.com/110700 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/WritePixelsTest.cpp56
1 files changed, 33 insertions, 23 deletions
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 1a0f7a549d..cb12dcf240 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -398,42 +398,52 @@ DEF_TEST(WritePixels, reporter) {
}
}
#if SK_SUPPORT_GPU
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
+static void test_write_pixels(skiatest::Reporter* reporter, GrContext* context, int sampleCnt) {
const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
-
for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
- for (int sampleCnt : {1, 4}) {
- sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
- SkBudgeted::kNo, ii, sampleCnt,
- origin, nullptr));
- if (!surface && sampleCnt > 1) {
- // Some platforms don't support MSAA
- continue;
- }
- test_write_pixels(reporter, surface.get());
+ sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(context,
+ SkBudgeted::kNo, ii, sampleCnt,
+ origin, nullptr));
+ if (surface) {
+ continue;
}
+ test_write_pixels(reporter, surface.get());
}
}
-DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
+ test_write_pixels(reporter, ctxInfo.grContext(), 1);
+}
+
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsMSAA_Gpu, reporter, ctxInfo) {
+ test_write_pixels(reporter, ctxInfo.grContext(), 1);
+}
+
+static void test_write_pixels_non_texture(skiatest::Reporter* reporter, GrContext* context,
+ int sampleCnt) {
GrGpu* gpu = context->contextPriv().getGpu();
for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
- for (int sampleCnt : {1, 4}) {
- GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
- nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo);
- SkColorType colorType = kN32_SkColorType;
- sk_sp<SkSurface> surface(SkSurface::MakeFromBackendTextureAsRenderTarget(
- context, backendTex, origin, sampleCnt, colorType, nullptr, nullptr));
- if (surface) {
- test_write_pixels(reporter, surface.get());
- }
- gpu->deleteTestingOnlyBackendTexture(&backendTex);
+ GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
+ nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo);
+ SkColorType colorType = kN32_SkColorType;
+ sk_sp<SkSurface> surface(SkSurface::MakeFromBackendTextureAsRenderTarget(
+ context, backendTex, origin, sampleCnt, colorType, nullptr, nullptr));
+ if (surface) {
+ test_write_pixels(reporter, surface.get());
}
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) {
+ test_write_pixels_non_texture(reporter, ctxInfo.grContext(), 1);
+}
+
+DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTextureMSAA_Gpu, reporter, ctxInfo) {
+ test_write_pixels_non_texture(reporter, ctxInfo.grContext(), 4);
+}
+
static sk_sp<SkSurface> create_surf(GrContext* context, int width, int height) {
const SkImageInfo ii = SkImageInfo::Make(width, height,
kRGBA_8888_SkColorType, kPremul_SkAlphaType);