opencl-ue4
opencl-ue4 copied to clipboard
OpenCL Plugin for Unreal Engine 4
OpenCL Plugin for Unreal Engine 4
Enables using OpenCL kernel from UE4. Supports both blueprint and C++.
Forked from original work by kwonoh.
Installation
Windows
- Install NVIDIA, AMD Graphics Driver, or Intel OpenCL runtime.
- Browse to your project folder (typically found at Documents/Unreal Project/{Your Project Root})
- Copy Plugins folder into your Project root.
OS X
- Browse to your project folder
- Copy Plugins folder into your Project root.
C++ extra steps
- Add "OpenCL" under "PublicDependencyModuleNames" in your *.Build.cs file to include header files from your project.
- Include "OpenCL.h" in your source code.
How to use
Add an Open CL Component
to an actor of your choice.
Optionally enumerate and add to or remove from your Device Group. For v0.3 the plugin will only run kernels on the first device in the Device Group array (index 0)
Run a kernel either directly from string source
or from a file, default expected location is {project root}/Content/Kernels. Here's an example hello.cl
kernel
then subscribe to your component's On Result
callback
for example print out the result string
Note that kernel compile errors will be logged to your Output log, which should make development easy.
To improve the development loop further the plugin contains a convenience OpenCLDevActor
where you can specify a filename and kernel function name and upon play it will watch that file in {project root}/Content/Kernels. This means you can open your favorite text editor
and it will hotreload whenever that file has changed.
That's more or less it for blueprint use for v0.3. You have access to the whole OpenCL library so if you want to dig down to C++ level you can bind much more complicated workflows. See https://github.com/getnamo/opencl-ue4/blob/master/Source/OpenCL/Private/OpenCLPlugin.cpp#L131 for code examples.
Supported Platform
See https://github.com/getnamo/opencl-ue4/releases. If you're version isn't listed it can probably still be recompiled without code changes.
Known Issues
- If you get an access error when calling
clGetPlatformIDs
during Debug, it is likely the intel platform causing problems. Solution: https://software.intel.com/en-us/forums/opencl/topic/705036
Screenshots
Windows
OS X
Legal info
Unreal® is a trademark or registered trademark of Epic Games, Inc. in the United States of America and elsewhere. Unreal® Engine, Copyright 1998 – Current, Epic Games, Inc. All rights reserved.
Plugin is completely free and available under MIT open-source license.