Coder Social home page Coder Social logo

opencl-ue4's Introduction

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.

opencl-ue4's People

Contributors

getnamo avatar kwonoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencl-ue4's Issues

add support and example for cl_khr_dx11_sharing

Basic enum with Khronos OpenCL 1.2 headers

NVIDIA CUDAcl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_nv_create_buffer

Experimental OpenCL 2.1 CPU Only Platformcl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_dx9_media_sharing cl_intel_dx9_media_sharing cl_khr_d3d11_sharing cl_khr_gl_sharing cl_khr_fp64 cl_khr_image2d_from_buffer

It appears both support it to some extent. note on nvidia: https://www.khronos.org/registry/OpenCL/extensions/nv/cl_nv_d3d11_sharing.txt

https://software.intel.com/en-us/articles/sharing-surfaces-between-opencl-and-directx-11-on-intel-processor-graphics

Trouble building for UE 4.20

It looks like dev for this stopped like a year ago, but I think this looks pretty interesting to play with! I'm using Unreal Engine 4.20 and its automatic rebuild of the project failed. I'm not well-versed with editing anything that would be necessary for doing that. Is it possible to make and push the necessary changes or provide the details for me to try myself and make a pull request?

add TArray<uint8> <=> Various data types auto conversion

In order to be able to pass customized input/output data to your cl kernels, we need a way to specify these inputs and bind this data in blueprints.

Consider being able to pass in textures, float arrays, int arrays, vector arrays etc. Most likely setup is using TArray as intermediary cast.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.