Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacFrameworks Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/OpenCL/OpenCL
This example is the version from Sun, 17th Mar 2012.
Project "OpenCL.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Sub DoubleClick()
MsgBox List.cell(List.ListIndex,0)+EndOfLine+EndOfLine+List.cell(List.ListIndex,1)
End EventHandler
EventHandler Sub ExpandRow(row As Integer)
dim id as variant = List.Celltag(row,0)
if id isa CLPlatformMBS then
// Platform
dim platform as CLPlatformMBS = id
Add platform.Profile, "Profile"
Add platform.Version, "Version"
Add platform.Name, "Name"
Add platform.Vendor, "Vendor"
Add platform.Extensions, "Extensions"
dim Devices(-1) as CLDeviceMBS = platform.Devices(CLDeviceMBS.kDeviceTypeAll)
for each d as CLDeviceMBS in Devices
AddDevice d
next
elseif id isa CLDeviceMBS then
// Device
dim device as CLDeviceMBS = id
Add device.Name, "Name"
Add device.Vendor, "Vendor"
Add device.Profile, "Profile"
Add device.DriverVersion, "DriverVersion"
Add device.DeviceVersion, "DeviceVersion"
Add device.Extensions, "Extensions"
Add device.VendorId,"VendorId"
Add device.MaxComputeUnits,"MaxComputeUnits"
Add device.MaxWorkItemDimensions,"MaxWorkItemDimensions"
Add device.MaxWorkGroupSize,"MaxWorkGroupSize"
Add device.PreferredVectorWidthChar,"PreferredVectorWidthChar"
Add device.PreferredVectorWidthShort,"PreferredVectorWidthShort"
Add device.PreferredVectorWidthInt,"PreferredVectorWidthInt"
Add device.PreferredVectorWidthLong,"PreferredVectorWidthLong"
Add device.PreferredVectorWidthFloat,"PreferredVectorWidthFloat"
Add device.PreferredVectorWidthDouble,"PreferredVectorWidthDouble"
Add device.MaxClockFrequency,"MaxClockFrequency"
Add device.AddressBits,"AddressBits"
Add device.MaxMemoryAllocSize,"MaxMemoryAllocSize"
Add device.ImageSupport,"ImageSupport"
Add device.MaxReadImageArgs,"MaxReadImageArgs"
Add device.MaxWriteImageArgs,"MaxWriteImageArgs"
Add device.Image2dMaxWidth,"Image2dMaxWidth"
Add device.Image2dMaxHeight,"Image2dMaxHeight"
Add device.Image3dMaxWidth,"Image3dMaxWidth"
Add device.Image3dMaxHeight,"Image3dMaxHeight"
Add device.Image3dMaxDepth,"Image3dMaxDepth"
Add device.MaxSamplers,"MaxSamplers"
Add device.MaxParameterSize,"MaxParameterSize"
Add device.MemoryBaseAddressAlign,"MemoryBaseAddressAlign"
Add device.MinDataTypeAlignSize,"MinDataTypeAlignSize"
Add device.GlobalMemoryCachelineSize,"GlobalMemoryCachelineSize"
Add device.GlobalMemoryCacheSize,"GlobalMemoryCacheSize"
Add device.GlobalMemorySize,"GlobalMemorySize"
Add device.MaxConstantBufferSize,"MaxConstantBufferSize"
Add device.MaxConstantArgs,"MaxConstantArgs"
Add device.LocalMemorySize,"LocalMemorySize"
Add device.ErrorCorrectionSupport,"ErrorCorrectionSupport"
Add device.ProfilingTimerResolution,"ProfilingTimerResolution"
Add device.EndianLittle,"EndianLittle"
Add device.Available,"Available"
Add device.CompilerAvailable,"CompilerAvailable"
end if
End EventHandler
End Control
EventHandler Sub Open()
if not OpenCLMBS.isAvailable then
if TargetMachO and TargetX86 then
MsgBox "OpenCL not available. Please install Mac OS X 10.6 to use it."
else
MsgBox "OpenCL not available. You need a Mac with Intel processor running Mac OS X 10.6."
end if
Return
end if
dim Platforms(-1) as CLPlatformMBS = OpenCLMBS.Platforms
for each p as CLPlatformMBS in Platforms
AddPlatform p
next
// show all devices of all platforms...
'dim Devices(-1) as CLDeviceMBS = OpenCLMBS.AllDevices(CLDeviceMBS.kDeviceTypeAll)
'
'for each p as CLDeviceMBS in Devices
'AddDevice p
'next
End EventHandler
Sub Add(value as variant, key as string)
List.AddRow key
List.cell(List.LastIndex,1)=value
End Sub
Sub AddDevice(d as CLDeviceMBS)
List.Addfolder "Device "+hex(d.handle)
List.Celltag(List.LastIndex,0)=d
End Sub
Sub AddPlatform(p as CLPlatformMBS)
List.Addfolder "Platform "+hex(p.Handle)
List.Celltag(List.LastIndex,0)=p
List.Expanded(list.LastIndex)=true
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS MacFrameworks Plugin.