diff --git a/Source/Bind/Specifications/CL10/signatures.xml b/Source/Bind/Specifications/CL10/signatures.xml index 7817a555..89c76c70 100644 --- a/Source/Bind/Specifications/CL10/signatures.xml +++ b/Source/Bind/Specifications/CL10/signatures.xml @@ -168,7 +168,7 @@ - + @@ -418,7 +418,7 @@ - + diff --git a/Source/Converter/ESCLParser.cs b/Source/Converter/ESCLParser.cs index 0a54cda7..c8a8adec 100644 --- a/Source/Converter/ESCLParser.cs +++ b/Source/Converter/ESCLParser.cs @@ -209,13 +209,17 @@ namespace CHeaderToXML var paramaters_string = Regex.Match(line, @"\(.*\)").Captures[0].Value.TrimStart('(').TrimEnd(')'); // This regex matches function parameters. - // The first part matches functions pointers in the following format: + // The first part matches function pointers in the following format: // '[return type] (*[function pointer name])([parameter list]) [parameter name] // where [parameter name] may or may not be in comments. - // The second part (before the '|') matches parameters of the following formats: - // '[return type] [parameter name]', '[return type] * [parameter name]', 'const [return type]* [parameter name]' - // where [parameter name] can either be inside comments (/* ... */) or not. - var get_param = new Regex(@"(\w+\s\(\*\w+\)\s*\(.*\)\s*(/\*.*?\*/|\w+)? | (const\s)?\w+\s*\**\s*(/\*.*?\*/|\w+(\[.*?\])?)),?", RegexOptions.IgnorePatternWhitespace); + // The second part (after the '|') matches parameters of the following formats: + // '[parameter type] [parameter name]', '[parameter type] [pointer] [parameter name]', 'const [parameter type][pointer] [parameter name]' + // where [parameter name] may be inside comments (/* ... */) and [pointer] is '', '*', '**', etc. + var get_param = new Regex(@"(\w+\s\(\*\w+\)\s*\(.*\)\s*(/\*.*?\*/|\w+)? | (const\s)?(\w+\s*)+\**\s*(/\*.*?\*/|\w+(\[.*?\])?)),?", RegexOptions.IgnorePatternWhitespace); + + var parameters = + (from item in get_param.Matches(paramaters_string).OfType() + select item.Captures[0].Value.TrimEnd(',')).ToList(); var fun = new @@ -257,7 +261,9 @@ namespace CHeaderToXML Count = has_array_size ? Int32.Parse(array_size.Match(param_name).Value.Trim('[', ']')) : 0, Flow = param_name.EndsWith("ret") || - ((funcname.StartsWith("Get") || funcname.StartsWith("Gen")) && indirection_level > 0) ? + ((funcname.StartsWith("Get") || funcname.StartsWith("Gen")) && + indirection_level > 0 && + !(funcname.EndsWith("Info") || funcname.EndsWith("IDs") || funcname.EndsWith("ImageFormats"))) ? // OpenCL contains Get*[Info|IDs|ImageFormats] methods with 'in' pointer parameters "out" : "in" } }; diff --git a/Source/OpenTK/Compute/CL10/CL.cs b/Source/OpenTK/Compute/CL10/CL.cs index 631cd8fc..d5cdf85f 100644 --- a/Source/OpenTK/Compute/CL10/CL.cs +++ b/Source/OpenTK/Compute/CL10/CL.cs @@ -2607,86 +2607,80 @@ namespace OpenTK.Compute.CL10 [System.CLSCompliant(false)] [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] public static - unsafe IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret) + unsafe IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, IntPtr* device_list, IntPtr* lengths, byte** binaries, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret) { - return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list, (IntPtr*)lengths, (byte)@char, (int*)binary_status, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret); + return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list, (IntPtr*)lengths, (byte**)binaries, (int*)binary_status, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret); } + [System.CLSCompliant(false)] [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] public static - IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, IntPtr[] device_list, IntPtr[] lengths, byte @char, int[] binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode[] errcode_ret) + unsafe IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, IntPtr[] device_list, IntPtr[] lengths, byte*[] binaries, int[] binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode[] errcode_ret) { - unsafe + fixed (IntPtr* device_list_ptr = device_list) + fixed (IntPtr* lengths_ptr = lengths) + fixed (byte** binaries_ptr = binaries) + fixed (int* binary_status_ptr = binary_status) + fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = errcode_ret) { - fixed (IntPtr* device_list_ptr = device_list) - fixed (IntPtr* lengths_ptr = lengths) - fixed (int* binary_status_ptr = binary_status) - fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = errcode_ret) - { - return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte)@char, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); - } - } - } - - [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] - public static - IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, ref IntPtr device_list, ref IntPtr lengths, byte @char, ref int binary_status, [OutAttribute] out OpenTK.Compute.CL10.ErrorCode errcode_ret) - { - unsafe - { - fixed (IntPtr* device_list_ptr = &device_list) - fixed (IntPtr* lengths_ptr = &lengths) - fixed (int* binary_status_ptr = &binary_status) - fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = &errcode_ret) - { - IntPtr retval = Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte)@char, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); - errcode_ret = *errcode_ret_ptr; - return retval; - } + return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte**)binaries_ptr, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); } } [System.CLSCompliant(false)] [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] public static - unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret) + unsafe IntPtr CreateProgramWithBinary(IntPtr context, Int32 num_devices, ref IntPtr device_list, ref IntPtr lengths, ref byte* binaries, ref int binary_status, [OutAttribute] out OpenTK.Compute.CL10.ErrorCode errcode_ret) { - return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list, (IntPtr*)lengths, (byte)@char, (int*)binary_status, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret); - } - - [System.CLSCompliant(false)] - [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] - public static - IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr[] device_list, IntPtr[] lengths, byte @char, int[] binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode[] errcode_ret) - { - unsafe + fixed (IntPtr* device_list_ptr = &device_list) + fixed (IntPtr* lengths_ptr = &lengths) + fixed (byte** binaries_ptr = &binaries) + fixed (int* binary_status_ptr = &binary_status) + fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = &errcode_ret) { - fixed (IntPtr* device_list_ptr = device_list) - fixed (IntPtr* lengths_ptr = lengths) - fixed (int* binary_status_ptr = binary_status) - fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = errcode_ret) - { - return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte)@char, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); - } + IntPtr retval = Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte**)binaries_ptr, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); + errcode_ret = *errcode_ret_ptr; + return retval; } } [System.CLSCompliant(false)] [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] public static - IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, ref IntPtr device_list, ref IntPtr lengths, byte @char, ref int binary_status, [OutAttribute] out OpenTK.Compute.CL10.ErrorCode errcode_ret) + unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte** binaries, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret) { - unsafe + return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list, (IntPtr*)lengths, (byte**)binaries, (int*)binary_status, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret); + } + + [System.CLSCompliant(false)] + [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] + public static + unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr[] device_list, IntPtr[] lengths, byte*[] binaries, int[] binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode[] errcode_ret) + { + fixed (IntPtr* device_list_ptr = device_list) + fixed (IntPtr* lengths_ptr = lengths) + fixed (byte** binaries_ptr = binaries) + fixed (int* binary_status_ptr = binary_status) + fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = errcode_ret) { - fixed (IntPtr* device_list_ptr = &device_list) - fixed (IntPtr* lengths_ptr = &lengths) - fixed (int* binary_status_ptr = &binary_status) - fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = &errcode_ret) - { - IntPtr retval = Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte)@char, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); - errcode_ret = *errcode_ret_ptr; - return retval; - } + return Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte**)binaries_ptr, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); + } + } + + [System.CLSCompliant(false)] + [AutoGenerated(Category = "1.0", Version = "1.0", EntryPoint = "clCreateProgramWithBinary")] + public static + unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, ref IntPtr device_list, ref IntPtr lengths, ref byte* binaries, ref int binary_status, [OutAttribute] out OpenTK.Compute.CL10.ErrorCode errcode_ret) + { + fixed (IntPtr* device_list_ptr = &device_list) + fixed (IntPtr* lengths_ptr = &lengths) + fixed (byte** binaries_ptr = &binaries) + fixed (int* binary_status_ptr = &binary_status) + fixed (OpenTK.Compute.CL10.ErrorCode* errcode_ret_ptr = &errcode_ret) + { + IntPtr retval = Delegates.clCreateProgramWithBinary((IntPtr)context, (uint)num_devices, (IntPtr*)device_list_ptr, (IntPtr*)lengths_ptr, (byte**)binaries_ptr, (int*)binary_status_ptr, (OpenTK.Compute.CL10.ErrorCode*)errcode_ret_ptr); + errcode_ret = *errcode_ret_ptr; + return retval; } } diff --git a/Source/OpenTK/Compute/CL10/Core.cs b/Source/OpenTK/Compute/CL10/Core.cs index 48bbe6b6..9b86cd40 100644 --- a/Source/OpenTK/Compute/CL10/Core.cs +++ b/Source/OpenTK/Compute/CL10/Core.cs @@ -68,7 +68,7 @@ namespace OpenTK.Compute.CL10 internal extern static unsafe int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret); [System.Security.SuppressUnmanagedCodeSecurity()] [System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithBinary", ExactSpelling = true)] - internal extern static unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret); + internal extern static unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte** binaries, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret); [System.Security.SuppressUnmanagedCodeSecurity()] [System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithSource", ExactSpelling = true)] internal extern static unsafe IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret); diff --git a/Source/OpenTK/Compute/CL10/Delegates.cs b/Source/OpenTK/Compute/CL10/Delegates.cs index 447e673a..77bb09ee 100644 --- a/Source/OpenTK/Compute/CL10/Delegates.cs +++ b/Source/OpenTK/Compute/CL10/Delegates.cs @@ -66,7 +66,7 @@ namespace OpenTK.Compute.CL10 internal unsafe delegate int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret); internal unsafe static CreateKernelsInProgram clCreateKernelsInProgram; [System.Security.SuppressUnmanagedCodeSecurity()] - internal unsafe delegate IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret); + internal unsafe delegate IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte** binaries, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret); internal unsafe static CreateProgramWithBinary clCreateProgramWithBinary; [System.Security.SuppressUnmanagedCodeSecurity()] internal unsafe delegate IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);