Download

OpenCL & Vulkan Computing power to UE blueprints

OpenCL & Vulkan Computing power to UE blueprints.

The idea of this plugin is to ease the use of GPU computing power without the need to get into c++.

It strives to be an easy implementation of computing kernels(OpenCL) and shaders(Vulkan) for Blueprints.

Although Unreal Engine also provides the capability to create and run computing shaders through FGlobalShader class, i feel like it complicated to create and modify the shaders.

OpenCL targeted version is 1.2 but can be set to up-to 2.0.
Vulkan targeted version is 1.0 but can be set to up-to 1.1.

OpenCL can also run in CPU mode. In case there’s no dedicated GPU available you can switch to that.

Some current functionality.

  1. In-Editor kernel asset editor
  2. Compile in-editor and check if your kernel has errors.
  3. Pass and retrieve parameters to and from kernel (currently FString, FVector, float and integer and arrays of them)
  4. kernel asset
  5. Full blueprint functionality
  6. Ability to execute kernel assets both at run-time and in editor.

Plans:

  1. UTexture2D Parameters
  2. Ability to find text in kernel asset
  3. Open kernel file from hard-disk.
  4. Running kernels in range work-groups
  5. Create computing shaders and kernels with blueprint graph(probably?)

And I’m opened to suggestions.

Update:

  • Implemented syntax highlight. It supports OpenCL in-built functions, constants, variable types, storage types, casts and comments.
  • Now files from hard disk can be loaded either by drag and drop into the content folder or by going to File->Open File in kernel asset editor

Bellow is a screenshot with syntax highlight in place

I’m looking forward for suggestions.

First of all GREAT job so far keep with the great work and thank you to share it. I’m knew with Opencl stuff, i was looking for a way to apply it in my unreal 4 projects, was searching and i found your plugin and man that made my day, but seems that is not up to date in github, can’t wait to try this update. As i get more used to it i will bring suggestions and if i can i will help with the dev. thank you again.

Hi,

Thanks for the input. Currently i’m still in some designing phase. I Managed to implement OpenCL Events and event callback and wait for events when issued to an enqueue command. This allows non-blocking operations. It’s very powerful.
I’m still doing some research and testing until i’ll come out with some new info.

Separately i’m working on a vulkan implementation in same manner. using blueprints to construct and an editor to build the shaders(mostly computing).

I also have in mind to implement a graph to build shaders visually.

Still looking forward to decide.

A workflow example of using non-blocking implementation:

Looks awesome! vulkan is another thing of my interest too, i saw that the new OpenCl version that will be released next year will be with vulkan merged this sounds perfect for what you are doing!
i’m mainly interest in Opencl to use in AI, i’m trying to create ai swarms and use the GPU power seems the solution. Congratulations again this initiative is going to change a lot of things for the UE4 community specially when the people realize the power of it and the possibilities that come with it, and be able to use it in BP is absolutely PERFECT.

Thanks. I really appreciate it. Follow this thread for future updates on the project. I’ll post here whenever i feel i reached a milestone.

Oh i surely will is already bookmarked too and open all the times i open my browser hahahaha.

UPDATE:

  • I’ve removed the OpenCL context object structure and CreateContext node from OpenCL since Vulkan doesn’t have an equivalent of that. Instead, context is self-created during device creation and now only the device should be passed to the other nodes.
  • Since SPIR-V compiler supports both GLSL and HLSL i decided to do the same. I’m already planning to implement syntax highlighting for both languages.

hi [USER=“577271”]Yaki Studios[/USER] how the plugin is comming along? I hope its all going great! i`m eager to try it.

Hi,

Thanks for asking. I’m going forward with the project.

New:

  • Implemented GLSL & HLSL Syntax Highlight
  • Editor preferences for kernel/shader editor

Some screenshots:

I still need to implement some compiler options for glslang and do more tests with both GLSL and HLSL shaders.
Also i still need to create Vulkan objects(device, queues, buffers, etc).

OpenCL side of this is mostly completed and i’m going to merge them soon.

Love to hear it, keep with the awesome job!

UPDATE:

After a lot of research on glslang and SPIR-V i managed to get the compiler working for GLSL.

I’m using the same workflow path as Epic (Kudos to them for already implementing most of the things in VulkanShaderFormat module).
Getting HLSL to work would require porting HLSL to GLSL using hlslcc and from there compile the code to SPIR-V as usual with glslang.

Glslang and hlslcc are already implemented in the engine as modules which is awesome as i don’t have to compile and implement them myself.

After compilation is implemented i believe is going to be a straight forward process to get Vulkan to blueprints.

Awesome! i was about to ask how the things were going and you post an update, that is great! great job!

UPDATE:

  • Testing shader conversion between GLSL to HLSL and vice-versa.
  • I’ve implemented shaderc(which is a wrapper around glslang) for compilation and spirv-cross(no more hlslcc) for conversion.

https://youtube.com/watch?v=AQGeTyleJ2Q

Happy new year! i hope that everything i going great! any update about the plugin!?

Hi,

In this video i’m generating and reading back 128 ^ 3 density data using simplex noise function in less than 6 ms.

I’m using a range kernel with 3 dimensions each of 8 units.

128 ^ 3 = 2,097,152 indexes in the density grid which is a 3D grid in this case.

Because it’s a lot of data. i’m picking 10 random indexes in the grid and print them.

6 ms for this amount of work i believe it’s fair enough.

Check out the video.

https://youtube.com/watch?v=CaOVuWiTl4I

Congratulations!
This is absolutely amazing! do you have in mind a release date of an alpha so we can test it!?

Right now i have no idea when or how will i release it.

In the end i chose to separate OpenCL implementation from Vulkan and I tried as much as possible to simplify it.

However, Vulkan implementation will follow same concept.

I’ve also added some more types to allow more complex use cases for it by default:

I’m trying hard to simplify everything in the workflow so I’ve managed to replaced all this 31 nodes:

with a single custom node that takes wildcard input and expands itself once Is Buffer is selected:

I believe this is a big step in simplifying the process and i’m looking forward to simplify it even more.

how is it going?