mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-10 23:45:41 +00:00
* Source/OpenTK/Compute/CL10/CL.cs:
* Source/OpenTK/Compute/CL10/Core.cs: * Source/Bind/Specifications/csharp.tm: * Source/OpenTK/Compute/CL10/Delegates.cs: cl_context_properties should be mapped to IntPtr, not int. Modified CreateContext signature to return ErrorCode rather than plain int. * Source/OpenTK/Compute/CL10/CLHelper.cs: Added helper overloads that convert ContextProperties enums into IntPtr internally.
This commit is contained in:
parent
e8e1c82582
commit
6d6ad9646a
|
@ -118,7 +118,7 @@ cl_addressing_mode, AddressingMode
|
|||
cl_command_queue_info, CommandQueueInfo
|
||||
cl_command_queue_properties, CommandQueueProperties
|
||||
cl_context_info, ContextInfo
|
||||
cl_context_properties, ContextProperties
|
||||
cl_context_properties, IntPtr # ContextProperties
|
||||
cl_device_info, DeviceInfo
|
||||
cl_device_type, DeviceType
|
||||
cl_event_info, EventInfo
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
#region License
|
||||
#region License
|
||||
//
|
||||
// The Open Toolkit Library License
|
||||
//
|
||||
|
@ -92,5 +92,91 @@ namespace OpenTK.Compute.CL10
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Overrides
|
||||
|
||||
public static unsafe IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, OpenTK.Compute.CL10.ErrorCode* errcode_ret)
|
||||
{
|
||||
return CreateContext((IntPtr*)properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContext(ContextProperties[] properties, uint num_devices, IntPtr[] devices, IntPtr pfn_notify, IntPtr user_data, OpenTK.Compute.CL10.ErrorCode[] errcode_ret)
|
||||
{
|
||||
IntPtr[] properties_correct = properties != null ? new IntPtr[properties.Length] : null;
|
||||
for (int i = 0; i < properties_correct.Length; i++)
|
||||
properties_correct[i] = new IntPtr((int)properties[i]);
|
||||
return CreateContext(properties_correct, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContext(ref ContextProperties properties, uint num_devices, ref IntPtr devices, IntPtr pfn_notify, IntPtr user_data, out OpenTK.Compute.CL10.ErrorCode errcode_ret)
|
||||
{
|
||||
IntPtr properties_correct = new IntPtr((int)properties);
|
||||
return CreateContext(ref properties_correct, num_devices, ref devices, pfn_notify, user_data, out errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContext<T4>(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, ref T4 user_data, OpenTK.Compute.CL10.ErrorCode* errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
return CreateContext((IntPtr*)properties, num_devices, devices, pfn_notify, ref user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContext<T4>(ContextProperties[] properties, uint num_devices, IntPtr[] devices, IntPtr pfn_notify, ref T4 user_data, OpenTK.Compute.CL10.ErrorCode[] errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
IntPtr[] properties_correct = properties != null ? new IntPtr[properties.Length] : null;
|
||||
for (int i = 0; i < properties_correct.Length; i++)
|
||||
properties_correct[i] = new IntPtr((int)properties[i]);
|
||||
return CreateContext(properties_correct, num_devices, devices, pfn_notify, ref user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContext<T4>(ref ContextProperties properties, uint num_devices, ref IntPtr devices, IntPtr pfn_notify, ref T4 user_data, out OpenTK.Compute.CL10.ErrorCode errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
IntPtr properties_correct = new IntPtr((int)properties);
|
||||
return CreateContext(ref properties_correct, num_devices, ref devices, pfn_notify, ref user_data, out errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, OpenTK.Compute.CL10.ErrorCode* errcode_ret)
|
||||
{
|
||||
return CreateContextFromType((IntPtr*)properties, device_type, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType(ContextProperties[] properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, OpenTK.Compute.CL10.ErrorCode[] errcode_ret)
|
||||
{
|
||||
IntPtr[] properties_correct = properties != null ? new IntPtr[properties.Length] : null;
|
||||
for (int i = 0; i < properties_correct.Length; i++)
|
||||
properties_correct[i] = new IntPtr((int)properties[i]);
|
||||
return CreateContextFromType(properties_correct, device_type, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType(ref ContextProperties properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, out OpenTK.Compute.CL10.ErrorCode errcode_ret)
|
||||
{
|
||||
IntPtr properties_correct = new IntPtr((int)properties);
|
||||
return CreateContextFromType(ref properties_correct, device_type, pfn_notify, user_data, out errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType<T4>(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, ref T4 user_data, OpenTK.Compute.CL10.ErrorCode* errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
return CreateContextFromType((IntPtr*)properties, device_type, pfn_notify, ref user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType<T4>(ContextProperties[] properties, DeviceTypeFlags device_type, IntPtr pfn_notify, ref T4 user_data, OpenTK.Compute.CL10.ErrorCode[] errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
IntPtr[] properties_correct = properties != null ? new IntPtr[properties.Length] : null;
|
||||
for (int i = 0; i < properties_correct.Length; i++)
|
||||
properties_correct[i] = new IntPtr((int)properties[i]);
|
||||
return CreateContextFromType(properties_correct, device_type, pfn_notify, ref user_data, errcode_ret);
|
||||
}
|
||||
|
||||
public static unsafe IntPtr CreateContextFromType<T4>(ref ContextProperties properties, DeviceTypeFlags device_type, IntPtr pfn_notify, ref T4 user_data, out OpenTK.Compute.CL10.ErrorCode errcode_ret)
|
||||
where T4 : struct
|
||||
{
|
||||
IntPtr properties_correct = new IntPtr((int)properties);
|
||||
return CreateContextFromType(ref properties_correct, device_type, pfn_notify, ref user_data, out errcode_ret);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ namespace OpenTK.Compute.CL10
|
|||
internal extern static unsafe IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContext", ExactSpelling = true)]
|
||||
internal extern static unsafe IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
|
||||
internal extern static unsafe IntPtr CreateContext(IntPtr* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContextFromType", ExactSpelling = true)]
|
||||
internal extern static unsafe IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
internal extern static unsafe IntPtr CreateContextFromType(IntPtr* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateImage2D", ExactSpelling = true)]
|
||||
internal extern static unsafe IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
|
||||
|
|
|
@ -48,10 +48,10 @@ namespace OpenTK.Compute.CL10
|
|||
internal unsafe delegate IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
internal unsafe static CreateCommandQueue clCreateCommandQueue;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
|
||||
internal unsafe delegate IntPtr CreateContext(IntPtr* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
internal unsafe static CreateContext clCreateContext;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
internal unsafe delegate IntPtr CreateContextFromType(IntPtr* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
|
||||
internal unsafe static CreateContextFromType clCreateContextFromType;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
|
||||
|
|
Loading…
Reference in a new issue