Skip to content

Commit

Permalink
[Bind] Allow overriding of pointer level
Browse files Browse the repository at this point in the history
  • Loading branch information
thefiddler committed May 27, 2014
1 parent 26f1262 commit 5bfce4e
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 58 deletions.
8 changes: 8 additions & 0 deletions Source/Bind/FuncProcessor.cs
Expand Up @@ -523,6 +523,14 @@ static void ApplyParameterReplacement(Delegate d, XPathNavigator function_overri
if (Int32.TryParse(node.Value, out count))
d.Parameters[i].ElementCount = count;
break;
case "pointer":
int pointer;
if (Int32.TryParse(node.Value, out pointer))
d.Parameters[i].Pointer = pointer;
break;
default:
Console.Error.WriteLine("[Warning] Unknown parameter replacement '{0}'", node.Name);
break;
}
}
}
Expand Down
195 changes: 137 additions & 58 deletions Source/OpenTK/Compute/CL20/CL20.Enums.cs
Expand Up @@ -27,6 +27,33 @@

namespace OpenTK.Compute.CL20
{
/// <summary>
/// Used in GL.CreateSampler
/// </summary>
public enum AddressingMode : int
{
/// <summary>
/// Original was CL_ADDRESS_NONE = 0x1130
/// </summary>
AddressNone = ((int)0x1130) ,
/// <summary>
/// Original was CL_ADDRESS_CLAMP_TO_EDGE = 0x1131
/// </summary>
AddressClampToEdge = ((int)0x1131) ,
/// <summary>
/// Original was CL_ADDRESS_CLAMP = 0x1132
/// </summary>
AddressClamp = ((int)0x1132) ,
/// <summary>
/// Original was CL_ADDRESS_REPEAT = 0x1133
/// </summary>
AddressRepeat = ((int)0x1133) ,
/// <summary>
/// Original was CL_ADDRESS_MIRRORED_REPEAT = 0x1134
/// </summary>
AddressMirroredRepeat = ((int)0x1134) ,
}

/// <summary>
/// Not used directly.
/// </summary>
Expand Down Expand Up @@ -113,6 +140,14 @@ public enum All : int
/// </summary>
QueueProfilingEnable = ((int)(1 << 1)) ,
/// <summary>
/// Original was CL_MEM_SVM_FINE_GRAIN_BUFFER = (1 << 10)
/// </summary>
MemSvmFineGrainBuffer = ((int)(1 << 10)) ,
/// <summary>
/// Original was CL_MEM_SVM_ATOMICS = (1 << 11)
/// </summary>
MemSvmAtomics = ((int)(1 << 11)) ,
/// <summary>
/// Original was CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE = (1 << 2)
/// </summary>
DeviceAffinityDomainL3Cache = ((int)(1 << 2)) ,
Expand Down Expand Up @@ -973,25 +1008,25 @@ public enum All : int
/// </summary>
PipeMaxPackets = ((int)0x1121) ,
/// <summary>
/// Original was CL_enumRESS_NONE = 0x1130
/// Original was CL_ADDRESS_NONE = 0x1130
/// </summary>
EnumressNone = ((int)0x1130) ,
AddressNone = ((int)0x1130) ,
/// <summary>
/// Original was CL_enumRESS_CLAMP_TO_EDGE = 0x1131
/// Original was CL_ADDRESS_CLAMP_TO_EDGE = 0x1131
/// </summary>
EnumressClampToEdge = ((int)0x1131) ,
AddressClampToEdge = ((int)0x1131) ,
/// <summary>
/// Original was CL_enumRESS_CLAMP = 0x1132
/// Original was CL_ADDRESS_CLAMP = 0x1132
/// </summary>
EnumressClamp = ((int)0x1132) ,
AddressClamp = ((int)0x1132) ,
/// <summary>
/// Original was CL_enumRESS_REPEAT = 0x1133
/// Original was CL_ADDRESS_REPEAT = 0x1133
/// </summary>
EnumressRepeat = ((int)0x1133) ,
AddressRepeat = ((int)0x1133) ,
/// <summary>
/// Original was CL_enumRESS_MIRRORED_REPEAT = 0x1134
/// Original was CL_ADDRESS_MIRRORED_REPEAT = 0x1134
/// </summary>
EnumressMirroredRepeat = ((int)0x1134) ,
AddressMirroredRepeat = ((int)0x1134) ,
/// <summary>
/// Original was CL_FILTER_NEAREST = 0x1140
/// </summary>
Expand Down Expand Up @@ -2678,33 +2713,6 @@ public enum DeviceTypeFlags : int
DeviceTypeAll = unchecked((int)0xFFFFFFFF) ,
}

