parawave / vulkan-cpp-library

Parawave Vulkan C++ is a collection of JUCE modules that extend the application framework by adding the LunarG Vulkan SDK.
https://parawave-audio.com/vulkan-cpp-library
Other
25 stars 2 forks source link
c-plus-plus cpp juce juce-modules vulkan

Parawave Vulkan C++ is a collection of JUCE modules that extend the application framework by adding the LunarG Vulkan SDK.

The provided modules can be used together with the regular juce_graphics and juce_gui_basics modules to paint hardware accelerated graphics to a native surface.


Important

At the current time the modules are developed and tested on Windows 10 only. Although possible, there is no support for MacOS / iOS / Linux or Android yet. Hopefully this will change. Any help and contribution is appreciated.


Getting Started

Requirements

The code is intended to be used together with the JUCE framework, therefore the same general requirements apply.

Projucer

Add the [pw_vulkan]() and [pw_vulkan_graphics]() modules to your Projucer project.

The modules provided here depend on header and library files of the Vulkan SDK, therefore it's necessary to manually add the include and library directories to your Projucer project. e.g. for version 1.2.170.0 of the SDK, the paths are:


Examples

Attaching a Context

Similar to the juce::OpenGLContext a [parawave::VulkanContext]() can be attached to a juce::Component to activate it for use with juce::Graphics. Alternatively your component could directly extend from [parawave::VulkanAppComponent](), similar to juce::OpenGLAppComponent.

class MainComponent : public juce::Component
{
public:
    MainComponent()
    {
        context.setDefaultPhysicalDevice(instance);
        context.attachTo(*this);
    }

    ~MainComponent() override
    {
        context.detach();
    }

    void paint (juce::Graphics& g) override
    {
        // Draw with Vulkan ...
    }

    parawave::VulkanInstance instance;
    parawave::VulkanContext context;
};

Modules

pw_vulkan

This module provides wrapper classes around all major Vulkan vk::Unique... structures to simplify the setup process of Vulkan objects. VulkanDevice for example holds a vk::UniqueDevice (vkDevice) and simplifies the device creation by hiding the device extension selection in the implementation.

There are also a few utility classes for common tasks like memory allocation, image/buffer transfers and fence/semaphore synchronization.

pw_vulkan_graphics

This module depends on pw_vulkan and implements a juce::LowLevelGraphicsContext in VulkanContext similar to juce::OpenGLContext. A VulkanImageType also allows the use of regular juce::Image objects as render target for juce::Graphics operations.


Contribution / What to do!?

How can you contribute and what steps are necessary to get to a production ready state?


References