Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:zhensydow/opencl

  • Loading branch information...
commit 0009159bf4cb44eacf78a754ea120628f54ae57a 2 parents c134107 + fcb9642
@zhensydow zhensydow authored
View
12 OpenCL.cabal
@@ -1,5 +1,5 @@
Name: OpenCL
-Version: 1.0.3.0
+Version: 1.0.3.2
License: BSD3
License-File: LICENSE
Author: Luis Cabellos
@@ -49,6 +49,8 @@ Library
if os(linux)
cpp-options: -DCALLCONV=ccall -Iinclude
Frameworks: OpenCL
+ -- this is needed for linking executables, but not for ghci -lOpenCL:
+ extra-libraries: OpenCL
if os(darwin)
cpp-options: -DCALLCONV=ccall
@@ -56,7 +58,13 @@ Library
Frameworks: OpenCL
if os(windows)
- cpp-options: -DCALLCONV=stdcall
+ cpp-options: -DCALLCONV=stdcall -Iinclude
+ include-dirs: include
+ ghc-options: -lOpenCL
+ ld-options: -lOpenCL
+ -- NOTE: extra-libraries: OpenCL seems to fail without finding library!
+ -- NOTE: include-dirs without -Iinclude seems to fail too with GHC 7.4.1!
+
Test-suite tests
type: exitcode-stdio-1.0
View
4 README.org
@@ -36,10 +36,10 @@
There is an simple working example in the examples folder. You can create an
executable using:
- : ghc --make -lOpenCL examples/example01.hs
+ : ghc --make examples/example01.hs
** Using ghci
It's possible to use GHCi with OpenCL, e.g.:
- : ghci -lOpenCL examples/example01.hs
+ : ghci examples/example01.hs
View
156 src/Control/Parallel/OpenCL/Context.chs
@@ -39,14 +39,15 @@ module Control.Parallel.OpenCL.Context(
where
-- -----------------------------------------------------------------------------
-import Foreign(
- Ptr, FunPtr, nullPtr, castPtr, alloca, allocaArray, peek, peekArray,
+import Foreign(
+ Ptr, FunPtr, nullPtr, castPtr, alloca, allocaArray, peek, peekArray,
ptrToIntPtr, intPtrToPtr, withArray )
-import Foreign.C.Types( CSize )
+import Foreign.C.Types -- expose FFI type constructors, the final imported list
+ -- depends on final architecture
import Foreign.C.String( CString, peekCString )
import Foreign.Storable( sizeOf )
-import Control.Parallel.OpenCL.Types(
- CLuint, CLint, CLDeviceType_, CLContextInfo_, CLContextProperty_, CLDeviceID,
+import Control.Parallel.OpenCL.Types(
+ CLuint, CLint, CLDeviceType_, CLContextInfo_, CLContextProperty_, CLDeviceID,
CLContext, CLDeviceType, CLPlatformID, bitmaskFromFlags, getCLValue, getEnumCL,
whenSuccess, wrapCheckSuccess, wrapPError, wrapGetInfo )
@@ -54,65 +55,122 @@ import Control.Parallel.OpenCL.Types(
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
+#include <CL/cl_gl.h>
#endif
-- -----------------------------------------------------------------------------
type ContextCallback = CString -> Ptr () -> CSize -> Ptr () -> IO ()
-foreign import CALLCONV "wrapper" wrapContextCallback ::
+foreign import CALLCONV "wrapper" wrapContextCallback ::
ContextCallback -> IO (FunPtr ContextCallback)
foreign import CALLCONV "clCreateContext" raw_clCreateContext ::
- Ptr CLContextProperty_ -> CLuint -> Ptr CLDeviceID -> FunPtr ContextCallback ->
+ Ptr CLContextProperty_ -> CLuint -> Ptr CLDeviceID -> FunPtr ContextCallback ->
Ptr () -> Ptr CLint -> IO CLContext
-foreign import CALLCONV "clCreateContextFromType" raw_clCreateContextFromType ::
- Ptr CLContextProperty_ -> CLDeviceType_ -> FunPtr ContextCallback ->
+foreign import CALLCONV "clCreateContextFromType" raw_clCreateContextFromType ::
+ Ptr CLContextProperty_ -> CLDeviceType_ -> FunPtr ContextCallback ->
Ptr () -> Ptr CLint -> IO CLContext
-foreign import CALLCONV "clRetainContext" raw_clRetainContext ::
+foreign import CALLCONV "clRetainContext" raw_clRetainContext ::
CLContext -> IO CLint
-foreign import CALLCONV "clReleaseContext" raw_clReleaseContext ::
+foreign import CALLCONV "clReleaseContext" raw_clReleaseContext ::
CLContext -> IO CLint
-foreign import CALLCONV "clGetContextInfo" raw_clGetContextInfo ::
+foreign import CALLCONV "clGetContextInfo" raw_clGetContextInfo ::
CLContext -> CLContextInfo_ -> CSize -> Ptr () -> Ptr CSize -> IO CLint
-- -----------------------------------------------------------------------------
#c
enum CLContextProperties {
cL_CONTEXT_PLATFORM_=CL_CONTEXT_PLATFORM,
+#ifdef CL_VERSION_1_1
+#ifdef __APPLE__
+ cL_CGL_SHAREGROUP_KHR_=CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE
+#else
+ cL_GL_CONTEXT_KHR_=CL_GL_CONTEXT_KHR,
+ cL_EGL_DISPLAY_KHR_=CL_EGL_DISPLAY_KHR,
+ cL_GLX_DISPLAY_KHR_=CL_GLX_DISPLAY_KHR,
+ cL_WGL_HDC_KHR_=CL_WGL_HDC_KHR,
+ cL_CGL_SHAREGROUP_KHR_=CL_CGL_SHAREGROUP_KHR
+#endif
+#endif
};
#endc
{#enum CLContextProperties {upcaseFirstLetter} #}
-- | Specifies a context property name and its corresponding value.
-data CLContextProperty = CL_CONTEXT_PLATFORM CLPlatformID
+data CLContextProperty = CL_CONTEXT_PLATFORM CLPlatformID
-- ^ Specifies the platform to use.
+#ifdef CL_VERSION_1_1
+ | CL_CGL_SHAREGROUP_KHR (Ptr ())
+ -- ^ Specifies the CGL share group to use.
+#ifndef __APPLE__
+ | CL_GL_CONTEXT_KHR (Ptr ())
+ | CL_EGL_DISPLAY_KHR (Ptr ())
+ | CL_GLX_DISPLAY_KHR (Ptr ())
+ | CL_WGL_HDC_KHR (Ptr ())
+#endif
+#endif
deriving( Show )
+packProperty :: CLContextProperty -> [CLContextProperty_]
+packProperty (CL_CONTEXT_PLATFORM pid) = [ getCLValue CL_CONTEXT_PLATFORM_
+ , fromIntegral . ptrToIntPtr $ pid ]
+#ifdef CL_VERSION_1_1
+packProperty (CL_CGL_SHAREGROUP_KHR ptr) = [ getCLValue CL_CGL_SHAREGROUP_KHR_
+ , fromIntegral . ptrToIntPtr $ ptr ]
+#ifndef __APPLE__
+packProperty (CL_GL_CONTEXT_KHR ptr) = [ getCLValue CL_GL_CONTEXT_KHR_
+ , fromIntegral . ptrToIntPtr $ ptr ]
+packProperty (CL_EGL_DISPLAY_KHR ptr) = [ getCLValue CL_EGL_DISPLAY_KHR_
+ , fromIntegral . ptrToIntPtr $ ptr ]
+packProperty (CL_GLX_DISPLAY_KHR ptr) = [ getCLValue CL_GLX_DISPLAY_KHR_
+ , fromIntegral . ptrToIntPtr $ ptr ]
+packProperty (CL_WGL_HDC_KHR ptr) = [ getCLValue CL_WGL_HDC_KHR_
+ , fromIntegral . ptrToIntPtr $ ptr ]
+#endif
+#endif
+
packContextProperties :: [CLContextProperty] -> [CLContextProperty_]
packContextProperties [] = [0]
-packContextProperties (CL_CONTEXT_PLATFORM pid : xs) = getCLValue CL_CONTEXT_PLATFORM_
- : (fromIntegral . ptrToIntPtr $ pid)
- : packContextProperties xs
+packContextProperties (x:xs) = packProperty x ++ packContextProperties xs
unpackContextProperties :: [CLContextProperty_] -> [CLContextProperty]
unpackContextProperties [] = error "non-exhaustive Context Property list"
-unpackContextProperties [x]
+unpackContextProperties [x]
| x == 0 = []
| otherwise = error "non-exhaustive Context Property list"
-unpackContextProperties (x:y:xs) = let ys = unpackContextProperties xs
+unpackContextProperties (x:y:xs) = let ys = unpackContextProperties xs
in case getEnumCL x of
- CL_CONTEXT_PLATFORM_
- -> CL_CONTEXT_PLATFORM
+ CL_CONTEXT_PLATFORM_
+ -> CL_CONTEXT_PLATFORM
+ (intPtrToPtr . fromIntegral $ y) : ys
+#ifdef CL_VERSION_1_1
+ CL_CGL_SHAREGROUP_KHR_
+ -> CL_CGL_SHAREGROUP_KHR
+ (intPtrToPtr . fromIntegral $ y) : ys
+#ifndef __APPLE__
+ CL_GL_CONTEXT_KHR_
+ -> CL_GL_CONTEXT_KHR
(intPtrToPtr . fromIntegral $ y) : ys
-
+ CL_EGL_DISPLAY_KHR_
+ -> CL_EGL_DISPLAY_KHR
+ (intPtrToPtr . fromIntegral $ y) : ys
+ CL_GLX_DISPLAY_KHR_
+ -> CL_GLX_DISPLAY_KHR
+ (intPtrToPtr . fromIntegral $ y) : ys
+ CL_WGL_HDC_KHR_
+ -> CL_WGL_HDC_KHR
+ (intPtrToPtr . fromIntegral $ y) : ys
+#endif
+#endif
+
-- -----------------------------------------------------------------------------
mkContextCallback :: (String -> IO ()) -> ContextCallback
mkContextCallback f msg _ _ _ = peekCString msg >>= f
-- | Creates an OpenCL context.
--- An OpenCL context is created with one or more devices. Contexts are used by
--- the OpenCL runtime for managing objects such as command-queues, memory,
--- program and kernel objects and for executing kernels on one or more devices
+-- An OpenCL context is created with one or more devices. Contexts are used by
+-- the OpenCL runtime for managing objects such as command-queues, memory,
+-- program and kernel objects and for executing kernels on one or more devices
-- specified in the context.
-clCreateContext :: [CLContextProperty] -> [CLDeviceID] -> (String -> IO ())
+clCreateContext :: [CLContextProperty] -> [CLDeviceID] -> (String -> IO ())
-> IO CLContext
clCreateContext [] devs f = withArray devs $ \pdevs ->
wrapPError $ \perr -> do
@@ -124,13 +182,13 @@ clCreateContext props devs f = withArray devs $ \pdevs ->
wrapPError $ \perr -> do
fptr <- wrapContextCallback $ mkContextCallback f
withArray (packContextProperties props) $ \pprops ->
- raw_clCreateContext pprops cndevs pdevs fptr nullPtr perr
+ raw_clCreateContext pprops cndevs pdevs fptr nullPtr perr
where
cndevs = fromIntegral . length $ devs
--- | Create an OpenCL context from a device type that identifies the specific
+-- | Create an OpenCL context from a device type that identifies the specific
-- device(s) to use.
-clCreateContextFromType :: [CLContextProperty] -> [CLDeviceType]
+clCreateContextFromType :: [CLContextProperty] -> [CLDeviceType]
-> (String -> IO ()) -> IO CLContext
clCreateContextFromType [] xs f = wrapPError $ \perr -> do
fptr <- wrapContextCallback $ mkContextCallback f
@@ -139,31 +197,31 @@ clCreateContextFromType [] xs f = wrapPError $ \perr -> do
types = bitmaskFromFlags xs
clCreateContextFromType props xs f = wrapPError $ \perr -> do
fptr <- wrapContextCallback $ mkContextCallback f
- withArray (packContextProperties props) $ \pprops ->
+ withArray (packContextProperties props) $ \pprops ->
raw_clCreateContextFromType pprops types fptr nullPtr perr
where
types = bitmaskFromFlags xs
-- | Increment the context reference count.
--- 'clCreateContext' and 'clCreateContextFromType' perform an implicit retain.
--- This is very helpful for 3rd party libraries, which typically get a context
--- passed to them by the application. However, it is possible that the
--- application may delete the context without informing the library. Allowing
--- functions to attach to (i.e. retain) and release a context solves the
+-- 'clCreateContext' and 'clCreateContextFromType' perform an implicit retain.
+-- This is very helpful for 3rd party libraries, which typically get a context
+-- passed to them by the application. However, it is possible that the
+-- application may delete the context without informing the library. Allowing
+-- functions to attach to (i.e. retain) and release a context solves the
-- problem of a context being used by a library no longer being valid.
--- Returns 'True' if the function is executed successfully, or 'False' if
+-- Returns 'True' if the function is executed successfully, or 'False' if
-- context is not a valid OpenCL context.
clRetainContext :: CLContext -> IO Bool
-clRetainContext ctx = wrapCheckSuccess $ raw_clRetainContext ctx
+clRetainContext ctx = wrapCheckSuccess $ raw_clRetainContext ctx
-- | Decrement the context reference count.
--- After the context reference count becomes zero and all the objects attached
--- to context (such as memory objects, command-queues) are released, the
+-- After the context reference count becomes zero and all the objects attached
+-- to context (such as memory objects, command-queues) are released, the
-- context is deleted.
--- Returns 'True' if the function is executed successfully, or 'False' if
+-- Returns 'True' if the function is executed successfully, or 'False' if
-- context is not a valid OpenCL context.
clReleaseContext :: CLContext -> IO Bool
-clReleaseContext ctx = wrapCheckSuccess $ raw_clReleaseContext ctx
+clReleaseContext ctx = wrapCheckSuccess $ raw_clReleaseContext ctx
getContextInfoSize :: CLContext -> CLContextInfo_ -> IO CSize
getContextInfoSize ctx infoid = alloca $ \(value_size :: Ptr CSize) -> do
@@ -179,8 +237,8 @@ enum CLContextInfo {
#endc
{#enum CLContextInfo {upcaseFirstLetter} #}
--- | Return the context reference count. The reference count returned should be
--- considered immediately stale. It is unsuitable for general use in
+-- | Return the context reference count. The reference count returned should be
+-- considered immediately stale. It is unsuitable for general use in
-- applications. This feature is provided for identifying memory leaks.
--
-- This function execute OpenCL clGetContextInfo with 'CL_CONTEXT_REFERENCE_COUNT'.
@@ -188,7 +246,7 @@ clGetContextReferenceCount :: CLContext -> IO CLuint
clGetContextReferenceCount ctx =
wrapGetInfo (\(dat :: Ptr CLuint) ->
raw_clGetContextInfo ctx infoid size (castPtr dat)) id
- where
+ where
infoid = getCLValue CL_CONTEXT_REFERENCE_COUNT
size = fromIntegral $ sizeOf (0::CLuint)
@@ -198,8 +256,8 @@ clGetContextReferenceCount ctx =
clGetContextDevices :: CLContext -> IO [CLDeviceID]
clGetContextDevices ctx = do
size <- getContextInfoSize ctx infoid
- let n = (fromIntegral size) `div` elemSize
-
+ let n = (fromIntegral size) `div` elemSize
+
allocaArray n $ \(buff :: Ptr CLDeviceID) -> do
whenSuccess (raw_clGetContextInfo ctx infoid size (castPtr buff) nullPtr)
$ peekArray n buff
@@ -210,9 +268,9 @@ clGetContextDevices ctx = do
clGetContextProperties :: CLContext -> IO [CLContextProperty]
clGetContextProperties ctx = do
size <- getContextInfoSize ctx infoid
- let n = (fromIntegral size) `div` elemSize
-
- if n == 0
+ let n = (fromIntegral size) `div` elemSize
+
+ if n == 0
then return []
else allocaArray n $ \(buff :: Ptr CLContextProperty_) ->
whenSuccess (raw_clGetContextInfo ctx infoid size (castPtr buff) nullPtr)
@@ -220,5 +278,5 @@ clGetContextProperties ctx = do
where
infoid = getCLValue CL_CONTEXT_PROPERTIES
elemSize = sizeOf (nullPtr :: CLDeviceID)
-
+
-- -----------------------------------------------------------------------------
View
88 src/Control/Parallel/OpenCL/Memory.chs
@@ -33,15 +33,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
module Control.Parallel.OpenCL.Memory(
-- * Types
CLMem, CLSampler, CLMemFlag(..), CLMemObjectType(..), CLAddressingMode(..),
- CLFilterMode(..), CLImageFormat(..),
+ CLFilterMode(..), CLImageFormat(..), CLChannelOrder(..), CLChannelType(..),
-- * Memory Functions
clCreateBuffer, clRetainMemObject, clReleaseMemObject, clGetMemType,
clGetMemFlags, clGetMemSize, clGetMemHostPtr, clGetMemMapCount,
- clGetMemReferenceCount, clGetMemContext,
+ clGetMemReferenceCount, clGetMemContext, clCreateFromGLBuffer,
-- * Image Functions
- clCreateImage2D, clCreateImage3D, clGetSupportedImageFormats,
- clGetImageFormat, clGetImageElementSize, clGetImageRowPitch,
- clGetImageSlicePitch, clGetImageWidth, clGetImageHeight, clGetImageDepth,
+ clCreateImage2D, clCreateImage3D, clCreateFromGLTexture2D,
+ clGetSupportedImageFormats, clGetImageFormat, clGetImageElementSize,
+ clGetImageRowPitch, clGetImageSlicePitch, clGetImageWidth, clGetImageHeight,
+ clGetImageDepth,
-- * Sampler Functions
clCreateSampler, clRetainSampler, clReleaseSampler, clGetSamplerReferenceCount,
clGetSamplerContext, clGetSamplerAddressingMode, clGetSamplerFilterMode,
@@ -75,6 +76,10 @@ foreign import CALLCONV "clCreateImage2D" raw_clCreateImage2D ::
foreign import CALLCONV "clCreateImage3D" raw_clCreateImage3D ::
CLContext -> CLMemFlags_-> CLImageFormat_p -> CSize -> CSize -> CSize -> CSize
-> CSize -> Ptr () -> Ptr CLint -> IO CLMem
+foreign import CALLCONV "clCreateFromGLTexture2D" raw_clCreateFromGLTexture2D ::
+ CLContext -> CLMemFlags_ -> CLuint -> CLint -> CLuint -> Ptr CLint -> IO CLMem
+foreign import CALLCONV "clCreateFromGLBuffer" raw_clCreateFromGLBuffer ::
+ CLContext -> CLMemFlags_ -> CLuint -> Ptr CLint -> IO CLMem
foreign import CALLCONV "clRetainMemObject" raw_clRetainMemObject ::
CLMem -> IO CLint
foreign import CALLCONV "clReleaseMemObject" raw_clReleaseMemObject ::
@@ -121,6 +126,23 @@ clCreateBuffer ctx xs (sbuff,buff) = wrapPError $ \perr -> do
raw_clCreateBuffer ctx flags (fromIntegral sbuff) buff perr
where
flags = bitmaskFromFlags xs
+
+{-| Creates an OpenCL buffer object from an OpenGL buffer object. Returns a valid non-zero OpenCL buffer object if the buffer object is created successfully. Otherwise it throws the 'CLError':
+ * 'CL_INVALID_CONTEXT' if context is not a valid context or was not created from a GL context.
+
+ * 'CL_INVALID_VALUE' if values specified in flags are not valid.
+
+ * 'CL_INVALID_GL_OBJECT' if bufobj is not a GL buffer object or is a GL buffer object but does not have an existing data store.
+
+ * 'CL_OUT_OF_RESOURCES' if there is a failure to allocate resources required by the OpenCL implementation on the device.
+
+ * 'CL_OUT_OF_HOST_MEMORY' if there is a failure to allocate resources required by the OpenCL implementation on the host.
+-}
+clCreateFromGLBuffer :: Integral a => CLContext -> [CLMemFlag] -> a -> IO CLMem
+clCreateFromGLBuffer ctx xs glObj = wrapPError $ \perr -> do
+ raw_clCreateFromGLBuffer ctx flags cglObj perr
+ where flags = bitmaskFromFlags xs
+ cglObj = fromIntegral glObj
-- | Increments the memory object reference count. returns 'True' if the
-- function is executed successfully. After the memobj reference count becomes
@@ -427,6 +449,62 @@ clCreateImage3D ctx xs fmt iw ih idepth irp isp ptr = wrapPError $ \perr -> with
cid = fromIntegral idepth
cirp = fromIntegral irp
cisp = fromIntegral isp
+
+{-| Creates a 2D OpenCL image object from an existing OpenGL texture.
+
+'clCreateFromGLTexture2D' returns a non-zero image object if the image
+object is created successfully. Otherwise, it throws one of the
+following 'CLError' exceptions:
+
+ * 'CL_INVALID_CONTEXT' if context is not a valid context or was not
+created from a GL context.
+
+ * 'CL_INVALID_VALUE' if values specified in flags are not valid or if
+value specified in texture_target is not one of the values specified
+in the description of texture_target.
+
+ * 'CL_INVALID_MIPLEVEL' if miplevel is less than the value of
+levelbase (for OpenGL implementations) or zero (for OpenGL ES
+implementations); or greater than the value of q (for both OpenGL and
+OpenGL ES). levelbase and q are defined for the texture in section
+3.8.10 (Texture Completeness) of the OpenGL 2.1 specification and
+section 3.7.10 of the OpenGL ES 2.0 specification.
+
+ * 'CL_INVALID_MIPLEVEL' if miplevel is greater than zero and the
+OpenGL implementation does not support creating from non-zero mipmap
+levels.
+
+ * 'CL_INVALID_GL_OBJECT' if texture is not a GL texture object whose
+type matches texture_target, if the specified miplevel of texture is
+not defined, or if the width or height of the specified miplevel is
+zero.
+
+ * 'CL_INVALID_IMAGE_FORMAT_DESCRIPTOR' if the OpenGL texture internal
+format does not map to a supported OpenCL image format.
+
+ * 'CL_OUT_OF_HOST_MEMORY' if there is a failure to allocate resources
+required by the OpenCL implementation on the host.
+
+-}
+clCreateFromGLTexture2D :: (Integral a, Integral b, Integral c) =>
+ CLContext -- ^ A valid OpenCL context in
+ -- which the image object is to
+ -- be created.
+ -> [CLMemFlag] -- ^ A list of flags that is
+ -- used to specify usage
+ -- information about the image
+ -- memory object being created.
+ -> a -- ^ The OpenGL image type of the texture
+ -- (e.g. GL_TEXTURE_2D)
+ -> b -- ^ The mipmap level to be used.
+ -> c -- ^ The GL texture object name.
+ -> IO CLMem
+clCreateFromGLTexture2D ctx xs texType mipLevel tex =
+ wrapPError $ raw_clCreateFromGLTexture2D ctx flags cTexType cMip cTex
+ where flags = bitmaskFromFlags xs
+ cTexType = fromIntegral texType
+ cMip = fromIntegral mipLevel
+ cTex = fromIntegral tex
getNumSupportedImageFormats :: CLContext -> [CLMemFlag] -> CLMemObjectType -> IO CLuint
getNumSupportedImageFormats ctx xs mtype = alloca $ \(value_size :: Ptr CLuint) -> do
View
3  src/Control/Parallel/OpenCL/Query.chs
@@ -67,7 +67,8 @@ module Control.Parallel.OpenCL.Query(
-- -----------------------------------------------------------------------------
import Foreign( Ptr, nullPtr, castPtr, alloca, allocaArray, peek, peekArray )
import Foreign.C.String( CString, peekCString )
-import Foreign.C.Types( CSize )
+import Foreign.C.Types -- expose FFI type constructors, the final imported list
+ -- depends on final architecture
import Foreign.Storable( sizeOf )
import Control.Parallel.OpenCL.Types(
CLbool, CLint, CLuint, CLulong, CLPlatformInfo_, CLDeviceType_,
View
11 src/Control/Parallel/OpenCL/Types.chs
@@ -65,6 +65,7 @@ import Control.Exception( Exception(..), throwIO )
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
+#include <CL/cl_ext.h>
#endif
-- -----------------------------------------------------------------------------
@@ -113,8 +114,15 @@ type CLSamplerInfo_ = {#type cl_sampler_info#}
type CLAddressingMode_ = {#type cl_addressing_mode#}
-- -----------------------------------------------------------------------------
+
+-- * NOTE: Apple lags behind official Khronos header files
#c
enum CLError {
+#ifdef __APPLE__
+ cL_PLATFORM_NOT_FOUND_KHR=-1001,
+#else
+ cL_PLATFORM_NOT_FOUND_KHR=CL_PLATFORM_NOT_FOUND_KHR,
+#endif
cL_BUILD_PROGRAM_FAILURE=CL_BUILD_PROGRAM_FAILURE,
cL_COMPILER_NOT_AVAILABLE=CL_COMPILER_NOT_AVAILABLE,
cL_DEVICE_NOT_AVAILABLE=CL_DEVICE_NOT_AVAILABLE,
@@ -177,6 +185,9 @@ available.
* 'CL_DEVICE_NOT_FOUND', Returned if no OpenCL devices that match the specified
devices were found.
+ * 'CL_PLATFORM_NOT_FOUND_khr', Returned when no .icd (platform drivers)
+ can be properly loaded.
+
* 'CL_IMAGE_FORMAT_MISMATCH', Returned if the specified source and destination
images are not valid image objects.
Please sign in to comment.
Something went wrong with that request. Please try again.