/// <summary>
/// Not used directly.
/// </summary>
public enum EnumressingMode : int
{
/// <summary>
/// Original was CL_enumRESS_NONE = 0x1130
/// </summary>
EnumressNone = ((int)0x1130) ,
/// <summary>
/// Original was CL_enumRESS_CLAMP_TO_EDGE = 0x1131
/// </summary>
EnumressClampToEdge = ((int)0x1131) ,
/// <summary>
/// Original was CL_enumRESS_CLAMP = 0x1132
/// </summary>
EnumressClamp = ((int)0x1132) ,
/// <summary>
/// Original was CL_enumRESS_REPEAT = 0x1133
/// </summary>
EnumressRepeat = ((int)0x1133) ,
/// <summary>
/// Original was CL_enumRESS_MIRRORED_REPEAT = 0x1134
/// </summary>
EnumressMirroredRepeat = ((int)0x1134) ,
}

/// <summary>
/// Not used directly.
/// </summary>
Expand Down Expand Up @@ -3246,9 +3254,9 @@ public enum MapFlags : int
}

/// <summary>
/// Not used directly.
/// Used in GL.CreateBuffer, GL.CreateImage and 5 other functions
/// </summary>
public enum MemFlagsAndSvmMemFlags : int
public enum MemFlags : int
{
/// <summary>
/// Original was CL_MEM_READ_WRITE = (1 << 0)
Expand All @@ -3274,6 +3282,18 @@ public enum MemFlagsAndSvmMemFlags : int
/// Original was CL_MEM_COPY_HOST_PTR = (1 << 5)
/// </summary>
MemCopyHostPtr = ((int)(1 << 5)) ,
/// <summary>
/// Original was CL_MEM_HOST_WRITE_ONLY = (1 << 7)
/// </summary>
MemHostWriteOnly = ((int)(1 << 7)) ,
/// <summary>
/// Original was CL_MEM_HOST_READ_ONLY = (1 << 8)
/// </summary>
MemHostReadOnly = ((int)(1 << 8)) ,
/// <summary>
/// Original was CL_MEM_HOST_NO_ACCESS = (1 << 9)
/// </summary>
MemHostNoAccess = ((int)(1 << 9)) ,
}

/// <summary>
Expand Down Expand Up @@ -3539,25 +3559,6 @@ public enum ProgramInfo : int
ProgramKernelNames = ((int)0x1168) ,
}

/// <summary>
/// Not used directly.
/// </summary>
public enum Reserved(1<<6) : int
{
/// <summary>
/// Original was CL_MEM_HOST_WRITE_ONLY = (1 << 7)
/// </summary>
MemHostWriteOnly = ((int)(1 << 7)) ,
/// <summary>
/// Original was CL_MEM_HOST_READ_ONLY = (1 << 8)
/// </summary>
MemHostReadOnly = ((int)(1 << 8)) ,
/// <summary>
/// Original was CL_MEM_HOST_NO_ACCESS = (1 << 9)
/// </summary>
MemHostNoAccess = ((int)(1 << 9)) ,
}

/// <summary>
/// Used in GL.GetSamplerInfo
/// </summary>
Expand Down Expand Up @@ -3597,6 +3598,84 @@ public enum SamplerInfo : int
SamplerLodMax = ((int)0x1157) ,
}

