aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkRasterPipelineTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2016-10-05 10:36:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-05 16:52:58 +0000
commit26bea5d55735367152378bae14453e9666d1c625 (patch)
treef7283585399f110c02fe1dbc9d486248baaf1020 /tests/SkRasterPipelineTest.cpp
parentc1c7c21fdd2793b2c03b8ffc06461a00c4241a18 (diff)
Make test lower-level, make const_cast more visible.
I can only think there's something funky going on with the hidden const_cast inside SkRasterPipeline.cpp, or with the Sk4h -> Sk4f conversion. So make the const_cast visible and write the test directly in halfs instead of floats. CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Release-GN-Trybot BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3003 Change-Id: I3a7e19ae165fce44f177b4968a63ec04e25c4b93 Reviewed-on: https://skia-review.googlesource.com/3003 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests/SkRasterPipelineTest.cpp')
-rw-r--r--tests/SkRasterPipelineTest.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/tests/SkRasterPipelineTest.cpp b/tests/SkRasterPipelineTest.cpp
index 2014671933..76fbc2541c 100644
--- a/tests/SkRasterPipelineTest.cpp
+++ b/tests/SkRasterPipelineTest.cpp
@@ -12,16 +12,9 @@
DEF_TEST(SkRasterPipeline, r) {
// Build and run a simple pipeline to exercise SkRasterPipeline,
// drawing 50% transparent blue over opaque red in half-floats.
-
- Sk4h red = SkFloatToHalf_finite_ftz({ 1.0f, 0.0f, 0.0f, 1.0f }),
- blue = SkFloatToHalf_finite_ftz({ 0.0f, 0.0f, 0.5f, 0.5f }),
- result = { 1, 2, 3, 4 };
-
- uint64_t bits;
- memcpy(&bits, &red, 8);
- SkDebugf("SkRasterPipeline red: 0x%016llx, want 0x3c00000000003c00\n", bits);
- memcpy(&bits, &blue, 8);
- SkDebugf("SkRasterPipeline blue: 0x%016llx, want 0x3800380000000000\n", bits);
+ uint64_t red = 0x3c00000000003c00ull,
+ blue = 0x3800380000000000ull,
+ result;
SkRasterPipeline p;
p.append(SkRasterPipeline::load_s_f16, &blue);
@@ -30,16 +23,11 @@ DEF_TEST(SkRasterPipeline, r) {
p.append(SkRasterPipeline::store_f16, &result);
p.run(1);
- Sk4f f = SkHalfToFloat_finite_ftz(result);
-
- memcpy(&bits, &result, 8);
- SkDebugf("SkRasterPipeline result: 0x%016llx, want 0x3c00380000003800\n", bits);
-
// We should see half-intensity magenta.
- REPORTER_ASSERT(r, f[0] == 0.5f);
- REPORTER_ASSERT(r, f[1] == 0.0f);
- REPORTER_ASSERT(r, f[2] == 0.5f);
- REPORTER_ASSERT(r, f[3] == 1.0f);
+ REPORTER_ASSERT(r, ((result >> 0) & 0xffff) == 0x3800);
+ REPORTER_ASSERT(r, ((result >> 16) & 0xffff) == 0x0000);
+ REPORTER_ASSERT(r, ((result >> 32) & 0xffff) == 0x3800);
+ REPORTER_ASSERT(r, ((result >> 48) & 0xffff) == 0x3c00);
}
DEF_TEST(SkRasterPipeline_empty, r) {