Skip to content

File plugin.cpp

File List > offload_rendering_client > plugin.cpp

Go to the documentation of this file

// ILLIXR core headers
#include "illixr/plugin.hpp"

#ifndef __ANDROID__

// ILLIXR Vulkan headers
#    include "illixr/vk/render_pass.hpp"
#    include "illixr/vk/vk_extension_request.hpp"

// FFmpeg headers (C interface)
extern "C" {
#    include "libavfilter_illixr/buffersink.h"
#    include "libavfilter_illixr/buffersrc.h"
#    include "libswscale_illixr/swscale.h"
}

#endif // !__ANDROID__

#include "offload_rendering_client.hpp"

#include 
#include 

using namespace ILLIXR;
#ifndef __ANDROID__
using namespace ILLIXR::vulkan::ffmpeg_utils;
#endif

class offload_rendering_client_loader
    : public plugin
#ifndef __ANDROID__
    , public vulkan::vk_extension_request
#endif
{
public:
    [[maybe_unused]] offload_rendering_client_loader(const std::string& name, phonebook* pb)
        : plugin(name, pb)
        , offload_rendering_client_plugin{std::make_shared<offload_rendering_client>(name, pb)} {
#ifndef __ANDROID__
        pb->register_impl<vulkan::app>(offload_rendering_client_plugin);
#endif
    }

#ifndef __ANDROID__
    std::vector<const char*> get_required_instance_extensions() override {
        return {VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME,
                VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME};
    }

    std::vector<const char*> get_required_devices_extensions() override {
        return {VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME,
                VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME,
                VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME};
    }
#endif // !__ANDROID__
    void start() override {
        offload_rendering_client_plugin->start();
    }

    void stop() override {
        offload_rendering_client_plugin->stop();
    }

private:
    std::shared_ptr<offload_rendering_client> offload_rendering_client_plugin;
};

PLUGIN_MAIN(offload_rendering_client_loader)