projectm icon indicating copy to clipboard operation
projectm copied to clipboard

[FEATURE] Add Vulkan/Metal rendering support

Open kblaschke opened this issue 2 years ago • 6 comments

Currently, libprojectM only supports rendering using OpenGL 3 and GLES 2. Since OpenGL is generally considered a deprecated API and Vulkan/Metal has a better API to perform multi-threaded rendering and shader compilation, it will be a good step forward to add support for these next-gen rendering APIs.

Any API-specific initialization calls, e.g. providing the required Vulkan structs, should be implemented in a specific header, e.g. libprojectM/renderer_vulkan.h. Adding support for multiple rendering backends will also require a major refactoring of the library, abstracting rendering-related calls. projectM only renders a few primitives (triangle fans/strips, line strips and points) and uses vertex and fragment shader programs, so there's not much to implement.

Line rendering should be improved beforehand, as covered by issue #682.

Vulkan support should be introduced together with the EGL migration covered by issue #681.

kblaschke avatar Jan 07 '23 15:01 kblaschke

You could also consider sticking to GLES and using libangle to translate it to Metal (could even be used on windows so it works on top of direct 3D etc)

olilarkin avatar Jan 09 '23 18:01 olilarkin

Just thought I'd mention it since I've had some recent success with the metal port of angle

olilarkin avatar Jan 09 '23 18:01 olilarkin

GLES is very limited, and also doesn't allow proper multithreading. Using Vulkan/Metal directly would give some performance improvements, especially when switching presets, as shaders and other resources could be set up in a dedicated parallel thread instead of the render thread, which currently causes hiccups.

kblaschke avatar Jan 20 '23 21:01 kblaschke

is any work being done on this currently or is it up for grabs?

jherico avatar Mar 11 '24 17:03 jherico

is any work being done on this currently or is it up for grabs?

No work is being done, please feel free!

revmischa avatar Mar 12 '24 18:03 revmischa

is any work being done on this currently or is it up for grabs?

Anyone who wants to do this, please go ahead!

If you're implementing it, please keep OpenGL/GLES support in projectM. While OpenGL is deprecated, it's still the only way to get projectM running on some devices and systems, one of them being WebGL/Emscripten.

Also note libprojectM is a library, so all render system initialization should not be part of the library, but done in the outside application. Whatever is needed to render output (e.g. the Vulkan device & swapchain information) needs to be passed in via the API.

kblaschke avatar Mar 14 '24 10:03 kblaschke