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

Side by Side Diff: experimental/skpdiff/skpdiff_util.cpp

Issue 19374006: make OpenCL optional for skpdiff (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: this-> 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/skpdiff/skpdiff_util.h ('k') | gyp/common_conditions.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <time.h> 8 #include <time.h>
9 #include <dirent.h> 9 #include <dirent.h>
10 #include <glob.h> 10 #include <glob.h>
11 #include "SkOSFile.h" 11 #include "SkOSFile.h"
12 #include "skpdiff_util.h" 12 #include "skpdiff_util.h"
13 13
14 #if SK_SUPPORT_OPENCL
14 const char* cl_error_to_string(cl_int err) { 15 const char* cl_error_to_string(cl_int err) {
15 switch (err) { 16 switch (err) {
16 case CL_SUCCESS: return "CL_SUCCESS"; 17 case CL_SUCCESS: return "CL_SUCCESS";
17 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; 18 case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND";
18 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE "; 19 case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE ";
19 case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILAB LE"; 20 case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILAB LE";
20 case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATIO N_FAILURE"; 21 case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATIO N_FAILURE";
21 case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; 22 case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES";
22 case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; 23 case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY";
23 case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_A VAILABLE"; 24 case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_A VAILABLE";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_L IST"; 57 case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_L IST";
57 case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; 58 case CL_INVALID_EVENT: return "CL_INVALID_EVENT";
58 case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; 59 case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION";
59 case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; 60 case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT";
60 case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE" ; 61 case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE" ;
61 case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; 62 case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL";
62 default: return "UNKNOWN"; 63 default: return "UNKNOWN";
63 } 64 }
64 return "UNKNOWN"; 65 return "UNKNOWN";
65 } 66 }
67 #endif
66 68
67 69
68 double get_seconds() { 70 double get_seconds() {
69 struct timespec currentTime; 71 struct timespec currentTime;
70 clock_gettime(CLOCK_REALTIME, &currentTime); 72 clock_gettime(CLOCK_REALTIME, &currentTime);
71 return currentTime.tv_sec + (double)currentTime.tv_nsec / 1e9; 73 return currentTime.tv_sec + (double)currentTime.tv_nsec / 1e9;
72 } 74 }
73 75
74 bool get_directory(const char path[], SkTArray<SkString>* entries) { 76 bool get_directory(const char path[], SkTArray<SkString>* entries) {
75 // Open the directory and check for success 77 // Open the directory and check for success
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 char** paths = globBuffer.gl_pathv; 110 char** paths = globBuffer.gl_pathv;
109 while(NULL != *paths) { 111 while(NULL != *paths) {
110 entries->push_back(SkString(*paths)); 112 entries->push_back(SkString(*paths));
111 paths++; 113 paths++;
112 } 114 }
113 115
114 globfree(&globBuffer); 116 globfree(&globBuffer);
115 117
116 return true; 118 return true;
117 } 119 }
OLDNEW
« no previous file with comments | « experimental/skpdiff/skpdiff_util.h ('k') | gyp/common_conditions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698