From 44b61204d9f5681b9474db017577d56f42a32d66 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Thu, 1 Mar 2018 10:49:26 -0500 Subject: Add 1010102 support to Ganesh Adds gl1010102, gles1010102, vk1010102, and mtl1010102 configs to DM. This uses the same saveLayer approach as CPU, switching to 8888 so that we have enough alpha precision. Change-Id: I9f5b63747ec01031c8db97dadfc42f77e4863ccb Reviewed-on: https://skia-review.googlesource.com/110500 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- tests/ReadWriteAlphaTest.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tests/ReadWriteAlphaTest.cpp') diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 68a3ee0983..ba1022c689 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -25,11 +25,17 @@ static const int X_SIZE = 13; static const int Y_SIZE = 13; static void validate_alpha_data(skiatest::Reporter* reporter, int w, int h, const uint8_t* actual, - size_t actualRowBytes, const uint8_t* expected, SkString extraMsg) { + size_t actualRowBytes, const uint8_t* expected, SkString extraMsg, + GrPixelConfig config) { for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { uint8_t a = actual[y * actualRowBytes + x]; uint8_t e = expected[y * w + x]; + if (kRGBA_1010102_GrPixelConfig == config) { + // This config only preserves two bits of alpha + a >>= 6; + e >>= 6; + } if (e != a) { ERRORF(reporter, "Failed alpha readback. Expected: 0x%02x, Got: 0x%02x at (%d,%d), %s", @@ -99,7 +105,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { SkString msg; msg.printf("rb:%d A8", SkToU32(rowBytes)); validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes, - alphaData, msg); + alphaData, msg, kAlpha_8_GrPixelConfig); // Now try writing to a single channel surface (if we could create one). if (surf) { @@ -136,7 +142,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { static const GrPixelConfig kRGBAConfigs[] { kRGBA_8888_GrPixelConfig, kBGRA_8888_GrPixelConfig, - kSRGBA_8888_GrPixelConfig + kSRGBA_8888_GrPixelConfig, + kRGBA_1010102_GrPixelConfig, }; for (int y = 0; y < Y_SIZE; ++y) { @@ -200,7 +207,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { SkString msg; msg.printf("rt:%d, rb:%d 8888", rt, SkToU32(rowBytes)); validate_alpha_data(reporter, X_SIZE, Y_SIZE, readback.get(), nonZeroRowBytes, - alphaData, msg); + alphaData, msg, config); } } } -- cgit v1.2.3