Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2760)

Unified Diff: experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp

Issue 19787006: ports for mac, ios, android, linux, windows (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp
diff --git a/experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp b/experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp
index 61fb63813bcabbbcedbe5575796c3876f24573e1..f2a02c1c1823972793a9af7685910e6d46ec4d06 100644
--- a/experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp
+++ b/experimental/skpdiff/SkDifferentPixelsMetric_opencl.cpp
@@ -22,7 +22,6 @@ static const char kDifferentPixelsKernelSource[] =
" int2 coord = (int2)(get_global_id(0), get_global_id(1)); \n"
" uint4 baselinePixel = read_imageui(baseline, gInSampler, coord); \n"
" uint4 testPixel = read_imageui(test, gInSampler, coord); \n"
- " int4 pixelCompare = baselinePixel == testPixel; \n"
" if (baselinePixel.x != testPixel.x || \n"
" baselinePixel.y != testPixel.y || \n"
" baselinePixel.z != testPixel.z || \n"
@@ -120,9 +119,12 @@ int SkDifferentPixelsMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
diff->result *= (double)diff->numDiffPixels;
diff->result = (1.0 - diff->result);
- diff->poi = SkNEW_ARRAY(SkIPoint, diff->numDiffPixels);
- clEnqueueReadBuffer(fCommandQueue, diff->poiBuffer, CL_TRUE, 0,
+ // Reading a buffer of size zero can cause issues on some (Mac) OpenCL platforms.
+ if (diff->numDiffPixels > 0) {
+ diff->poi = SkNEW_ARRAY(SkIPoint, diff->numDiffPixels);
+ clEnqueueReadBuffer(fCommandQueue, diff->poiBuffer, CL_TRUE, 0,
sizeof(SkIPoint) * diff->numDiffPixels, diff->poi, 0, NULL, NULL);
+ }
// Release all the buffers created
clReleaseMemObject(diff->poiBuffer);

Powered by Google App Engine
This is Rietveld 408576698