From f22872babafa5f104e6c4ab5a3fefdb1020d63fd Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 11 May 2014 18:01:50 +0100 Subject: [PATCH 1/4] Added clCreateImage2D() import. Nvidia is still on OpenCL 1.1 and needs it. --- include/bx/cl.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/bx/cl.h b/include/bx/cl.h index 158b309..c7b7bd7 100644 --- a/include/bx/cl.h +++ b/include/bx/cl.h @@ -669,6 +669,8 @@ typedef cl_int (CL_API_CALL* PFNCLENQUEUETASKPROC)(cl_command_queue, c typedef cl_int (CL_API_CALL* PFNCLENQUEUENATIVEKERNELPROC)(cl_command_queue, void (CL_CALLBACK*)(void*), void*, size_t, cl_uint, const cl_mem*, const void**, cl_uint, const cl_event*, cl_event*); // 1.1 +typedef cl_mem (CL_API_CALL* PFNCLCREATEIMAGE2DPROC)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*); +typedef cl_mem (CL_API_CALL* PFNCLCREATEIMAGE3DPROC)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, size_t, size_t, void*, cl_int*); typedef cl_mem (CL_API_CALL* PFNCLCREATESUBBUFFERPROC)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*); typedef cl_int (CL_API_CALL* PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC)(cl_mem, void (CL_CALLBACK*)(cl_mem, void*), void*); typedef cl_event (CL_API_CALL* PFNCLCREATEUSEREVENTPROC)(cl_context, cl_int*); @@ -769,6 +771,8 @@ typedef cl_int (CL_API_CALL* PFNCLENQUEUEBARRIERWITHWAITLISTPROC)(cl_c #define BX_CL_IMPORT_ALL_11 \ /* Memory Object APIs */ \ + BX_CL_IMPORT_11(false, PFNCLCREATEIMAGE2DPROC, clCreateImage2D); \ + BX_CL_IMPORT_11(false, PFNCLCREATEIMAGE3DPROC, clCreateImage3D); \ BX_CL_IMPORT_11(false, PFNCLCREATESUBBUFFERPROC, clCreateSubBuffer); \ BX_CL_IMPORT_11(false, PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC, clSetMemObjectDestructorCallback); \ /* Event Object APIs */ \ From 46285e42fd17ddf6398908c163b5fb9b6da54827 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 11 May 2014 18:03:14 +0100 Subject: [PATCH 2/4] Added commandline hasArg() float and double overloads. --- include/bx/commandline.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/bx/commandline.h b/include/bx/commandline.h index c5ca497..e184806 100644 --- a/include/bx/commandline.h +++ b/include/bx/commandline.h @@ -87,6 +87,31 @@ namespace bx return false; } + bool hasArg(float& _value, const char _short, const char* _long = NULL) const + { + const char* arg = findOption(_short, _long, 1); + if (NULL != arg) + { + _value = float(atof(arg)); + return true; + } + + return false; + } + + bool hasArg(double& _value, const char _short, const char* _long = NULL) const + { + const char* arg = findOption(_short, _long, 1); + if (NULL != arg) + { + _value = atof(arg); + return true; + } + + return false; + } + + bool hasArg(bool& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); From 6360f777ecdf54f94e73e9e6845764ce2fae2108 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 11 May 2014 18:05:28 +0100 Subject: [PATCH 3/4] Small bug fix. --- include/bx/commandline.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/bx/commandline.h b/include/bx/commandline.h index e184806..8385de7 100644 --- a/include/bx/commandline.h +++ b/include/bx/commandline.h @@ -117,11 +117,11 @@ namespace bx const char* arg = findOption(_short, _long, 1); if (NULL != arg) { - if ('0' == *arg || stricmp(arg, "false") ) + if ('0' == *arg || (0 == stricmp(arg, "false") ) ) { _value = false; } - else if ('0' != *arg || stricmp(arg, "true") ) + else if ('0' != *arg || (0 == stricmp(arg, "true") ) ) { _value = true; } From 1979f18ece9fabd022156d844ca181df8f3ea340 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 11 May 2014 18:06:51 +0100 Subject: [PATCH 4/4] Trailing whitespaces removed. --- include/bx/commandline.h | 1 - include/bx/string.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/bx/commandline.h b/include/bx/commandline.h index 8385de7..36d1ebb 100644 --- a/include/bx/commandline.h +++ b/include/bx/commandline.h @@ -111,7 +111,6 @@ namespace bx return false; } - bool hasArg(bool& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1); diff --git a/include/bx/string.h b/include/bx/string.h index c8e5a6e..383ac28 100644 --- a/include/bx/string.h +++ b/include/bx/string.h @@ -52,7 +52,7 @@ namespace bx const char* cmp = _find + 1; size_t len = strlen(cmp); - do + do { for (char match = *_str++; match != first && 0 < _size; match = *_str++, --_size) { @@ -66,7 +66,7 @@ namespace bx { return NULL; } - + } while (0 != strncmp(_str, cmp, len) ); return --_str;