/opencl-ue4

OpenCL Plugin for Unreal Engine 4

Primary LanguageC++MIT LicenseMIT

OpenCL Plugin for Unreal Engine 4

GitHub release Github All Releases

Enables using OpenCL kernel from UE4. Supports both blueprint and C++.

Forked from original work by kwonoh.

Installation

Windows

  1. Install NVIDIA, AMD Graphics Driver, or Intel OpenCL runtime.
  2. Browse to your project folder (typically found at Documents/Unreal Project/{Your Project Root})
  3. Copy Plugins folder into your Project root.

OS X

  1. Browse to your project folder
  2. Copy Plugins folder into your Project root.

C++ extra steps

  1. Add "OpenCL" under "PublicDependencyModuleNames" in your *.Build.cs file to include header files from your project.
  2. Include "OpenCL.h" in your source code.

How to use

Add an Open CL Component to an actor of your choice.

add component

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)

enumerate devices

Run a kernel either directly from string source

run inline

or from a file, default expected location is {project root}/Content/Kernels. Here's an example hello.cl kernel

run from file

then subscribe to your component's On Result callback

subscribe

for example print out the result string

print results

Note that kernel compile errors will be logged to your Output log, which should make development easy. kernel compile

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

own editor

and it will hotreload whenever that file has changed.

hotreload

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

Screenshots

Windows

Log Screenshots on Windows

OS X

Log Screenshots on 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.