/// <summary>
/// Used in GL.CreateSamplerWithProperties
/// </summary>
public enum SamplerProperties : int
{
/// <summary>
/// Original was CL_SAMPLER_NORMALIZED_COORDS = 0x1152
/// </summary>
SamplerNormalizedCoords = ((int)0x1152) ,
/// <summary>
/// Original was CL_SAMPLER_FILTER_MODE = 0x1154
/// </summary>
SamplerFilterMode = ((int)0x1154) ,
/// <summary>
/// Original was CL_SAMPLER_MIP_FILTER_MODE = 0x1155
/// </summary>
SamplerMipFilterMode = ((int)0x1155) ,
/// <summary>
/// Original was CL_SAMPLER_LOD_MIN = 0x1156
/// </summary>
SamplerLodMin = ((int)0x1156) ,
/// <summary>
/// Original was CL_SAMPLER_LOD_MAX = 0x1157
/// </summary>
SamplerLodMax = ((int)0x1157) ,
}

/// <summary>
/// Used in GL.SVMAlloc
/// </summary>
public enum SvmMemFlags : int
{
/// <summary>
/// Original was CL_MEM_READ_WRITE = (1 << 0)
/// </summary>
MemReadWrite = ((int)(1 << 0)) ,
/// <summary>
/// Original was CL_MEM_WRITE_ONLY = (1 << 1)
/// </summary>
MemWriteOnly = ((int)(1 << 1)) ,
/// <summary>
/// Original was CL_MEM_SVM_FINE_GRAIN_BUFFER = (1 << 10)
/// </summary>
MemSvmFineGrainBuffer = ((int)(1 << 10)) ,
/// <summary>
/// Original was CL_MEM_SVM_ATOMICS = (1 << 11)
/// </summary>
MemSvmAtomics = ((int)(1 << 11)) ,
/// <summary>
/// Original was CL_MEM_READ_ONLY = (1 << 2)
/// </summary>
MemReadOnly = ((int)(1 << 2)) ,
/// <summary>
/// Original was CL_MEM_USE_HOST_PTR = (1 << 3)
/// </summary>
MemUseHostPtr = ((int)(1 << 3)) ,
/// <summary>
/// Original was CL_MEM_ALLOC_HOST_PTR = (1 << 4)
/// </summary>
MemAllocHostPtr = ((int)(1 << 4)) ,
/// <summary>
/// Original was CL_MEM_COPY_HOST_PTR = (1 << 5)
/// </summary>
MemCopyHostPtr = ((int)(1 << 5)) ,
/// <summary>
/// Original was CL_MEM_HOST_WRITE_ONLY = (1 << 7)
/// </summary>
MemHostWriteOnly = ((int)(1 << 7)) ,
/// <summary>
/// Original was CL_MEM_HOST_READ_ONLY = (1 << 8)
/// </summary>
MemHostReadOnly = ((int)(1 << 8)) ,
/// <summary>
/// Original was CL_MEM_HOST_NO_ACCESS = (1 << 9)
/// </summary>
MemHostNoAccess = ((int)(1 << 9)) ,
}

/// <summary>
/// Not used directly.
/// </summary>
Expand Down
69 changes: 69 additions & 0 deletions Source/OpenTK/Compute/CL20/CL20.Helper.cs
@@ -0,0 +1,69 @@
#region License
//
// CL20.Helper.cs
//
// Author:
// Stefanos A. <stapostol@gmail.com>
//
// Copyright (c) 2006-2014 Stefanos Apostolopoulos
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#endregion

using System;
using System.Runtime.InteropServices;

namespace OpenTK.Compute.CL20
{
public sealed partial class CL : ComputeBindingsBase
{
const string Library = "OpenCL";
static readonly byte[] EntryPointNames;
static readonly int[] EntryPointNameOffsets;
static readonly IntPtr[] EntryPoints;
static readonly object sync_root = new object();

protected override object SyncRoot
{
get
{
return sync_root;
}
}
}

public delegate void ContextNotifyDelegate();
public delegate void EventNotifyDelegate();
public delegate void MemObjectNotifyDelegate();
public delegate void ProgramNotifyDelegate();
public delegate void SvmFreeDelegate();
public delegate void UserNotifyDelegate();

[StructLayout(LayoutKind.Sequential)]
public struct ImageDescriptor
{
}

[StructLayout(LayoutKind.Sequential)]
public struct ImageFormat
{
}
}

0 comments on commit 5bfce4e

Please sign in to comment.