Index: experimental/skpdiff/main.cpp |
diff --git a/experimental/skpdiff/main.cpp b/experimental/skpdiff/main.cpp |
index 7ed0e4d90d2aa961934650fbe45ecef8e032ade0..9664f33de5595cdec65ce49558e3f2b9c51a3b45 100644 |
--- a/experimental/skpdiff/main.cpp |
+++ b/experimental/skpdiff/main.cpp |
@@ -6,9 +6,16 @@ |
*/ |
#if SK_SUPPORT_OPENCL |
+ |
#define __NO_STD_VECTOR // Uses cl::vectpr instead of std::vectpr |
#define __NO_STD_STRING // Uses cl::STRING_CLASS instead of std::string |
-#include <CL/cl.hpp> |
+#if SK_BUILD_FOR_MAC |
+// Note that some macs don't have this header and it can be downloaded from the Khronos registry |
+# include <OpenCL/cl.hpp> |
+#else |
+# include <CL/cl.hpp> |
+#endif |
+ |
#endif |
#include "SkCommandLineFlags.h" |
@@ -36,7 +43,7 @@ DEFINE_string(csv, "", "Writes the output of these diffs to a csv file"); |
#if SK_SUPPORT_OPENCL |
/// A callback for any OpenCL errors |
-CL_CALLBACK void error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) { |
+static void CL_CALLBACK error_notify(const char* errorInfo, const void* privateInfoSize, ::size_t cb, void* userData) { |
SkDebugf("OpenCL error notify: %s\n", errorInfo); |
exit(1); |
} |
@@ -56,8 +63,8 @@ static bool init_device_and_context(cl::Device* device, cl::Context* context) { |
// Query for a device |
cl::vector<cl::Device> deviceList; |
- platform.getDevices(CL_DEVICE_TYPE_GPU, &deviceList); |
- SkDebugf("The number of GPU devices is %u\n", deviceList.size()); |
+ platform.getDevices(CL_DEVICE_TYPE_ALL, &deviceList); |
+ SkDebugf("The number of devices is %u\n", deviceList.size()); |
// Print some information about the device for debugging |
*device = deviceList[0]; |
@@ -100,7 +107,8 @@ SkPMetric gPDiff; |
// A null terminated array of pointer to every differ declared above |
SkImageDiffer* gDiffers[] = { &gDiffPixel, &gPDiff, NULL }; |
-int main(int argc, char** argv) { |
+int tool_main(int argc, char * argv[]); |
+int tool_main(int argc, char * argv[]) { |
// Setup command line parsing |
SkCommandLineFlags::SetUsage("Compare images using various metrics."); |
SkCommandLineFlags::Parse(argc, argv); |
@@ -203,3 +211,9 @@ int main(int argc, char** argv) { |
return 0; |
} |
+ |
+#if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
+int main(int argc, char * argv[]) { |
+ return tool_main(argc, (char**) argv); |
+} |
+#endif |