module Foreign.OpenCL.Bindings.Platform (
getPlatformIDs,
platformProfile, platformVersion, platformName,
platformVendor, platformExtensions
)
where
import Foreign.C.Types
import Foreign.Ptr
import Foreign.OpenCL.Bindings.Internal.Types
import Foreign.OpenCL.Bindings.Internal.Error
import Foreign.OpenCL.Bindings.Internal.Util
import qualified Foreign.OpenCL.Bindings.Internal.Logging as Log
getPlatformIDs :: IO [PlatformID]
getPlatformIDs = do
Log.debug "Invoking clGetPlatformIDs"
getList clGetPlatformIDs_
platformProfile :: PlatformID -> IO String
platformProfile pid = getPlatformInfo PlatformProfile pid
platformVersion :: PlatformID -> IO String
platformVersion pid = getPlatformInfo PlatformVersion pid
platformName :: PlatformID -> IO String
platformName pid = getPlatformInfo PlatformName pid
platformVendor :: PlatformID -> IO String
platformVendor pid = getPlatformInfo PlatformVendor pid
platformExtensions :: PlatformID -> IO [String]
platformExtensions pid = words `fmap` getPlatformInfo PlatformExtensions pid
getPlatformInfo info platform =
getInfo (clGetPlatformInfo_ platform) info
clGetPlatformIDs_ num_entries platforms num_platforms = do
checkClError "clGetPlatformIDs" =<<
clGetPlatformIDs num_entries platforms num_platforms
clGetPlatformInfo_ platform name size value size_ret = do
checkClError "clGetPlatformInfo" =<<
clGetPlatformInfo platform name size value size_ret
foreign import ccall unsafe "Foreign/OpenCL/Bindings/Platform.chs.h clGetPlatformIDs"
clGetPlatformIDs :: (CUInt -> ((Ptr (PlatformID)) -> ((Ptr CUInt) -> (IO CInt))))
foreign import ccall unsafe "Foreign/OpenCL/Bindings/Platform.chs.h clGetPlatformInfo"
clGetPlatformInfo :: ((PlatformID) -> (CUInt -> (CULong -> ((Ptr ()) -> ((Ptr CULong) -> (IO CInt))))))