Vulkan rendering on Windows

For the next major release of my app, I’d like to move away from OpenGL and switch to Vulkan.
My app does a lot of offscreen rendering and basically only draws the resulting texture to a canvas in JUCE using an OpenGL renderer.

The plan is to move the offscreen renderer over to Vulkan.
On the Mac I could probably just write my own component which draws the Vulkan texture onto a Vulkan surface (there’s vkCreateMacOSSurfaceMVK which looks like the perfect fit here).
I don’t yet know if this prevents me from using OpenGL in the same window. That’s still on the research list.

I never actually had a look at how JUCE implements Components under the hood on Windows. It looks like the OS really just provides the window and not the actual views, right?
This probably prevents me from using the same approach as on Mac and I can only use an OpenGL based drawing with some kind of texture sharing between Vulkan and OpenGL.
There appears to be no official way to do this. Only some proprietary extensions to do this.

Does anyone have more experience or can give me pointers on what to look into?

Thanks in advance!

I don’t quite understand, why do you still want to use OpenGL, if you’re using Vulkan? Why not render everything to textures then draw the textures with basic Juce image rendering without scaling for the fast drawing.

Hmm, not sure I understand what you’re suggesting.
And how would I draw Vulkan textures on a non-Vulkan window?

Sorry, I thought you rendered them to a texture, which is a native surface that can be drawn by anything.

JUCE has LowLevelGraphicsContext.

juce Components are internal to juce (that’s why accessibility still lacks on JUCE for example).
It’s a very common approach for cross-platform frameworks (with the pros and cons…)

If you need JUCE components for basic things like buttons or things that don’t need to much movements/changes (eg. CPU rendering is ok). simply paint your components or the main component into an image and from there make it a vulkan texture to your vulkan context.

All that assuming you’re already capable of having a vulkan context in a window within juce.

1 Like