aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ReadWriteAlphaTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-03-01 10:49:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-01 18:34:35 +0000
commit44b61204d9f5681b9474db017577d56f42a32d66 (patch)
tree1335301b126893cb221353e5f34984c4a1702ad3 /tests/ReadWriteAlphaTest.cpp
parentd50a193d8db74b8271a46fbd5ccf2a0681921a88 (diff)
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 <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests/ReadWriteAlphaTest.cpp')
-rw-r--r--tests/ReadWriteAlphaTest.cpp15
1 files changed, 11 insertions, 4 deletions
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);
}
}
}