Jelajahi Sumber

Merge pull request #15 from dariomanesku/master

Minor fixes.
Branimir Karadžić 11 tahun lalu
induk
melakukan
4de65f8474
3 mengubah file dengan 32 tambahan dan 4 penghapusan
  1. 4 0
      include/bx/cl.h
  2. 26 2
      include/bx/commandline.h
  3. 2 2
      include/bx/string.h

+ 4 - 0
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*);
 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
 // 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_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_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*);
 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 \
 #define BX_CL_IMPORT_ALL_11 \
 			/* Memory Object APIs */ \
 			/* 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, PFNCLCREATESUBBUFFERPROC,                 clCreateSubBuffer); \
 			BX_CL_IMPORT_11(false, PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC,  clSetMemObjectDestructorCallback); \
 			BX_CL_IMPORT_11(false, PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC,  clSetMemObjectDestructorCallback); \
 			/* Event Object APIs */  \
 			/* Event Object APIs */  \

+ 26 - 2
include/bx/commandline.h

@@ -87,16 +87,40 @@ namespace bx
 			return false;
 			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
 		bool hasArg(bool& _value, const char _short, const char* _long = NULL) const
 		{
 		{
 			const char* arg = findOption(_short, _long, 1);
 			const char* arg = findOption(_short, _long, 1);
 			if (NULL != arg)
 			if (NULL != arg)
 			{
 			{
-				if ('0' == *arg || stricmp(arg, "false") )
+				if ('0' == *arg || (0 == stricmp(arg, "false") ) )
 				{
 				{
 					_value = false;
 					_value = false;
 				}
 				}
-				else if ('0' != *arg || stricmp(arg, "true") )
+				else if ('0' != *arg || (0 == stricmp(arg, "true") ) )
 				{
 				{
 					_value = true;
 					_value = true;
 				}
 				}

+ 2 - 2
include/bx/string.h

@@ -52,7 +52,7 @@ namespace bx
 
 
 		const char* cmp = _find + 1;
 		const char* cmp = _find + 1;
 		size_t len = strlen(cmp);
 		size_t len = strlen(cmp);
-		do 
+		do
 		{
 		{
 			for (char match = *_str++; match != first && 0 < _size; match = *_str++, --_size)
 			for (char match = *_str++; match != first && 0 < _size; match = *_str++, --_size)
 			{
 			{
@@ -66,7 +66,7 @@ namespace bx
 			{
 			{
 				return NULL;
 				return NULL;
 			}
 			}
-			
+
 		} while (0 != strncmp(_str, cmp, len) );
 		} while (0 != strncmp(_str, cmp, len) );
 
 
 		return --_str;
 		return --_str;